From 1f816f0fd2de8f1db36c6e65923482819cc8345a Mon Sep 17 00:00:00 2001 From: TheSpad Date: Sun, 28 Aug 2022 21:30:35 +0100 Subject: [PATCH 1/3] Support new custom files locations --- root/etc/cont-init.d/99-custom-files | 143 +++++++++++++++++++-------- 1 file changed, 104 insertions(+), 39 deletions(-) diff --git a/root/etc/cont-init.d/99-custom-files b/root/etc/cont-init.d/99-custom-files index 2195641..bd821aa 100755 --- a/root/etc/cont-init.d/99-custom-files +++ b/root/etc/cont-init.d/99-custom-files @@ -1,49 +1,114 @@ #!/usr/bin/with-contenv bash +# shellcheck shell=bash # Directories -SCRIPTS_DIR="/config/custom-cont-init.d" -SERVICES_DIR="/config/custom-services.d" +SCRIPTS_DIR_OLD="/config/custom-cont-init.d" +SERVICES_DIR_OLD="/config/custom-services.d" +SCRIPTS_DIR="/custom-cont-init.d" +SERVICES_DIR="/custom-services.d" # Remove all existing custom services before continuing to ensure # we aren't running anything the user may have removed -if [ -n "$(/bin/ls -A /etc/services.d/custom-service-* 2>/dev/null)" ]; then - echo "[custom-init] removing existing custom services..." - rm -rf /etc/services.d/custom-service-* +if [[ -n "$(/bin/ls -A /etc/s6-overlay/s6-rc.d/custom-svc-* 2>/dev/null)" ]]; then + echo "[custom-init] removing existing custom services..." + rm -rf /etc/s6-overlay/s6-rc.d/custom-svc-* fi -# Make sure custom init directory exists and has files in it -if ([ -e "${SCRIPTS_DIR}" ] && \ - [ -n "$(/bin/ls -A ${SCRIPTS_DIR} 2>/dev/null)" ]) || \ - ([ -e "${SERVICES_DIR}" ] && \ - [ -n "$(/bin/ls -A ${SERVICES_DIR} 2>/dev/null)" ]); then - if [ -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 - 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 - fi - if [ -n "$(/bin/ls -A ${SERVICES_DIR} 2>/dev/null)" ]; then - echo "[custom-init] service files found in ${SERVICES_DIR}" - for SERVICE in ${SERVICES_DIR}/*; do - NAME="$(basename "${SERVICE}")" - if [ -f "${SERVICE}" ]; then - echo "[custom-init] ${NAME}: service detected, copying..." - mkdir -p /etc/services.d/custom-service-${NAME}/ - cp ${SERVICE} /etc/services.d/custom-service-${NAME}/run - chmod +x /etc/services.d/custom-service-${NAME}/run - echo "[custom-init] ${NAME}: copied" - elif [ ! -f "${SERVICE}" ]; then - echo "[custom-init] ${NAME}: is not a file" - fi - done - fi +if [[ -z "$(/bin/ls -A ${SERVICES_DIR} 2>/dev/null)" ]] && + [[ -z "$(/bin/ls -A ${SERVICES_DIR_OLD} 2>/dev/null)" ]]; then + echo "[custom-init] no custom services found, skipping..." else - echo "[custom-init] no custom files found exiting..." + # Make sure custom service directory exists and has files in it + if [[ -e "${SERVICES_DIR}" ]] && [[ -n "$(/bin/ls -A ${SERVICES_DIR} 2>/dev/null)" ]]; then + echo "[custom-init] service files found in ${SERVICES_DIR}" + for SERVICE in "${SERVICES_DIR}"/*; do + NAME="$(basename "${SERVICE}")" + if [[ -f "${SERVICE}" ]]; then + echo "[custom-init] ${NAME}: service detected, copying..." + mkdir -p /etc/s6-overlay/s6-rc.d/custom-svc-"${NAME}"/ + cp "${SERVICE}" /etc/s6-overlay/s6-rc.d/custom-svc-"${NAME}"/run + chmod +x /etc/s6-overlay/s6-rc.d/custom-svc-"${NAME}"/run + echo "longrun" >/etc/s6-overlay/s6-rc.d/custom-svc-"${NAME}"/type + touch /etc/s6-overlay/s6-rc.d/custom-svc-"${NAME}"/dependencies.d/init-services + touch /etc/s6-overlay/s6-rc.d/init-mods-end/dependencies.d/custom-svc-"${NAME}" + echo "[custom-init] ${NAME}: copied" + elif [[ ! -f "${SERVICE}" ]]; then + echo "[custom-init] ${NAME}: is not a file" + fi + done + fi + + if [[ -e "${SERVICES_DIR_OLD}" ]] && [[ -n "$(/bin/ls -A ${SERVICES_DIR_OLD} 2>/dev/null)" ]]; then + echo "[custom-init] service files found in ${SERVICES_DIR_OLD}" + for SERVICE in "${SERVICES_DIR_OLD}"/*; do + NAME="$(basename "${SERVICE}")" + if [[ -f "${SERVICE}" ]]; then + echo "[custom-init] ${NAME}: service detected, copying..." + mkdir -p /etc/s6-overlay/s6-rc.d/custom-svc-"${NAME}"/ + cp "${SERVICE}" /etc/s6-overlay/s6-rc.d/custom-svc-"${NAME}"/run + chmod +x /etc/s6-overlay/s6-rc.d/custom-svc-"${NAME}"/run + echo "longrun" >/etc/s6-overlay/s6-rc.d/custom-svc-"${NAME}"/type + touch /etc/s6-overlay/s6-rc.d/custom-svc-"${NAME}"/dependencies.d/init-services + touch /etc/s6-overlay/s6-rc.d/init-mods-end/dependencies.d/custom-svc-"${NAME}" + echo "[custom-init] ${NAME}: copied" + elif [[ ! -f "${SERVICE}" ]]; then + echo "[custom-init] ${NAME}: is not a file" + fi + done + fi fi + +if [[ -z "$(/bin/ls -A ${SCRIPTS_DIR} 2>/dev/null)" ]] && + [[ -z "$(/bin/ls -A ${SCRIPTS_DIR_OLD} 2>/dev/null)" ]]; then + echo "[custom-init] no custom files found, skipping..." +else + # 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 + fi + + if [[ -e "${SCRIPTS_DIR_OLD}" ]] && [[ -n "$(/bin/ls -A ${SCRIPTS_DIR_OLD} 2>/dev/null)" ]]; then + echo "[custom-init] files found, executing" + for SCRIPT in "${SCRIPTS_DIR_OLD}"/*; 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 + fi +fi + +if [[ -n "$(/bin/ls -A "${SCRIPTS_DIR_OLD}" 2>/dev/null)" ]] || + [[ -n "$(/bin/ls -A "${SERVICES_DIR_OLD}" 2>/dev/null)" ]]; then + cat <<-EOF | tee ${SCRIPTS_DIR_OLD}/README.txt,${SERVICES_DIR_OLD}/README.txt 2>/dev/null + ******************************************************** + ******************************************************** + * * + * !!!! * + * Custom scripts or services found in legacy locations * + * !!!! * + * Please move your custom scripts and services * + * to ${SCRIPTS_DIR} and ${SERVICES_DIR} * + * respectively to ensure they continue working. * + * * + * Visit https://linuxserver.io/custom for more info. * + * * + ******************************************************** + ******************************************************** +EOF +fi +exit 0 From d1d84fac4c8d68eb03665b2b2ecbc44151052341 Mon Sep 17 00:00:00 2001 From: TheSpad Date: Fri, 2 Sep 2022 11:07:44 +0100 Subject: [PATCH 2/3] Fix custom svc logic --- root/docker-mods | 52 +++++++++++++++++++++++++++ root/etc/cont-init.d/99-custom-files | 53 +--------------------------- 2 files changed, 53 insertions(+), 52 deletions(-) diff --git a/root/docker-mods b/root/docker-mods index ead588e..6d4eea6 100755 --- a/root/docker-mods +++ b/root/docker-mods @@ -9,6 +9,58 @@ set_legacy_executable_bits() { } set_legacy_executable_bits +SERVICES_DIR_OLD="/config/custom-services.d" +SERVICES_DIR="/custom-services.d" + +# Remove all existing custom services before continuing to ensure +# we aren't running anything the user may have removed +if [[ -n "$(/bin/ls -A /etc/s6-overlay/s6-rc.d/custom-svc-* 2>/dev/null)" ]]; then + echo "[custom-init] removing existing custom services..." + rm -rf /etc/s6-overlay/s6-rc.d/custom-svc-* +fi + +if [[ -z "$(/bin/ls -A ${SERVICES_DIR} 2>/dev/null)" ]] && + [[ -z "$(/bin/ls -A ${SERVICES_DIR_OLD} 2>/dev/null)" ]]; then + echo "[custom-init] no custom services found, skipping..." +else + # Make sure custom service directory exists and has files in it + if [[ -e "${SERVICES_DIR}" ]] && [[ -n "$(/bin/ls -A ${SERVICES_DIR} 2>/dev/null)" ]]; then + echo "[custom-init] service files found in ${SERVICES_DIR}" + for SERVICE in "${SERVICES_DIR}"/*; do + NAME="$(basename "${SERVICE}")" + if [[ -f "${SERVICE}" ]]; then + echo "[custom-init] ${NAME}: service detected, copying..." + mkdir -p /etc/s6-overlay/s6-rc.d/custom-svc-"${NAME}"/dependencies.d/ + cp "${SERVICE}" /etc/s6-overlay/s6-rc.d/custom-svc-"${NAME}"/run + chmod +x /etc/s6-overlay/s6-rc.d/custom-svc-"${NAME}"/run + echo "longrun" >/etc/s6-overlay/s6-rc.d/custom-svc-"${NAME}"/type + touch /etc/s6-overlay/s6-rc.d/custom-svc-"${NAME}"/dependencies.d/init-services + echo "[custom-init] ${NAME}: copied" + elif [[ ! -f "${SERVICE}" ]]; then + echo "[custom-init] ${NAME}: is not a file" + fi + done + fi + + if [[ -e "${SERVICES_DIR_OLD}" ]] && [[ -n "$(/bin/ls -A ${SERVICES_DIR_OLD} 2>/dev/null)" ]]; then + echo "[custom-init] service files found in ${SERVICES_DIR_OLD}" + for SERVICE in "${SERVICES_DIR_OLD}"/*; do + NAME="$(basename "${SERVICE}")" + if [[ -f "${SERVICE}" ]]; then + echo "[custom-init] ${NAME}: service detected, copying..." + mkdir -p /etc/s6-overlay/s6-rc.d/custom-svc-"${NAME}"/dependencies.d/ + cp "${SERVICE}" /etc/s6-overlay/s6-rc.d/custom-svc-"${NAME}"/run + chmod +x /etc/s6-overlay/s6-rc.d/custom-svc-"${NAME}"/run + echo "longrun" >/etc/s6-overlay/s6-rc.d/custom-svc-"${NAME}"/type + touch /etc/s6-overlay/s6-rc.d/custom-svc-"${NAME}"/dependencies.d/init-services + echo "[custom-init] ${NAME}: copied" + elif [[ ! -f "${SERVICE}" ]]; then + echo "[custom-init] ${NAME}: is not a file" + fi + done + fi +fi + # Exit if mods is not set if [ -z ${DOCKER_MODS+x} ]; then exit 0 diff --git a/root/etc/cont-init.d/99-custom-files b/root/etc/cont-init.d/99-custom-files index bd821aa..e800ea4 100755 --- a/root/etc/cont-init.d/99-custom-files +++ b/root/etc/cont-init.d/99-custom-files @@ -7,57 +7,6 @@ SERVICES_DIR_OLD="/config/custom-services.d" SCRIPTS_DIR="/custom-cont-init.d" SERVICES_DIR="/custom-services.d" -# Remove all existing custom services before continuing to ensure -# we aren't running anything the user may have removed -if [[ -n "$(/bin/ls -A /etc/s6-overlay/s6-rc.d/custom-svc-* 2>/dev/null)" ]]; then - echo "[custom-init] removing existing custom services..." - rm -rf /etc/s6-overlay/s6-rc.d/custom-svc-* -fi - -if [[ -z "$(/bin/ls -A ${SERVICES_DIR} 2>/dev/null)" ]] && - [[ -z "$(/bin/ls -A ${SERVICES_DIR_OLD} 2>/dev/null)" ]]; then - echo "[custom-init] no custom services found, skipping..." -else - # Make sure custom service directory exists and has files in it - if [[ -e "${SERVICES_DIR}" ]] && [[ -n "$(/bin/ls -A ${SERVICES_DIR} 2>/dev/null)" ]]; then - echo "[custom-init] service files found in ${SERVICES_DIR}" - for SERVICE in "${SERVICES_DIR}"/*; do - NAME="$(basename "${SERVICE}")" - if [[ -f "${SERVICE}" ]]; then - echo "[custom-init] ${NAME}: service detected, copying..." - mkdir -p /etc/s6-overlay/s6-rc.d/custom-svc-"${NAME}"/ - cp "${SERVICE}" /etc/s6-overlay/s6-rc.d/custom-svc-"${NAME}"/run - chmod +x /etc/s6-overlay/s6-rc.d/custom-svc-"${NAME}"/run - echo "longrun" >/etc/s6-overlay/s6-rc.d/custom-svc-"${NAME}"/type - touch /etc/s6-overlay/s6-rc.d/custom-svc-"${NAME}"/dependencies.d/init-services - touch /etc/s6-overlay/s6-rc.d/init-mods-end/dependencies.d/custom-svc-"${NAME}" - echo "[custom-init] ${NAME}: copied" - elif [[ ! -f "${SERVICE}" ]]; then - echo "[custom-init] ${NAME}: is not a file" - fi - done - fi - - if [[ -e "${SERVICES_DIR_OLD}" ]] && [[ -n "$(/bin/ls -A ${SERVICES_DIR_OLD} 2>/dev/null)" ]]; then - echo "[custom-init] service files found in ${SERVICES_DIR_OLD}" - for SERVICE in "${SERVICES_DIR_OLD}"/*; do - NAME="$(basename "${SERVICE}")" - if [[ -f "${SERVICE}" ]]; then - echo "[custom-init] ${NAME}: service detected, copying..." - mkdir -p /etc/s6-overlay/s6-rc.d/custom-svc-"${NAME}"/ - cp "${SERVICE}" /etc/s6-overlay/s6-rc.d/custom-svc-"${NAME}"/run - chmod +x /etc/s6-overlay/s6-rc.d/custom-svc-"${NAME}"/run - echo "longrun" >/etc/s6-overlay/s6-rc.d/custom-svc-"${NAME}"/type - touch /etc/s6-overlay/s6-rc.d/custom-svc-"${NAME}"/dependencies.d/init-services - touch /etc/s6-overlay/s6-rc.d/init-mods-end/dependencies.d/custom-svc-"${NAME}" - echo "[custom-init] ${NAME}: copied" - elif [[ ! -f "${SERVICE}" ]]; then - echo "[custom-init] ${NAME}: is not a file" - fi - done - fi -fi - if [[ -z "$(/bin/ls -A ${SCRIPTS_DIR} 2>/dev/null)" ]] && [[ -z "$(/bin/ls -A ${SCRIPTS_DIR_OLD} 2>/dev/null)" ]]; then echo "[custom-init] no custom files found, skipping..." @@ -94,7 +43,7 @@ fi if [[ -n "$(/bin/ls -A "${SCRIPTS_DIR_OLD}" 2>/dev/null)" ]] || [[ -n "$(/bin/ls -A "${SERVICES_DIR_OLD}" 2>/dev/null)" ]]; then - cat <<-EOF | tee ${SCRIPTS_DIR_OLD}/README.txt,${SERVICES_DIR_OLD}/README.txt 2>/dev/null + cat << EOF | tee {${SCRIPTS_DIR_OLD}/README.txt,${SERVICES_DIR_OLD}/README.txt} 2>/dev/null ******************************************************** ******************************************************** * * From 110ea527e9ad4953a0a017b4a258616911d789e2 Mon Sep 17 00:00:00 2001 From: LinuxServer-CI Date: Fri, 2 Sep 2022 16:11:10 +0200 Subject: [PATCH 3/3] Bot Updating Package Versions --- package_versions.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package_versions.txt b/package_versions.txt index daa41bd..6c4c2bb 100755 --- a/package_versions.txt +++ b/package_versions.txt @@ -8,13 +8,13 @@ busybox-1.35.0-r17 ca-certificates-20220614-r0 ca-certificates-bundle-20220614-r0 coreutils-9.1-r0 -curl-7.83.1-r2 +curl-7.83.1-r3 gmp-6.2.1-r2 libacl-2.3.1-r0 libattr-2.5.1-r1 libc-utils-0.7.2-r3 libcrypto1.1-1.1.1q-r0 -libcurl-7.83.1-r2 +libcurl-7.83.1-r3 libintl-0.21-r2 libproc-3.3.17-r1 libssl1.1-1.1.1q-r0