Beautify bash

This commit is contained in:
alexbelgium
2022-03-16 09:56:19 +00:00
committed by GitHub
parent 9ad60be58b
commit dc791623d5
146 changed files with 2017 additions and 2017 deletions

View File

@@ -4,5 +4,5 @@ CONFIGSOURCE=$(bashio::config "CONFIG_LOCATION")
CONFIGSOURCE="$(dirname "${CONFIGSOURCE}")" CONFIGSOURCE="$(dirname "${CONFIGSOURCE}")"
if [ -f "$CONFIGSOURCE"/script.sh ]; then if [ -f "$CONFIGSOURCE"/script.sh ]; then
"$CONFIGSOURCE"./script.sh "$CONFIGSOURCE"./script.sh
fi fi

View File

@@ -42,8 +42,8 @@ chmod -R 775 /config/addons_config/fireflyiii
bashio::log.info "Defining database" bashio::log.info "Defining database"
case $(bashio::config 'DB_CONNECTION') in case $(bashio::config 'DB_CONNECTION') in
# Use sqlite # Use sqlite
sqlite_internal) sqlite_internal)
bashio::log.info "Using built in sqlite" bashio::log.info "Using built in sqlite"
# Set variable # Set variable
@@ -74,8 +74,8 @@ sqlite_internal)
chown -R www-data:www-data /var/www/html/storage chown -R www-data:www-data /var/www/html/storage
;; ;;
# Use MariaDB # Use MariaDB
mariadb_addon) mariadb_addon)
bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Detecting values..." bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Detecting values..."
if ! bashio::services.available 'mysql'; then if ! bashio::services.available 'mysql'; then
bashio::log.fatal \ bashio::log.fatal \
@@ -109,8 +109,8 @@ mariadb_addon)
-e "CREATE DATABASE IF NOT EXISTS \`firefly\` ;" -e "CREATE DATABASE IF NOT EXISTS \`firefly\` ;"
;; ;;
# Use remote # Use remote
*) *)
bashio::log.info "Using remote database. Requirement : filling all addon options fields, and making sure the database already exists" bashio::log.info "Using remote database. Requirement : filling all addon options fields, and making sure the database already exists"
for conditions in "DB_HOST" "DB_PORT" "DB_DATABASE" "DB_USERNAME" "DB_PASSWORD"; do for conditions in "DB_HOST" "DB_PORT" "DB_DATABASE" "DB_USERNAME" "DB_PASSWORD"; do
if ! bashio::config.has_value "$conditions"; then if ! bashio::config.has_value "$conditions"; then

View File

@@ -5,5 +5,5 @@ db=/config/addons_config/jellyfin/data/data/library.db
#Modify base #Modify base
if [ -f $db ]; then if [ -f $db ]; then
sqlite3 -quote ${db} "UPDATE 'TypedBaseItems' SET data = replace( data, '/config/jellyfin/', '/config/addons_config/jellyfin/' ), path = replace( path, '/config/jellyfin/', '/config/addons_config/jellyfin/' ) WHERE type='MediaBrowser.Controller.Entities.CollectionFolder';" sqlite3 -quote ${db} "UPDATE 'TypedBaseItems' SET data = replace( data, '/config/jellyfin/', '/config/addons_config/jellyfin/' ), path = replace( path, '/config/jellyfin/', '/config/addons_config/jellyfin/' ) WHERE type='MediaBrowser.Controller.Entities.CollectionFolder';"
fi fi

View File

