mirror of
https://github.com/hassio-addons/addon-tautulli.git
synced 2025-05-05 03:21:40 +00:00
✅ Added logic to check if it's the first run after an upgrade. (#3)
This commit is contained in:
parent
d5b41cf726
commit
34f8dc441c
2 changed files with 22 additions and 5 deletions
|
@ -2,6 +2,9 @@ ARG BUILD_FROM=hassioaddons/base:2.1.2
|
||||||
# hadolint ignore=DL3006
|
# hadolint ignore=DL3006
|
||||||
FROM ${BUILD_FROM}
|
FROM ${BUILD_FROM}
|
||||||
|
|
||||||
|
# Set env
|
||||||
|
ENV TAUTULLI_VERSION 'v2.1.18'
|
||||||
|
|
||||||
# Set shell
|
# Set shell
|
||||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||||
|
|
||||||
|
@ -29,7 +32,7 @@ RUN \
|
||||||
pycryptodomex==3.6.6 \
|
pycryptodomex==3.6.6 \
|
||||||
crudini==0.9 \
|
crudini==0.9 \
|
||||||
PyOpenSSL==18.0.0 \
|
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 \
|
https://github.com/Tautulli/Tautulli.git /opt \
|
||||||
&& apk del --purge .build-dependencies \
|
&& apk del --purge .build-dependencies \
|
||||||
&& find /usr/lib/python2.7/ -type d -name tests -depth -exec rm -rf {} \; \
|
&& find /usr/lib/python2.7/ -type d -name tests -depth -exec rm -rf {} \; \
|
||||||
|
|
|
@ -7,16 +7,15 @@
|
||||||
source /usr/lib/hassio-addons/base.sh
|
source /usr/lib/hassio-addons/base.sh
|
||||||
|
|
||||||
CONFIG=/data/config.ini
|
CONFIG=/data/config.ini
|
||||||
|
ADDON=/data/addon.ini
|
||||||
|
|
||||||
# If config.ini does not exist, create it.
|
# If config.ini does not exist, create it.
|
||||||
if ! hass.file_exists "/data/config.ini"; then
|
if ! hass.file_exists "/data/config.ini"; then
|
||||||
hass.log.info "Creating default configuration..."
|
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 first_run_complete 0
|
||||||
crudini --set "$CONFIG" General check_github 0
|
crudini --set "$CONFIG" General update_show_changelog 0
|
||||||
crudini --set "$CONFIG" General check_github_on_startup 0
|
|
||||||
crudini --set "$CONFIG" Advanced system_analytics 0
|
crudini --set "$CONFIG" Advanced system_analytics 0
|
||||||
|
crudini --set "$ADDON" Addon version "$TAUTULLI_VERSION"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
hass.log.info "Updating running configuration..."
|
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]]
|
## 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"
|
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
|
# Update SSL info in configuration
|
||||||
if hass.config.true 'ssl'; then
|
if hass.config.true 'ssl'; then
|
||||||
hass.log.info "Ensure SSL is active in the configuration..."
|
hass.log.info "Ensure SSL is active in the configuration..."
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue