Skip to content

Commit

Permalink
Tweak custom script flow (#273)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoColomb authored Apr 18, 2024
1 parent a388ad0 commit c4bc7e3
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions images/yourls/container-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,25 @@ if [[ "$1" == apache2* ]] || [ "$1" = 'php-fpm' ]; then
chown "$user:$group" user/config.php || true
fi

# ability to use custom script with helm chart
if [[ -d "/docker-entrypoint-init.d" ]]; then
read -r -a init_scripts <<< "$(find "/docker-entrypoint-init.d" -type f -print0 | sort -z | xargs -0)"
if [[ "${#init_scripts[@]}" -gt 0 ]]; then
for init_script in "${init_scripts[@]}"; do
"$init_script"
done
fi
fi
# ability to use custom script
for file in /docker-entrypoint-init.d/*; do
echo >&2 "Running custom script $file"
case "$file" in
*.sh)
if [ -x "$file" ]; then
"$file" || exit 1
else
echo >&2 "... ignoring non-executable $file"
fi
;;
*.php)
php -f "$file"
;;
*)
echo >&2 "... ignoring $file"
;;
esac
done
fi
fi

Expand Down

0 comments on commit c4bc7e3

Please sign in to comment.