Add exit handler

This commit is contained in:
Aleksandar Puharic 2022-07-26 21:33:28 +02:00
parent 8b388ae116
commit 264a8bba25
Signed by: xZero707
GPG Key ID: 3CC53DCAA9C237BB

View File

@ -2,6 +2,20 @@
# Designed to replace original, overcomplicated entrypoint script from official wordpress docker repository # Designed to replace original, overcomplicated entrypoint script from official wordpress docker repository
# Why not use already available tools instead?! # Why not use already available tools instead?!
# Register exit handler
trap scriptExitHandler EXIT
function scriptExitHandler() {
LAST_EXIT_CODE=$?
if [ "${LAST_EXIT_CODE}" = "0" ]; then
echp "> Script finished successfully"
exit "${LAST_EXIT_CODE}"
fi
echo "> Script finished with an error"
exit "${LAST_EXIT_CODE}"
}
# Applies patch for making WordPress updates impossible # Applies patch for making WordPress updates impossible
function disableUpdatesPatch() { function disableUpdatesPatch() {
DISABLE_WP_UPDATES="${ENFORCE_DISABLE_WP_UPDATES:-true}" DISABLE_WP_UPDATES="${ENFORCE_DISABLE_WP_UPDATES:-true}"