This commit is contained in:
Alexandre
2022-02-18 14:44:39 +01:00
parent 4bc5b57396
commit 3a7f68c7d3
6 changed files with 30 additions and 28 deletions

View File

@@ -85,7 +85,7 @@ echo "${CONFIG}" >"$CONFIGDIR"/settings.json &&
# USER and PASS # USER and PASS
############### ###############
CONFIG=$(<$CONFIGDIR/settings.json) CONFIG=$(<"$CONFIGDIR"/settings.json)
USER=$(bashio::config 'user') USER=$(bashio::config 'user')
PASS=$(bashio::config 'pass') PASS=$(bashio::config 'pass')
if bashio::config.has_value 'user'; then if bashio::config.has_value 'user'; then
@@ -98,7 +98,7 @@ fi
CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-authentication-required\"=${BOOLEAN}") CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-authentication-required\"=${BOOLEAN}")
CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-username\"=\"${USER}\"") CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-username\"=\"${USER}\"")
CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-password\"=\"${PASS}\"") CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-password\"=\"${PASS}\"")
echo "${CONFIG}" >$CONFIGDIR/settings.json && echo "${CONFIG}" >"$CONFIGDIR"/settings.json &&
jq . -S "$CONFIGDIR"/settings.json | cat >temp.json && mv temp.json "$CONFIGDIR"/settings.json jq . -S "$CONFIGDIR"/settings.json | cat >temp.json && mv temp.json "$CONFIGDIR"/settings.json
# WHITELIST # WHITELIST

View File

@@ -5,14 +5,14 @@
# INGRESS SETTING # # INGRESS SETTING #
################### ###################
declare port declare port
declare certfile #declare certfile
declare ingress_interface #declare ingress_interface
declare ingress_port #declare ingress_port
declare keyfile #declare keyfile
# General values # General values
port=$(bashio::addon.ingress_port) port=$(bashio::addon.ingress_port)
if [ $port ] >1; then if [ "$port" ] >1; then
# Adapt nginx # Adapt nginx
sed -i "s|%%port%%|$port|g" /etc/nginx/servers/ingress.conf sed -i "s|%%port%%|$port|g" /etc/nginx/servers/ingress.conf
sed -i "s|%%interface%%|$(bashio::addon.ip_address)|g" /etc/nginx/servers/ingress.conf sed -i "s|%%interface%%|$(bashio::addon.ip_address)|g" /etc/nginx/servers/ingress.conf

View File

@@ -6,8 +6,8 @@
############### ###############
declare port declare port
declare certfile declare certfile
declare ingress_interface #declare ingress_interface
declare ingress_port #declare ingress_port
declare keyfile declare keyfile
# General values # General values

View File

@@ -8,5 +8,5 @@ FILES=$(jq ".filesPaths[0].pathString" /config/addons_config/ubooquity/preferenc
COMICS=$(jq ".comicsPaths[0].pathString" /config/addons_config/ubooquity/preferences.json) COMICS=$(jq ".comicsPaths[0].pathString" /config/addons_config/ubooquity/preferences.json)
BOOKS=$(jq ".booksPaths[0].pathString" /config/addons_config/ubooquity/preferences.json) BOOKS=$(jq ".booksPaths[0].pathString" /config/addons_config/ubooquity/preferences.json)
mkdir -p $FILES $COMICS $BOOKS /config/addons_config/ubooquity || true mkdir -p "$FILES" "$COMICS" "$BOOKS" /config/addons_config/ubooquity || true
chown -R abc:abc $FILES $COMICS $BOOKS /config/addons_config/ubooquity || true chown -R abc:abc "$FILES" "$COMICS" "$BOOKS" /config/addons_config/ubooquity || true

View File

@@ -11,7 +11,7 @@ if bashio::config.has_value 'theme'; then
bashio::log.info "Alternate theme enabled : $CUSTOMUI. If webui don't work, disable this option" bashio::log.info "Alternate theme enabled : $CUSTOMUI. If webui don't work, disable this option"
### Download WebUI ### Download WebUI
case $CUSTOMUI in case "$CUSTOMUI" in
"comixology2") "comixology2")
curl -s -S -J -L -o /data/release.zip https://github.com/scooterpsu/Comixology_Ubooquity_2/releases/download/v3.4/comixology2.zip >/dev/null && curl -s -S -J -L -o /data/release.zip https://github.com/scooterpsu/Comixology_Ubooquity_2/releases/download/v3.4/comixology2.zip >/dev/null &&
unzip -o -q /data/release.zip -d /config/addons_config/ubooquity/themes/ unzip -o -q /data/release.zip -d /config/addons_config/ubooquity/themes/
@@ -29,6 +29,6 @@ if bashio::config.has_value 'theme'; then
rm /data/release.zip || true rm /data/release.zip || true
### Set preference ### Set preference
jq --arg variable $CUSTOMUI '.theme = $variable' /config/addons_config/ubooquity/preferences.json | sponge /config/addons_config/ubooquity/preferences.json jq --arg variable "$CUSTOMUI" '.theme = $variable' /config/addons_config/ubooquity/preferences.json | sponge /config/addons_config/ubooquity/preferences.json
fi fi