@@ -7,42 +7,42 @@ bashio::log.warning "Warning - minimum configuration recommended : 2 cpu cores a
# Check data location # Check data location
LOCATION=$(bashio::config 'data_location') LOCATION=$(bashio::config 'data_location')
if [[ "$LOCATION" = "null" || -z "$LOCATION" ]]; then if [[ "$LOCATION" = "null" || -z "$LOCATION" ]]; then
# Default location # Default location
LOCATION="/config/addons_config/joplin" LOCATION="/config/addons_config/joplin"
else else
bashio::log.warning "Warning : a custom data location was selected, but the previous folder will NOT be copied. You need to do it manually" bashio::log.warning "Warning : a custom data location was selected, but the previous folder will NOT be copied. You need to do it manually"
fi fi
# Create folder # Create folder
if [ ! -d "$LOCATION" ]; then if [ ! -d "$LOCATION" ]; then
echo "Creating $LOCATION" echo "Creating $LOCATION"
mkdir -p "$LOCATION" mkdir -p "$LOCATION"
fi fi
touch "$LOCATION"/database.sqlite touch "$LOCATION"/database.sqlite
if [ ! -d "$LOCATION"/resources ]; then if [ ! -d "$LOCATION"/resources ]; then
mkdir -p "$LOCATION"/resources mkdir -p "$LOCATION"/resources
fi fi
ln -s "$LOCATION"/resources /home/joplin/packages/server ln -s "$LOCATION"/resources /home/joplin/packages/server
chown -R joplin:joplin "$LOCATION" chown -R joplin:joplin "$LOCATION"
chmod -R 777 "$LOCATION" chmod -R 777 "$LOCATION"
chmod 777 "$LOCATION/database.sqlite" chmod 777 "$LOCATION/database.sqlite"
export SQLITE_DATABASE="$LOCATION/database.sqlite" export SQLITE_DATABASE="$LOCATION/database.sqlite"
if bashio::config.has_value 'POSTGRES_DATABASE'; then if bashio::config.has_value 'POSTGRES_DATABASE'; then
bashio::log.info "Using postgres" bashio::log.info "Using postgres"
bashio::config.has_value 'DB_CLIENT' && export DB_CLIENT=$(bashio::config 'DB_CLIENT') && bashio::log.info 'Database client set' bashio::config.has_value 'DB_CLIENT' && export DB_CLIENT=$(bashio::config 'DB_CLIENT') && bashio::log.info 'Database client set'
bashio::config.has_value 'POSTGRES_PASSWORD' && export POSTGRES_PASSWORD=$(bashio::config 'POSTGRES_PASSWORD') && bashio::log.info 'Postgrep Password set' bashio::config.has_value 'POSTGRES_PASSWORD' && export POSTGRES_PASSWORD=$(bashio::config 'POSTGRES_PASSWORD') && bashio::log.info 'Postgrep Password set'
bashio::config.has_value 'POSTGRES_DATABASE' && export POSTGRES_DATABASE=$(bashio::config 'POSTGRES_DATABASE') && bashio::log.info 'Postgrep Database set' bashio::config.has_value 'POSTGRES_DATABASE' && export POSTGRES_DATABASE=$(bashio::config 'POSTGRES_DATABASE') && bashio::log.info 'Postgrep Database set'
bashio::config.has_value 'POSTGRES_USER' && export POSTGRES_USER=$(bashio::config 'POSTGRES_USER') && bashio::log.info 'Postgrep User set' bashio::config.has_value 'POSTGRES_USER' && export POSTGRES_USER=$(bashio::config 'POSTGRES_USER') && bashio::log.info 'Postgrep User set'
bashio::config.has_value 'POSTGRES_PORT' && export POSTGRES_PORT=$(bashio::config 'POSTGRES_PORT') && bashio::log.info 'Postgrep Port set' bashio::config.has_value 'POSTGRES_PORT' && export POSTGRES_PORT=$(bashio::config 'POSTGRES_PORT') && bashio::log.info 'Postgrep Port set'
bashio::config.has_value 'POSTGRES_HOST' && export POSTGRES_HOST=$(bashio::config 'POSTGRES_HOST') && bashio::log.info 'Postgrep Host set' bashio::config.has_value 'POSTGRES_HOST' && export POSTGRES_HOST=$(bashio::config 'POSTGRES_HOST') && bashio::log.info 'Postgrep Host set'
else else
bashio::log.info "Using sqlite" bashio::log.info "Using sqlite"
fi fi

View File

