mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-05-28 03:14:04 +02:00
chmod +x scripts
This commit is contained in:
@@ -1,50 +0,0 @@
|
||||
#!/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
|
||||
@@ -1,47 +0,0 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
|
||||
# Define user
|
||||
PUID=$(bashio::config "PUID")
|
||||
PGID=$(bashio::config "PGID")
|
||||
|
||||
# Check data location
|
||||
LOCATION=$(bashio::config 'data_location')
|
||||
|
||||
if [[ "$LOCATION" = "null" || -z "$LOCATION" ]]; then
|
||||
# Default location
|
||||
LOCATION="/config/addons_config/calibre-web"
|
||||
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"
|
||||
|
||||
# Check if config is located in an acceptable location
|
||||
LOCATIONOK=""
|
||||
for location in "/share" "/config" "/data" "/mnt"; do
|
||||
if [[ "$LOCATION" == "$location"* ]]; then
|
||||
LOCATIONOK=true
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "$LOCATIONOK" ]; then
|
||||
LOCATION=/config/addons_config/${HOSTNAME#*-}
|
||||
bashio::log.fatal "Your data_location value can only be set in /share, /config or /data (internal to addon). It will be reset to the default location : $LOCATION"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# Set data location
|
||||
bashio::log.info "Setting data location to $LOCATION"
|
||||
sed -i "1a export HOME=$LOCATION" /etc/services.d/*/run
|
||||
sed -i "1a export FM_HOME=$LOCATION" /etc/services.d/*/run
|
||||
sed -i "s|/config/addons_config/calibre-web|$LOCATION|g" /defaults/*
|
||||
sed -i "s|/config/addons_config/calibre-web|$LOCATION|g" /etc/cont-init.d/*
|
||||
sed -i "s|/config/addons_config/calibre-web|$LOCATION|g" /etc/services.d/*/run
|
||||
usermod --home "$LOCATION" abc
|
||||
|
||||
# Create folder
|
||||
echo "Creating $LOCATION"
|
||||
mkdir -p "$LOCATION"
|
||||
|
||||
# Set ownership
|
||||
bashio::log.info "Setting ownership to $PUID:$PGID"
|
||||
chown "$PUID":"$PGID" "$LOCATION"
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ ! -d /config/addons_config/calibre-web ]; then
|
||||
echo "Creating /config/addons_config/calibre-web"
|
||||
mkdir -p /config/addons_config/calibre-web
|
||||
fi
|
||||
|
||||
chown -R abc:abc /config/addons_config/calibre-web
|
||||
@@ -1,55 +0,0 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
|
||||
#################
|
||||
# NGINX SETTING #
|
||||
#################
|
||||
#declare port
|
||||
#declare certfile
|
||||
declare ingress_user
|
||||
declare ingress_interface
|
||||
declare ingress_port
|
||||
#declare keyfile
|
||||
|
||||
#port=$(bashio::addon.port 80)
|
||||
#if bashio::var.has_value "${port}"; then
|
||||
# bashio::config.require.ssl
|
||||
#
|
||||
# if bashio::config.true 'ssl'; then
|
||||
# certfile=$(bashio::config 'certfile')
|
||||
# keyfile=$(bashio::config 'keyfile')
|
||||
#
|
||||
# mv /etc/nginx/servers/direct-ssl.disabled /etc/nginx/servers/direct.conf
|
||||
# sed -i "s/%%certfile%%/${certfile}/g" /etc/nginx/servers/direct.conf
|
||||
# sed -i "s/%%keyfile%%/${keyfile}/g" /etc/nginx/servers/direct.conf
|
||||
#
|
||||
# else
|
||||
# mv /etc/nginx/servers/direct.disabled /etc/nginx/servers/direct.conf
|
||||
# fi
|
||||
#fi
|
||||
|
||||
## Force scheme
|
||||
#if bashio::config.true 'force_scheme_https'; then
|
||||
# # shellcheck disable=SC2016
|
||||
# sed -i 's|$scheme|https|g' /etc/nginx/servers/ingress.conf
|
||||
#fi
|
||||
|
||||
## Force external port
|
||||
#if bashio::config.has_value 'force_external_port'; then
|
||||
# sed -i "s|%%haport%%|$(bashio::config 'force_external_port')|g" /etc/nginx/servers/ingress.conf
|
||||
#fi
|
||||
|
||||
ingress_user='admin'
|
||||
if bashio::config.has_value 'ingress_user'; then
|
||||
ingress_user=$(bashio::config 'ingress_user')
|
||||
fi
|
||||
|
||||
ingress_port=$(bashio::addon.ingress_port)
|
||||
ingress_interface=$(bashio::addon.ip_address)
|
||||
#ha_port=$(bashio::core.port)
|
||||
|
||||
sed -i "s/%%ingress_user%%/${ingress_user}/g" /etc/nginx/servers/ingress.conf
|
||||
sed -i "s/%%port%%/${ingress_port}/g" /etc/nginx/servers/ingress.conf
|
||||
#sed -i "s/%%haport%%/${ha_port}/g" /etc/nginx/servers/ingress.conf
|
||||
sed -i "s/%%interface%%/${ingress_interface}/g" /etc/nginx/servers/ingress.conf
|
||||
sed -i "s|%%UIPATH%%|$(bashio::addon.ingress_entry)|g" /etc/nginx/servers/ingress.conf
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
# shellcheck disable=SC2015
|
||||
|
||||
# Set TZ
|
||||
if bashio::config.has_value 'TZ'; then
|
||||
TIMEZONE=$(bashio::config 'TZ')
|
||||
bashio::log.info "Setting timezone to $TIMEZONE"
|
||||
ln -snf /usr/share/zoneinfo/"$TIMEZONE" /etc/localtime && echo "$TIMEZONE" >/etc/timezone
|
||||
fi
|
||||
|
||||
# Set Ingress login
|
||||
sqlite3 /config/addons_config/calibre-web/app.db 'update settings set config_reverse_proxy_login_header_name="X-WebAuth-User",config_allow_reverse_proxy_header_login=1'
|
||||
|
||||
bashio::log.info "Default username:password is admin:admin123"
|
||||
Reference in New Issue
Block a user