diff --git a/root/etc/s6-overlay/s6-rc.d/init-adduser/run b/root/etc/s6-overlay/s6-rc.d/init-adduser/run index d873b6c..a03a3e9 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-adduser/run +++ b/root/etc/s6-overlay/s6-rc.d/init-adduser/run @@ -1,32 +1,32 @@ -#!/usr/bin/with-contenv bash -# shellcheck shell=bash - -PUID=${PUID:-911} -PGID=${PGID:-911} - -groupmod -o -g "$PGID" abc -usermod -o -u "$PUID" abc - -cat /etc/s6-overlay/s6-rc.d/init-adduser/branding - -if [[ -f /donate.txt ]]; then - echo ' -To support the app dev(s) visit:' - cat /donate.txt -fi -echo ' -To support LSIO projects visit: -https://www.linuxserver.io/donate/ - -─────────────────────────────────────── -GID/UID -───────────────────────────────────────' -echo " -User UID: $(id -u abc) -User GID: $(id -g abc) -─────────────────────────────────────── -" - -lsiown abc:abc /app -lsiown abc:abc /config -lsiown abc:abc /defaults +#!/usr/bin/with-contenv bash +# shellcheck shell=bash + +PUID=${PUID:-911} +PGID=${PGID:-911} + +groupmod -o -g "$PGID" abc +usermod -o -u "$PUID" abc + +cat /etc/s6-overlay/s6-rc.d/init-adduser/branding + +if [[ -f /donate.txt ]]; then + echo ' +To support the app dev(s) visit:' + cat /donate.txt +fi +echo ' +To support LSIO projects visit: +https://www.linuxserver.io/donate/ + +─────────────────────────────────────── +GID/UID +───────────────────────────────────────' +echo " +User UID: $(id -u abc) +User GID: $(id -g abc) +─────────────────────────────────────── +" + +lsiown abc:abc /app +lsiown abc:abc /config +lsiown abc:abc /defaults diff --git a/root/etc/s6-overlay/s6-rc.d/init-custom-files/run b/root/etc/s6-overlay/s6-rc.d/init-custom-files/run index dcdf5a4..3d8a17e 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-custom-files/run +++ b/root/etc/s6-overlay/s6-rc.d/init-custom-files/run @@ -1,22 +1,22 @@ -#!/usr/bin/with-contenv bash -# shellcheck shell=bash - -# Directories -SCRIPTS_DIR="/custom-cont-init.d" - -# Make sure custom init directory exists and has files in it -if [[ -e "${SCRIPTS_DIR}" ]] && [[ -n "$(/bin/ls -A ${SCRIPTS_DIR} 2>/dev/null)" ]]; then - echo "[custom-init] Files found, executing" - for SCRIPT in "${SCRIPTS_DIR}"/*; do - NAME="$(basename "${SCRIPT}")" - if [[ -f "${SCRIPT}" ]]; then - echo "[custom-init] ${NAME}: executing..." - /bin/bash "${SCRIPT}" - echo "[custom-init] ${NAME}: exited $?" - elif [[ ! -f "${SCRIPT}" ]]; then - echo "[custom-init] ${NAME}: is not a file" - fi - done -else - echo "[custom-init] No custom files found, skipping..." -fi +#!/usr/bin/with-contenv bash +# shellcheck shell=bash + +# Directories +SCRIPTS_DIR="/custom-cont-init.d" + +# Make sure custom init directory exists and has files in it +if [[ -e "${SCRIPTS_DIR}" ]] && [[ -n "$(/bin/ls -A ${SCRIPTS_DIR} 2>/dev/null)" ]]; then + echo "[custom-init] Files found, executing" + for SCRIPT in "${SCRIPTS_DIR}"/*; do + NAME="$(basename "${SCRIPT}")" + if [[ -f "${SCRIPT}" ]]; then + echo "[custom-init] ${NAME}: executing..." + /bin/bash "${SCRIPT}" + echo "[custom-init] ${NAME}: exited $?" + elif [[ ! -f "${SCRIPT}" ]]; then + echo "[custom-init] ${NAME}: is not a file" + fi + done +else + echo "[custom-init] No custom files found, skipping..." +fi diff --git a/root/etc/s6-overlay/s6-rc.d/init-envfile/run b/root/etc/s6-overlay/s6-rc.d/init-envfile/run index 608d352..5dbf809 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-envfile/run +++ b/root/etc/s6-overlay/s6-rc.d/init-envfile/run @@ -1,17 +1,17 @@ -#!/usr/bin/with-contenv bash -# shellcheck shell=bash - -if find /run/s6/container_environment/*"FILE__"* -maxdepth 1 > /dev/null 2>&1; then - for FILENAME in /run/s6/container_environment/*; do - if [[ "${FILENAME##*/}" == "FILE__"* ]]; then - SECRETFILE=$(cat "${FILENAME}") - if [[ -f ${SECRETFILE} ]]; then - FILESTRIP=${FILENAME//FILE__/} - cat "${SECRETFILE}" >"${FILESTRIP}" - echo "[env-init] ${FILESTRIP##*/} set from ${FILENAME##*/}" - else - echo "[env-init] cannot find secret in ${FILENAME##*/}" - fi - fi - done -fi +#!/usr/bin/with-contenv bash +# shellcheck shell=bash + +if find /run/s6/container_environment/*"FILE__"* -maxdepth 1 > /dev/null 2>&1; then + for FILENAME in /run/s6/container_environment/*; do + if [[ "${FILENAME##*/}" == "FILE__"* ]]; then + SECRETFILE=$(cat "${FILENAME}") + if [[ -f ${SECRETFILE} ]]; then + FILESTRIP=${FILENAME//FILE__/} + cat "${SECRETFILE}" >"${FILESTRIP}" + echo "[env-init] ${FILESTRIP##*/} set from ${FILENAME##*/}" + else + echo "[env-init] cannot find secret in ${FILENAME##*/}" + fi + fi + done +fi diff --git a/root/etc/s6-overlay/s6-rc.d/init-migrations/run b/root/etc/s6-overlay/s6-rc.d/init-migrations/run index 850b6f2..37f5b78 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-migrations/run +++ b/root/etc/s6-overlay/s6-rc.d/init-migrations/run @@ -1,33 +1,33 @@ -#!/usr/bin/with-contenv bash -# shellcheck shell=bash - -MIGRATIONS_DIR="/migrations" -MIGRATIONS_HISTORY="/config/.migrations" - -echo "[migrations] started" - -if [[ ! -d ${MIGRATIONS_DIR} ]]; then - echo "[migrations] no migrations found" - exit -fi - -for MIGRATION in $(find ${MIGRATIONS_DIR}/* | sort -n); do - NAME="$(basename "${MIGRATION}")" - if [[ -f ${MIGRATIONS_HISTORY} ]] && grep -Fxq "${NAME}" ${MIGRATIONS_HISTORY}; then - echo "[migrations] ${NAME}: skipped" - continue - fi - echo "[migrations] ${NAME}: executing..." - chmod +x "${MIGRATION}" - # Execute migration script in a subshell to prevent it from modifying the current environment - ("${MIGRATION}") - EXIT_CODE=$? - if [[ ${EXIT_CODE} -ne 0 ]]; then - echo "[migrations] ${NAME}: failed with exit code ${EXIT_CODE}, contact support" - exit "${EXIT_CODE}" - fi - echo "${NAME}" >>${MIGRATIONS_HISTORY} - echo "[migrations] ${NAME}: succeeded" -done - -echo "[migrations] done" +#!/usr/bin/with-contenv bash +# shellcheck shell=bash + +MIGRATIONS_DIR="/migrations" +MIGRATIONS_HISTORY="/config/.migrations" + +echo "[migrations] started" + +if [[ ! -d ${MIGRATIONS_DIR} ]]; then + echo "[migrations] no migrations found" + exit +fi + +for MIGRATION in $(find ${MIGRATIONS_DIR}/* | sort -n); do + NAME="$(basename "${MIGRATION}")" + if [[ -f ${MIGRATIONS_HISTORY} ]] && grep -Fxq "${NAME}" ${MIGRATIONS_HISTORY}; then + echo "[migrations] ${NAME}: skipped" + continue + fi + echo "[migrations] ${NAME}: executing..." + chmod +x "${MIGRATION}" + # Execute migration script in a subshell to prevent it from modifying the current environment + ("${MIGRATION}") + EXIT_CODE=$? + if [[ ${EXIT_CODE} -ne 0 ]]; then + echo "[migrations] ${NAME}: failed with exit code ${EXIT_CODE}, contact support" + exit "${EXIT_CODE}" + fi + echo "${NAME}" >>${MIGRATIONS_HISTORY} + echo "[migrations] ${NAME}: succeeded" +done + +echo "[migrations] done"