Skip to content

Commit

Permalink
Merge pull request #995 from linuxserver/mod-scripts-fd
Browse files Browse the repository at this point in the history
Autoconfigure fds for readiness checks in mods
  • Loading branch information
thespad authored Dec 28, 2024
2 parents c34b24d + 82f5430 commit ebd61e7
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion docker-mods.v3
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# Version 3
# 2022-09-25 - Initial Release
MOD_SCRIPT_VER="3.20241222"
MOD_SCRIPT_VER="3.20241223"

# Define custom folder paths
SCRIPTS_DIR="/custom-cont-init.d"
Expand Down Expand Up @@ -255,6 +255,13 @@ run_mods() {
write_mod_debug "Running in debug mode"
write_mod_debug "Mod script version ${MOD_SCRIPT_VER}"
mkdir -p /modcache
# Fetch internal fds
FD_MAX=3
while IFS= read -r -d '' FD; do
if [[ $(cat "${FD}") -gt "${FD_MAX}" ]]; then
FD_MAX=$(cat "${FD}")
fi
done < <(find /etc/s6-overlay/s6-rc.d -type f -name 'notification-fd' -print0)
for DOCKER_MOD in $(echo "${DOCKER_MODS}" | tr '|' '\n'); do
# Support alternative endpoints
case "${DOCKER_MOD}" in
Expand Down Expand Up @@ -421,6 +428,13 @@ run_mods() {
if [[ -d /tmp/mod/etc/services.d ]]; then
rm -rf /tmp/mod/etc/services.d
fi
# Rationalise fds
if [[ ! -f "/tmp/mod/fd-static" ]]; then
while IFS= read -r -d '' FD; do
(( FD_MAX++ ))
echo $FD_MAX > "${FD}"
done < <(find /tmp/mod/etc/s6-overlay/s6-rc.d -type f -name 'notification-fd' -print0)
fi
shopt -s dotglob
cp -R /tmp/mod/* /
shopt -u dotglob
Expand Down

0 comments on commit ebd61e7

Please sign in to comment.