Revert "chmod +x scripts"

This reverts commit 3351e5b29c.
This commit is contained in:
Alexandre
2022-06-15 21:03:13 +02:00
parent 27bb72ef76
commit 42bef66f08
218 changed files with 9448 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
#!/bin/bash
echo "Starting..."
############################
# Backup Dockerfile Script #
############################
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
fi
####################
# Starting scripts #
####################
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 $?"
done

View File

@@ -0,0 +1,50 @@
#!/bin/bash
# If dockerfile failed install manually
##############################
# Automatic modules download #
##############################
if [ -e "/MODULESFILE" ]; then
MODULES=$(</MODULESFILE)
MODULES="${MODULES:-00-banner.sh}"
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 \
&& apt-get update && apt-get install -yqq --no-install-recommends ca-certificates || apk add --no-cache ca-certificates >/dev/null || true \
&& 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
#######################
# Automatic installer #
#######################
if [ -e "/ENVFILE" ]; then
PACKAGES=$(</ENVFILE)
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
fi
if [ -e "/MODULESFILE" ] && [ ! -f /entrypoint.sh ]; then
for scripts in $MODULES; do
echo "$scripts : executing"
chown "$(id -u)":"$(id -g)" /etc/cont-init.d/"$scripts"
chmod a+x /etc/cont-init.d/"$scripts"
/./etc/cont-init.d/"$scripts" || echo "/etc/cont-init.d/$scripts: exiting $?"
rm /etc/cont-init.d/"$scripts"
done | tac
fi
#######################
# Correct permissions #
#######################
[ -d /etc/services.d ] && chmod -R 777 /etc/services.d
[ -d /etc/cont-init.d ] && chmod -R 777 /etc/cont-init.d

View File

@@ -0,0 +1,16 @@
#!/usr/bin/with-contenv bashio
# 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
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
fi

View File

@@ -0,0 +1,99 @@
#!/usr/bin/env bashio
# shellcheck shell=bash
############
# TIMEZONE #
############
if bashio::config.has_value 'TZ'; then
TIMEZONE=$(bashio::config 'TZ')
bashio::log.info "Setting timezone to $TIMEZONE"
if [ -f /usr/share/zoneinfo/"$TIMEZONE" ]; then
ln -snf /usr/share/zoneinfo/"$TIMEZONE" /etc/localtime
echo "$TIMEZONE" >/etc/timezone
else
bashio::log.fatal "$TIMEZONE not found, are you sure it is a valid timezone?"
fi
fi
###################
# SSL CONFIG v1.0 #
###################
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')"
else
CERTFILE=""
KEYFILE=""
fi
#################
# NGINX SETTING #
#################
#declare port
#declare certfile
declare ingress_interface
declare ingress_port
#declare keyfile
FB_BASEURL=$(bashio::addon.ingress_entry)
export FB_BASEURL
declare ADDON_PROTOCOL=http
# Generate Ingress configuration
if bashio::config.true 'ssl'; then
ADDON_PROTOCOL=https
fi
#port=$(bashio::addon.port 80)
ingress_port=$(bashio::addon.ingress_port)
ingress_interface=$(bashio::addon.ip_address)
sed -i "s|%%protocol%%|${ADDON_PROTOCOL}|g" /etc/nginx/servers/ingress.conf
sed -i "s|%%port%%|${ingress_port}|g" /etc/nginx/servers/ingress.conf
sed -i "s|%%interface%%|${ingress_interface}|g" /etc/nginx/servers/ingress.conf
sed -i "s|%%subpath%%|${FB_BASEURL}/|g" /etc/nginx/servers/ingress.conf
mkdir -p /var/log/nginx && touch /var/log/nginx/error.log
######################
# LAUNCH FILEBROWSER #
######################
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"
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"
fi
if bashio::config.has_value 'base_folder'; then
BASE_FOLDER=$(bashio::config 'base_folder')
else
BASE_FOLDER=/
fi
bashio::log.info "Starting..."
# shellcheck disable=SC2086
/./filebrowser $CERTFILE $KEYFILE --root="$BASE_FOLDER" --address=0.0.0.0 --database=/config/addons_config/filebrowser/filebrowser.dB "$NOAUTH" &
bashio::net.wait_for 8080 localhost 900 || true
bashio::log.info "Started !"
exec nginx