Files
tvapp2/root/etc/s6-overlay/s6-rc.d/init-custom-files/run
2024-11-30 15:14:13 -07:00

23 lines
781 B
Plaintext

#!/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 -e " Loader : Custom files found, loading them ..."
for SCRIPT in "${SCRIPTS_DIR}"/*; do
NAME="$(basename "${SCRIPT}")"
if [[ -f "${SCRIPT}" ]]; then
echo -e " Loader : Executing ..."
/bin/bash "${SCRIPT}"
echo -e " Loader : ${NAME}: Exited $?"
elif [[ ! -f "${SCRIPT}" ]]; then
echo -e " Loader : ${NAME}: Not a valid file"
fi
done
else
echo -e " Loader : No custom files found, skipping..."
fi