View File

@@ -1,5 +1,6 @@
#!/usr/bin/env bashio #!/usr/bin/env bashio
# shellcheck shell=bash # shellcheck shell=bash
# shellcheck disable=SC2155
#################### ####################
# GLOBAL VARIABLES # # GLOBAL VARIABLES #
@@ -71,7 +72,7 @@ if bashio::config.true 'ssl'; then
#Send env variables #Send env variables
export HTTPS=true export HTTPS=true
export SSL=true export SSL=true
BASE_URL=$BASE_URL:$(bashio::addon.port 443) BASE_URL="$BASE_URL":$(bashio::addon.port 443)
export BASE_URL="${BASE_URL/http:/https:}" export BASE_URL="${BASE_URL/http:/https:}"
#Communication #Communication
@@ -86,34 +87,35 @@ bashio::log.info "Launching app, please wait"
# Change data location # Change data location
echo "... update data with image" echo "... update data with image"
OLD_WEBTREES_HOME=$WEBTREES_HOME OLD_WEBTREES_HOME="$WEBTREES_HOME"
export WEBTREES_HOME="/share/webtrees" export WEBTREES_HOME="/share/webtrees"
cp -rn /var/www/webtrees "$(dirname "$OLD_WEBTREES_HOME")" &>/dev/null || true cp -rn /var/www/webtrees "$(dirname "$OLD_WEBTREES_HOME")" &>/dev/null || true
mkdir -p $WEBTREES_HOME mkdir -p "$WEBTREES_HOME"
echo "... update permissions" echo "... update permissions"
chown -R www-data:www-data $OLD_WEBTREES_HOME chown -R www-data:www-data "$OLD_WEBTREES_HOME"
chown -R www-data:www-data $WEBTREES_HOME chown -R www-data:www-data "$WEBTREES_HOME"
# Make links with share # Make links with share
echo "... make links with data in /share" echo "... make links with data in /share"
for VOL in "data" "modules_v4"; do for VOL in "data" "modules_v4"; do
mkdir -p $OLD_WEBTREES_HOME/$VOL mkdir -p "$OLD_WEBTREES_HOME"/"$VOL"
cp -rn $OLD_WEBTREES_HOME/$VOL $WEBTREES_HOME || true cp -rn "$OLD_WEBTREES_HOME"/"$VOL" "$WEBTREES_HOME" || true
rm -r $OLD_WEBTREES_HOME/$VOL || true # shellcheck disable=SC2115
rm -r "$OLD_WEBTREES_HOME"/"$VOL" || true
echo "... linking $VOL" echo "... linking $VOL"
ln -s $WEBTREES_HOME/$VOL $OLD_WEBTREES_HOME ln -s "$WEBTREES_HOME"/"$VOL" "$OLD_WEBTREES_HOME"
done done
chown -R www-data:www-data $WEBTREES_HOME chown -R www-data:www-data "$WEBTREES_HOME"
# Correct base url if needed # Correct base url if needed
echo "... align base url with latest addon value" echo "... align base url with latest addon value"
if [ -f $WEBTREES_HOME/data/config.ini.php ]; then if [ -f "$WEBTREES_HOME"/data/config.ini.php ]; then
echo "Aligning base_url addon config" echo "Aligning base_url addon config"
LINE=$(sed -n '/base_url/=' $WEBTREES_HOME/data/config.ini.php) LINE=$(sed -n '/base_url/=' "$WEBTREES_HOME"/data/config.ini.php)
sed -i "$LINE a base_url=\"$BASE_URL\"" $WEBTREES_HOME/data/config.ini.php sed -i "$LINE a base_url=\"$BASE_URL\"" "$WEBTREES_HOME"/data/config.ini.php
sed -i "$LINE d" $WEBTREES_HOME/data/config.ini.php sed -i "$LINE d" "$WEBTREES_HOME"/data/config.ini.php
fi || true fi || true
# Execute main script # Execute main script
@@ -125,7 +127,7 @@ cd /
# END INFO # # END INFO #
############ ############
DB_NAME=$(echo $DB_NAME | tr -d '"') DB_NAME=$(echo "$DB_NAME" | tr -d '"')
bashio::log.info "Data is stored in $WEBTREES_HOME" bashio::log.info "Data is stored in $WEBTREES_HOME"
bashio::log.info "Webui can be accessed at : $BASE_URL" bashio::log.info "Webui can be accessed at : $BASE_URL"