diff --git a/tautulli/Dockerfile b/tautulli/Dockerfile index 6d32e36..46da352 100644 --- a/tautulli/Dockerfile +++ b/tautulli/Dockerfile @@ -2,6 +2,9 @@ ARG BUILD_FROM=hassioaddons/base:2.1.2 # hadolint ignore=DL3006 FROM ${BUILD_FROM} +# Set env +ENV TAUTULLI_VERSION 'v2.1.18' + # Set shell SHELL ["/bin/bash", "-o", "pipefail", "-c"] @@ -29,7 +32,7 @@ RUN \ pycryptodomex==3.6.6 \ crudini==0.9 \ PyOpenSSL==18.0.0 \ - && git clone --branch "v2.1.18" --depth=1 \ + && git clone --branch $TAUTULLI_VERSION --depth=1 \ https://github.com/Tautulli/Tautulli.git /opt \ && apk del --purge .build-dependencies \ && find /usr/lib/python2.7/ -type d -name tests -depth -exec rm -rf {} \; \ diff --git a/tautulli/rootfs/etc/cont-init.d/20-preparations.sh b/tautulli/rootfs/etc/cont-init.d/20-preparations.sh index c1bc821..4518b6a 100644 --- a/tautulli/rootfs/etc/cont-init.d/20-preparations.sh +++ b/tautulli/rootfs/etc/cont-init.d/20-preparations.sh @@ -7,16 +7,15 @@ source /usr/lib/hassio-addons/base.sh CONFIG=/data/config.ini +ADDON=/data/addon.ini # If config.ini does not exist, create it. if ! hass.file_exists "/data/config.ini"; then hass.log.info "Creating default configuration..." - crudini --set "$CONFIG" General week_start_monday 1 - crudini --set "$CONFIG" General update_show_changelog 0 crudini --set "$CONFIG" General first_run_complete 0 - crudini --set "$CONFIG" General check_github 0 - crudini --set "$CONFIG" General check_github_on_startup 0 + crudini --set "$CONFIG" General update_show_changelog 0 crudini --set "$CONFIG" Advanced system_analytics 0 + crudini --set "$ADDON" Addon version "$TAUTULLI_VERSION" fi hass.log.info "Updating running configuration..." @@ -25,6 +24,21 @@ hass.log.info "Updating running configuration..." ## This has to be done because Tautulli added a ini header with [[header]] sed -i "s/\\[\\[get_file_sizes_hold\\]\\]/\\[get_file_sizes_hold\\]/" "$CONFIG" +# Set spesific config if an upgrade +CURRENT_VERSION=$(crudini --get "$ADDON" Addon version) +if [ "$CURRENT_VERSION" != "$TAUTULLI_VERSION" ]; then + hass.log.debug "This is an upgrade..." + crudini --set "$CONFIG" General update_show_changelog 1 +else + hass.log.debug "This is not an upgrade..." + crudini --set "$CONFIG" General update_show_changelog 0 +fi + +# Ensure config +crudini --set "$ADDON" Addon version "$TAUTULLI_VERSION" +crudini --set "$CONFIG" General check_github 0 +crudini --set "$CONFIG" General check_github_on_startup 0 + # Update SSL info in configuration if hass.config.true 'ssl'; then hass.log.info "Ensure SSL is active in the configuration..."