@@ -22,7 +22,7 @@ Brought to you by linuxserver.io
-------------------------------------' -------------------------------------'
if [[ -f /donate.txt ]]; then if [[ -f /donate.txt ]]; then
echo ' echo '
To support the app dev(s) visit:' To support the app dev(s) visit:'
cat /donate.txt cat /donate.txt
fi fi
echo ' echo '

View File

@@ -8,7 +8,7 @@ sed -i "s|%%datadirectory%%|$datadirectory|g" /defaults/config.php
# copy config # copy config
[[ ! -f /data/config/www/nextcloud/config/config.php ]] && [[ ! -f /data/config/www/nextcloud/config/config.php ]] &&
cp /defaults/config.php /data/config/www/nextcloud/config/config.php cp /defaults/config.php /data/config/www/nextcloud/config/config.php
# permissions # permissions
chown abc:abc \ chown abc:abc \

View File

@@ -9,12 +9,12 @@ bashio::log.info "Defining database"
case $(bashio::config 'DB_TYPE') in case $(bashio::config 'DB_TYPE') in
# Use sqlite # Use sqlite
sqlite) sqlite)
bashio::log.info "Using a local sqlite database" bashio::log.info "Using a local sqlite database"
;; ;;
mariadb_addon) mariadb_addon)
bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Discovering values..." bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Discovering values..."
if ! bashio::services.available 'mysql'; then if ! bashio::services.available 'mysql'; then
bashio::log.fatal \ bashio::log.fatal \

View File

@@ -27,6 +27,6 @@ bashio::var.json \
certfile "$(bashio::config 'certfile')" \ certfile "$(bashio::config 'certfile')" \
keyfile "$(bashio::config 'keyfile')" \ keyfile "$(bashio::config 'keyfile')" \
ssl "^$(bashio::config 'ssl')" | ssl "^$(bashio::config 'ssl')" |
tempio \ tempio \
-template /etc/nginx/templates/ingress.gtpl \ -template /etc/nginx/templates/ingress.gtpl \
-out /etc/nginx/servers/ingress.conf -out /etc/nginx/servers/ingress.conf

View File

@@ -39,7 +39,7 @@ LATEST_RELEASE=$(curl -f -s --retry 5 -L https://api.github.com/repos/wdaan/vuet
grep "browser_download_url.*zip" | grep "browser_download_url.*zip" |
cut -d : -f 2,3 | cut -d : -f 2,3 |
tr -d \" | tr -d \" |
xargs) xargs)
[ "$DEBUG" = "debug" ] && echo "Before curl" [ "$DEBUG" = "debug" ] && echo "Before curl"
curl -f -s -S -O -J -L "$LATEST_RELEASE" curl -f -s -S -O -J -L "$LATEST_RELEASE"

View File

@@ -36,15 +36,15 @@ FREQUENCY=$(bashio::config 'Updates')
bashio::log.info "$FREQUENCY updates" bashio::log.info "$FREQUENCY updates"
case $FREQUENCY in case $FREQUENCY in
"Hourly") "Hourly")
sed -i -e '$a 0 * * * * /run.sh' /etc/crontabs/root sed -i -e '$a 0 * * * * /run.sh' /etc/crontabs/root
;; ;;
"Daily") "Daily")
sed -i -e '$a 0 0 * * * /run.sh' /etc/crontabs/root sed -i -e '$a 0 0 * * * /run.sh' /etc/crontabs/root
;; ;;
"Weekly") "Weekly")
sed -i -e '$a 0 0 * * 0 /run.sh' /etc/crontabs/root sed -i -e '$a 0 0 * * 0 /run.sh' /etc/crontabs/root
;; ;;
esac esac

View File

@@ -42,15 +42,15 @@ FREQUENCY=$(bashio::config 'Updates')
bashio::log.info "$FREQUENCY updates" bashio::log.info "$FREQUENCY updates"
case $FREQUENCY in case $FREQUENCY in
"Hourly") "Hourly")
sed -i -e '$a 0 * * * * /run.sh' /etc/crontabs/root sed -i -e '$a 0 * * * * /run.sh' /etc/crontabs/root
;; ;;
"Daily") "Daily")
sed -i -e '$a 0 0 * * * /run.sh' /etc/crontabs/root sed -i -e '$a 0 0 * * * /run.sh' /etc/crontabs/root
;; ;;
"Weekly") "Weekly")
sed -i -e '$a 0 0 * * 0 /run.sh' /etc/crontabs/root sed -i -e '$a 0 0 * * 0 /run.sh' /etc/crontabs/root
;; ;;
esac esac

