change to s6
This commit is contained in:
58
root/container-init.sh
Normal file
58
root/container-init.sh
Normal file
@ -0,0 +1,58 @@
|
||||
#!/command/with-contenv bash
|
||||
# shellcheck shell=bash
|
||||
|
||||
echo ""
|
||||
echo ""
|
||||
echo "================================================"
|
||||
echo "| __ _______ __ ___________________ |"
|
||||
echo "| / |/ / __ \/ |/ / ____/ ____/ __ ) |"
|
||||
echo "| / /|_/ / /_/ / /|_/ / __/ / __/ / __ | |"
|
||||
echo "| / / / / _, _/ / / / /___/ /___/ /_/ / |"
|
||||
echo "| /_/ /_/_/ |_/_/ /_/_____/_____/_____/ |"
|
||||
echo "| |"
|
||||
echo "================================================"
|
||||
echo ""
|
||||
echo "Initialising container"
|
||||
echo "
|
||||
----------------------------------------------------------------------
|
||||
ENVIRONMENT
|
||||
----------------------------------------------------------------------
|
||||
PUID=${PUID}
|
||||
PGID=${PGID}
|
||||
TZ=${TZ}
|
||||
DOMAINS=${DOMAINS}
|
||||
EMAIL=${EMAIL}
|
||||
INTERVAL=${INTERVAL}
|
||||
STAGING=${STAGING}
|
||||
PROPOGATION_TIME=${PROPOGATION_TIME}
|
||||
GENERATE_DHPARAM=${GENERATE_DHPARAM}
|
||||
----------------------------------------------------------------------
|
||||
"
|
||||
|
||||
#Setting UID and GID as configured
|
||||
if [[ ! "${PUID}" -eq 0 ]] && [[ ! "${PGID}" -eq 0 ]]; then
|
||||
echo "Executing usermod..."
|
||||
mkdir "/tmp/temphome"
|
||||
usermod -d "/tmp/temphome" mrmeeb
|
||||
usermod -o -u "${PUID}" mrmeeb
|
||||
usermod -d /config mrmeeb
|
||||
rm -rf "/tmp/temphome"
|
||||
groupmod -o -g "${PGID}" mrmeeb
|
||||
else
|
||||
echo "Running as root is not supported, please fix your PUID and PGID!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Checking permissions in /config and /app."
|
||||
|
||||
if [ ! "$(stat -c %u /app)" -eq "${PUID}" ] || [ ! "$(stat -c %g /app)" -eq "${PGID}" ]
|
||||
then
|
||||
echo "Fixing permissions for /app (this can take some time)."
|
||||
chown -R mrmeeb:mrmeeb /app
|
||||
fi
|
||||
|
||||
if [ ! "$(stat -c %u /config)" -eq "${PUID}" ] || [ ! "$(stat -c %g /config)" -eq "${PGID}" ]
|
||||
then
|
||||
echo "Fixing permissions for /config (this can take some time)."
|
||||
chown -R mrmeeb:mrmeeb /config
|
||||
fi
|
||||
Reference in New Issue
Block a user