mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-24 21:46:29 +01:00
Beautify bash
This commit is contained in:
@@ -6,10 +6,10 @@ echo "Starting..."
|
||||
############################
|
||||
|
||||
if [ -f /etc/cont-init.d/00-aaa_dockerfile_backup.sh ]; then
|
||||
chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh
|
||||
chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh
|
||||
/./etc/cont-init.d/00-aaa_dockerfile_backup.sh
|
||||
rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh
|
||||
chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh
|
||||
chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh
|
||||
/./etc/cont-init.d/00-aaa_dockerfile_backup.sh
|
||||
rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh
|
||||
fi
|
||||
|
||||
####################
|
||||
@@ -17,11 +17,11 @@ fi
|
||||
####################
|
||||
|
||||
for SCRIPTS in /etc/cont-init.d/*; do
|
||||
[ -e "$SCRIPTS" ] || continue
|
||||
echo "$SCRIPTS: executing"
|
||||
chown "$(id -u)":"$(id -g)" "$SCRIPTS"
|
||||
chmod a+x "$SCRIPTS"
|
||||
# Change shebang if no s6 supervision
|
||||
sed -i 's|/usr/bin/with-contenv bashio|/usr/bin/env bashio|g' "$SCRIPTS"
|
||||
/."$SCRIPTS" || echo "$SCRIPTS: exiting $?"
|
||||
[ -e "$SCRIPTS" ] || continue
|
||||
echo "$SCRIPTS: executing"
|
||||
chown "$(id -u)":"$(id -g)" "$SCRIPTS"
|
||||
chmod a+x "$SCRIPTS"
|
||||
# Change shebang if no s6 supervision
|
||||
sed -i 's|/usr/bin/with-contenv bashio|/usr/bin/env bashio|g' "$SCRIPTS"
|
||||
/."$SCRIPTS" || echo "$SCRIPTS: exiting $?"
|
||||
done
|
||||
|
||||
@@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then
|
||||
echo "Executing modules script : $MODULES"
|
||||
|
||||
if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \
|
||||
&& if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \
|
||||
&& mkdir -p /etc/cont-init.d \
|
||||
&& for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \
|
||||
&& chmod -R 755 /etc/cont-init.d
|
||||
&& if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \
|
||||
&& mkdir -p /etc/cont-init.d \
|
||||
&& for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \
|
||||
&& chmod -R 755 /etc/cont-init.d
|
||||
fi
|
||||
|
||||
#######################
|
||||
@@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then
|
||||
echo "Executing dependency script with custom elements : $PACKAGES"
|
||||
|
||||
if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \
|
||||
&& if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \
|
||||
&& curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \
|
||||
&& chmod 777 /automatic_packages.sh \
|
||||
&& eval /./automatic_packages.sh "${PACKAGES:-}" \
|
||||
&& rm /automatic_packages.sh
|
||||
&& if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \
|
||||
&& curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \
|
||||
&& chmod 777 /automatic_packages.sh \
|
||||
&& eval /./automatic_packages.sh "${PACKAGES:-}" \
|
||||
&& rm /automatic_packages.sh
|
||||
fi
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
# shellcheck shell=bash
|
||||
|
||||
if [ -d /config/filebrowser ]; then
|
||||
echo "Moving to new location /config/addons_config/filebrowser"
|
||||
mkdir -p /config/addons_config/filebrowser
|
||||
chmod 777 /config/addons_config/filebrowser
|
||||
mv /config/filebrowser/* /config/addons_config/filebrowser/
|
||||
rm -r /config/filebrowser
|
||||
echo "Moving to new location /config/addons_config/filebrowser"
|
||||
mkdir -p /config/addons_config/filebrowser
|
||||
chmod 777 /config/addons_config/filebrowser
|
||||
mv /config/filebrowser/* /config/addons_config/filebrowser/
|
||||
rm -r /config/filebrowser
|
||||
fi
|
||||
|
||||
if [ ! -d /config/addons_config/filebrowser ]; then
|
||||
echo "Creating /config/addons_config/filebrowser"
|
||||
mkdir -p /config/addons_config/filebrowser
|
||||
chmod 777 /config/addons_config/filebrowser
|
||||
echo "Creating /config/addons_config/filebrowser"
|
||||
mkdir -p /config/addons_config/filebrowser
|
||||
chmod 777 /config/addons_config/filebrowser
|
||||
fi
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
|
||||
bashio::config.require.ssl
|
||||
if bashio::config.true 'ssl'; then
|
||||
bashio::log.info "ssl enabled. If webui don't work, disable ssl or check your certificate paths"
|
||||
#set variables
|
||||
CERTFILE="-t /ssl/$(bashio::config 'certfile')"
|
||||
KEYFILE="-k /ssl/$(bashio::config 'keyfile')"
|
||||
bashio::log.info "ssl enabled. If webui don't work, disable ssl or check your certificate paths"
|
||||
#set variables
|
||||
CERTFILE="-t /ssl/$(bashio::config 'certfile')"
|
||||
KEYFILE="-k /ssl/$(bashio::config 'keyfile')"
|
||||
else
|
||||
CERTFILE=""
|
||||
KEYFILE=""
|
||||
CERTFILE=""
|
||||
KEYFILE=""
|
||||
fi
|
||||
|
||||
#################
|
||||
@@ -32,7 +32,7 @@ export FB_BASEURL
|
||||
declare ADDON_PROTOCOL=http
|
||||
# Generate Ingress configuration
|
||||
if bashio::config.true 'ssl'; then
|
||||
ADDON_PROTOCOL=https
|
||||
ADDON_PROTOCOL=https
|
||||
fi
|
||||
|
||||
#port=$(bashio::addon.port 80)
|
||||
@@ -51,28 +51,28 @@ mkdir -p /var/log/nginx && touch /var/log/nginx/error.log
|
||||
NOAUTH=""
|
||||
|
||||
if bashio::config.true 'NoAuth'; then
|
||||
if ! bashio::fs.file_exists "/data/noauth"; then
|
||||
rm /data/auth &>/dev/null || true
|
||||
rm /config/addons_config/filebrowser/filebrowser.dB &>/dev/null || true
|
||||
touch /data/noauth
|
||||
NOAUTH="--noauth"
|
||||
bashio::log.warning "Auth method change, database reset"
|
||||
fi
|
||||
bashio::log.info "NoAuth option selected"
|
||||
if ! bashio::fs.file_exists "/data/noauth"; then
|
||||
rm /data/auth &>/dev/null || true
|
||||
rm /config/addons_config/filebrowser/filebrowser.dB &>/dev/null || true
|
||||
touch /data/noauth
|
||||
NOAUTH="--noauth"
|
||||
bashio::log.warning "Auth method change, database reset"
|
||||
fi
|
||||
bashio::log.info "NoAuth option selected"
|
||||
else
|
||||
if ! bashio::fs.file_exists "/data/auth"; then
|
||||
rm /data/noauth &>/dev/null || true
|
||||
rm /config/addons_config/filebrowser/filebrowser.dB &>/dev/null || true
|
||||
touch /data/auth
|
||||
bashio::log.warning "Auth method change, database reset"
|
||||
fi
|
||||
bashio::log.info "Default username/password : admin/admin"
|
||||
if ! bashio::fs.file_exists "/data/auth"; then
|
||||
rm /data/noauth &>/dev/null || true
|
||||
rm /config/addons_config/filebrowser/filebrowser.dB &>/dev/null || true
|
||||
touch /data/auth
|
||||
bashio::log.warning "Auth method change, database reset"
|
||||
fi
|
||||
bashio::log.info "Default username/password : admin/admin"
|
||||
fi
|
||||
|
||||
if bashio::config.has_value 'base_folder'; then
|
||||
BASE_FOLDER=$(bashio::config 'base_folder')
|
||||
BASE_FOLDER=$(bashio::config 'base_folder')
|
||||
else
|
||||
BASE_FOLDER=/
|
||||
BASE_FOLDER=/
|
||||
fi
|
||||
|
||||
bashio::log.info "Starting..."
|
||||
|
||||
Reference in New Issue
Block a user