View File

@@ -17,14 +17,14 @@ bashio::log.info "Defining database"
export DB_TYPE=$(bashio::config 'DB_TYPE') export DB_TYPE=$(bashio::config 'DB_TYPE')
case $(bashio::config 'DB_TYPE') in case $(bashio::config 'DB_TYPE') in
# Use sqlite # Use sqlite
sqlite) sqlite)
bashio::log.info "Using a local sqlite database" bashio::log.info "Using a local sqlite database"
export DB_ENGINE="django.db.backends.sqlite3" export DB_ENGINE="django.db.backends.sqlite3"
export POSTGRES_DB="/config/addons_config/tandoor_recipes/recipes.db" export POSTGRES_DB="/config/addons_config/tandoor_recipes/recipes.db"
;; ;;
mariadb_addon) mariadb_addon)
bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Discovering values..." bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Discovering values..."
if ! bashio::services.available 'mysql'; then if ! bashio::services.available 'mysql'; then
bashio::log.fatal \ bashio::log.fatal \
@@ -51,7 +51,7 @@ mariadb_addon)
bashio::log.warning "Uninstalling the MariaDB addon will remove any data" bashio::log.warning "Uninstalling the MariaDB addon will remove any data"
;; ;;
postgresql_external) postgresql_external)
bashio::log.info "Using an external database, please populate all required fields in the addons config" bashio::log.info "Using an external database, please populate all required fields in the addons config"
export DB_ENGINE=django.db.backends.postgresql export DB_ENGINE=django.db.backends.postgresql
export POSTGRES_HOST=$(bashio::config "POSTGRES_HOST") && bashio::log.blue "POSTGRES_HOST=$POSTGRES_HOST" export POSTGRES_HOST=$(bashio::config "POSTGRES_HOST") && bashio::log.blue "POSTGRES_HOST=$POSTGRES_HOST"

View File

@@ -80,7 +80,7 @@ CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-host-whitelist-enabled\"=false")
CONFIG=$(bashio::jq "${CONFIG}" ".\"bind-address-ipv4\"=\"0.0.0.0\"") CONFIG=$(bashio::jq "${CONFIG}" ".\"bind-address-ipv4\"=\"0.0.0.0\"")
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
# USER and PASS # USER and PASS
############### ###############
@@ -99,7 +99,7 @@ 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
########### ###########
@@ -116,4 +116,4 @@ fi
CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-whitelist-enabled\"=${BOOLEAN}") CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-whitelist-enabled\"=${BOOLEAN}")
CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-whitelist\"=\"$WHITELIST\"") CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-whitelist\"=\"$WHITELIST\"")
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

View File

@@ -9,10 +9,10 @@ PGID=$(bashio::config "PGID")
LOCATION=$(bashio::config 'data_location') LOCATION=$(bashio::config 'data_location')
if [[ "$LOCATION" = "null" || -z "$LOCATION" ]]; then if [[ "$LOCATION" = "null" || -z "$LOCATION" ]]; then
# Default location # Default location
LOCATION="/share/webtop_kde" LOCATION="/share/webtop_kde"
else else
bashio::log.warning "Warning : a custom data location was selected, but the previous folder will NOT be copied. You need to do it manually" bashio::log.warning "Warning : a custom data location was selected, but the previous folder will NOT be copied. You need to do it manually"
# Check if config is located in an acceptable location # Check if config is located in an acceptable location
LOCATIONOK="" LOCATIONOK=""

View File

