mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-10 09:51:02 +01:00
fix: auto-fix linting issues
This commit is contained in:
committed by
github-actions[bot]
parent
e5adbd266f
commit
f728166b14
@@ -17,20 +17,20 @@ JSONSOURCE="/data/options.json"
|
||||
mapfile -t arr < <(jq -r 'keys[]' "${JSONSOURCE}")
|
||||
|
||||
for KEYS in "${arr[@]}"; do
|
||||
# export key
|
||||
VALUE=$(jq ."$KEYS" "${JSONSOURCE}")
|
||||
line="${KEYS}='${VALUE//[\"\']/}'"
|
||||
# text
|
||||
if bashio::config.false "verbose" || [[ "${KEYS}" == *"PASS"* ]]; then
|
||||
bashio::log.blue "${KEYS}=******"
|
||||
else
|
||||
bashio::log.blue "$line"
|
||||
fi
|
||||
# Use locally
|
||||
export "${KEYS}=${VALUE//[\"\']/}"
|
||||
# Export the variable to run scripts
|
||||
sed -i "1a export $line" /home/seafile/*.sh 2>/dev/null
|
||||
find /opt/seafile -name '*.sh' -print0 | xargs -0 sed -i "1a export $line"
|
||||
# export key
|
||||
VALUE=$(jq ."$KEYS" "${JSONSOURCE}")
|
||||
line="${KEYS}='${VALUE//[\"\']/}'"
|
||||
# text
|
||||
if bashio::config.false "verbose" || [[ "${KEYS}" == *"PASS"* ]]; then
|
||||
bashio::log.blue "${KEYS}=******"
|
||||
else
|
||||
bashio::log.blue "$line"
|
||||
fi
|
||||
# Use locally
|
||||
export "${KEYS}=${VALUE//[\"\']/}"
|
||||
# Export the variable to run scripts
|
||||
sed -i "1a export $line" /home/seafile/*.sh 2>/dev/null
|
||||
find /opt/seafile -name '*.sh' -print0 | xargs -0 sed -i "1a export $line"
|
||||
done
|
||||
|
||||
#################
|
||||
@@ -73,43 +73,43 @@ bashio::log.info "Defining database"
|
||||
|
||||
case $(bashio::config 'database') in
|
||||
|
||||
# Use sqlite
|
||||
sqlite)
|
||||
export "SQLITE=1" && sed -i "1a export SQLITE=1" /home/seafile/*.sh
|
||||
;;
|
||||
# Use sqlite
|
||||
sqlite)
|
||||
export "SQLITE=1" && sed -i "1a export SQLITE=1" /home/seafile/*.sh
|
||||
;;
|
||||
|
||||
# Use mariadb
|
||||
mariadb_addon)
|
||||
bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Discovering values..."
|
||||
if ! bashio::services.available 'mysql'; then
|
||||
bashio::log.fatal \
|
||||
"Local database access should be provided by the MariaDB addon"
|
||||
bashio::exit.nok \
|
||||
"Please ensure it is installed and started"
|
||||
fi
|
||||
# Use mariadb
|
||||
mariadb_addon)
|
||||
bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Discovering values..."
|
||||
if ! bashio::services.available 'mysql'; then
|
||||
bashio::log.fatal \
|
||||
"Local database access should be provided by the MariaDB addon"
|
||||
bashio::exit.nok \
|
||||
"Please ensure it is installed and started"
|
||||
fi
|
||||
|
||||
# Use values
|
||||
export MYSQL_HOST="$(bashio::services 'mysql' 'host')" && sed -i "1a export MYSQL_HOST=$(bashio::services 'mysql' 'host')" /home/seafile/*.sh
|
||||
export MYSQL_PORT="$(bashio::services 'mysql' 'port')" && sed -i "1a export MYSQL_PORT=$(bashio::services 'mysql' 'port')" /home/seafile/*.sh
|
||||
export MYSQL_USER="$(bashio::services "mysql" "username")" && sed -i "1a export MYSQL_USER=$(bashio::services 'mysql' 'username')" /home/seafile/*.sh
|
||||
export MYSQL_USER_PASSWD="$(bashio::services "mysql" "password")" && sed -i "1a export MYSQL_USER_PASSWD=$(bashio::services 'mysql' 'password')" /home/seafile/*.sh
|
||||
export MYSQL_ROOT_PASSWD="$(bashio::services "mysql" "password")" && sed -i "1a export MYSQL_ROOT_PASSWD=$(bashio::services 'mysql' 'password')" /home/seafile/*.sh
|
||||
# Use values
|
||||
export MYSQL_HOST="$(bashio::services 'mysql' 'host')" && sed -i "1a export MYSQL_HOST=$(bashio::services 'mysql' 'host')" /home/seafile/*.sh
|
||||
export MYSQL_PORT="$(bashio::services 'mysql' 'port')" && sed -i "1a export MYSQL_PORT=$(bashio::services 'mysql' 'port')" /home/seafile/*.sh
|
||||
export MYSQL_USER="$(bashio::services "mysql" "username")" && sed -i "1a export MYSQL_USER=$(bashio::services 'mysql' 'username')" /home/seafile/*.sh
|
||||
export MYSQL_USER_PASSWD="$(bashio::services "mysql" "password")" && sed -i "1a export MYSQL_USER_PASSWD=$(bashio::services 'mysql' 'password')" /home/seafile/*.sh
|
||||
export MYSQL_ROOT_PASSWD="$(bashio::services "mysql" "password")" && sed -i "1a export MYSQL_ROOT_PASSWD=$(bashio::services 'mysql' 'password')" /home/seafile/*.sh
|
||||
|
||||
# Mariadb requires a user
|
||||
echo "Adapting scripts"
|
||||
sed -i 's|port=${MYSQL_PORT})|port=${MYSQL_PORT}, user="${MYSQL_USER}")|g' /home/seafile/wait_for_db.sh
|
||||
# Mariadb requires a user
|
||||
echo "Adapting scripts"
|
||||
sed -i 's|port=${MYSQL_PORT})|port=${MYSQL_PORT}, user="${MYSQL_USER}")|g' /home/seafile/wait_for_db.sh
|
||||
|
||||
# Mariadb has no root user
|
||||
echo "Adapting root name"
|
||||
sed -i 's|user="root"|user="service"|g' /home/seafile/clean_db.sh
|
||||
sed -i "s|'root'|'service'|g" /opt/seafile/*/setup-seafile-mysql.sh
|
||||
sed -i "s|'root'|'service'|g" /opt/seafile/*/setup-seafile-mysql.py
|
||||
# Mariadb has no root user
|
||||
echo "Adapting root name"
|
||||
sed -i 's|user="root"|user="service"|g' /home/seafile/clean_db.sh
|
||||
sed -i "s|'root'|'service'|g" /opt/seafile/*/setup-seafile-mysql.sh
|
||||
sed -i "s|'root'|'service'|g" /opt/seafile/*/setup-seafile-mysql.py
|
||||
|
||||
# Informations
|
||||
bashio::log.warning "This addon is using the Maria DB addon"
|
||||
bashio::log.warning "Please ensure this is included in your backups"
|
||||
bashio::log.warning "Uninstalling the MariaDB addon will remove any data"
|
||||
;;
|
||||
# Informations
|
||||
bashio::log.warning "This addon is using the Maria DB addon"
|
||||
bashio::log.warning "Please ensure this is included in your backups"
|
||||
bashio::log.warning "Uninstalling the MariaDB addon will remove any data"
|
||||
;;
|
||||
esac
|
||||
|
||||
##############
|
||||
|
||||
Reference in New Issue
Block a user