#!/usr/bin/with-contenv bash # Make sure custom script directory exists and has files in it SCRIPTS_DIR="/config/custom-init-scripts" if [ -e "${SCRIPTS_DIR}" ] && \ [ -n "$(/bin/ls -A ${SCRIPTS_DIR} 2>/dev/null)" ]; then echo "[custom-init] files found in ${SCRIPTS_DIR} executing" for SCRIPT in ${SCRIPTS_DIR}/*; do echo "[custom-init] ${SCRIPT}: executing..." /bin/bash ${SCRIPT} echo "[custom-init] ${SCRIPT}: exited $?" done else echo "[custom-init] no custom scripts found exiting..." fi # Make sure custom services directory exists and has files in it SERVICES_DIR="/config/custom-services.d" if [ -e "${SERVICES_DIR}" ] && \ [ -n "$(/bin/ls -A ${SERVICES_DIR} 2>/dev/null)" ]; then echo "[custom-init] service folders found in ${SERVICES_DIR} executing" for SERVICE in ${SERVICES_DIR}/*; do echo "[custom-init] ${SERVICE}: copying..." cp -r ${SERVICE} /etc/services.d/ chmod +x /etc/services.d/${SERVICE}/run echo "[custom-init] ${SERVICE}: done" done else echo "[custom-init] no custom services found exiting..." fi