@@ -4,8 +4,8 @@
# Add Edge repositories # Add Edge repositories
if bashio::config.true 'edge_repositories'; then if bashio::config.true 'edge_repositories'; then
bashio::log.info "Changing app repositories to edge" bashio::log.info "Changing app repositories to edge"
{ echo "https://dl-cdn.alpinelinux.org/alpine/edge/community"; { echo "https://dl-cdn.alpinelinux.org/alpine/edge/community";
echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing"; echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing";
echo "https://dl-cdn.alpinelinux.org/alpine/edge/main"; } > /etc/apk/repositories echo "https://dl-cdn.alpinelinux.org/alpine/edge/main"; } > /etc/apk/repositories
fi fi

View File

@@ -18,12 +18,12 @@ bashio::log.info "Defining database"
export DB_TYPE=$(bashio::config 'DB_TYPE') export DB_TYPE=$(bashio::config 'DB_TYPE')
case $(bashio::config 'DB_TYPE') in case $(bashio::config 'DB_TYPE') in
# Use sqlite # Use sqlite
sqlite) sqlite)
bashio::log.info "Using a local sqlite database $WEBTREES_HOME/$DB_NAME please wait then login. Default credentials : $WT_USER : $WT_PASS" bashio::log.info "Using a local sqlite database $WEBTREES_HOME/$DB_NAME please wait then login. Default credentials : $WT_USER : $WT_PASS"
;; ;;
mariadb_addon) mariadb_addon)
bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Discovering values..." bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Discovering values..."
if ! bashio::services.available 'mysql'; then if ! bashio::services.available 'mysql'; then
bashio::log.fatal \ bashio::log.fatal \
@@ -45,7 +45,7 @@ mariadb_addon)
bashio::log.warning "Uninstalling the MariaDB addon will remove any data" bashio::log.warning "Uninstalling the MariaDB addon will remove any data"
;; ;;
external) external)
bashio::log.info "Using an external database, please populate all required fields in the config.yaml according to dovumentation" bashio::log.info "Using an external database, please populate all required fields in the config.yaml according to dovumentation"
;; ;;

View File

@@ -9,8 +9,8 @@
CONFIGSOURCE="/config/addons_config/zoneminder" CONFIGSOURCE="/config/addons_config/zoneminder"
if [ ! -f "$CONFIGSOURCE"/zm.conf ]; then if [ ! -f "$CONFIGSOURCE"/zm.conf ]; then
# Copy conf files # Copy conf files
cp /etc/zm/zm.conf "$CONFIGSOURCE" cp /etc/zm/zm.conf "$CONFIGSOURCE"
fi fi
################### ###################
@@ -20,8 +20,8 @@ fi
bashio::log.info "Defining database" bashio::log.info "Defining database"
case "$(bashio::config "DB_CONNECTION")" in case "$(bashio::config "DB_CONNECTION")" in
# Use MariaDB # Use MariaDB
mariadb_addon) mariadb_addon)
bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Detecting values..." bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Detecting values..."
if ! bashio::services.available 'mysql'; then if ! bashio::services.available 'mysql'; then
bashio::log.fatal \ bashio::log.fatal \
@@ -56,8 +56,8 @@ mariadb_addon)
-e "CREATE DATABASE IF NOT EXISTS \`firefly\` ;" -e "CREATE DATABASE IF NOT EXISTS \`firefly\` ;"
;; ;;
# Use remote # Use remote
external) external)
bashio::log.info "Using remote database. Requirement : filling all addon options fields, and making sure the database already exists" bashio::log.info "Using remote database. Requirement : filling all addon options fields, and making sure the database already exists"
for conditions in "ZM_DB_HOST" "ZM_DB_PORT" "ZM_DB_NAME" "ZM_DB_USER" "ZM_DB_PASS"; do for conditions in "ZM_DB_HOST" "ZM_DB_PORT" "ZM_DB_NAME" "ZM_DB_USER" "ZM_DB_PASS"; do
if ! bashio::config.has_value "$conditions"; then if ! bashio::config.has_value "$conditions"; then
@@ -67,8 +67,8 @@ external)
;; ;;
# Use remote # Use remote
*) *)
bashio::log.info "Using internal database" bashio::log.info "Using internal database"
;; ;;