summaryrefslogtreecommitdiffstats
path: root/builder/dnbd3-rootfs/hooks/fetch-config.sh
diff options
context:
space:
mode:
authorjandob2016-03-01 23:50:57 +0100
committerjandob2016-03-01 23:50:57 +0100
commit5e90b9b441950996cc6e7304d474b62c4358866c (patch)
treeaae1771365cdf816f2ddea5ce7573511f5dabb3b /builder/dnbd3-rootfs/hooks/fetch-config.sh
parentFix. (diff)
downloadsystemd-init-5e90b9b441950996cc6e7304d474b62c4358866c.tar.gz
systemd-init-5e90b9b441950996cc6e7304d474b62c4358866c.tar.xz
systemd-init-5e90b9b441950996cc6e7304d474b62c4358866c.zip
rework exception handling inside hooks
Diffstat (limited to 'builder/dnbd3-rootfs/hooks/fetch-config.sh')
-rwxr-xr-xbuilder/dnbd3-rootfs/hooks/fetch-config.sh15
1 files changed, 9 insertions, 6 deletions
diff --git a/builder/dnbd3-rootfs/hooks/fetch-config.sh b/builder/dnbd3-rootfs/hooks/fetch-config.sh
index 6d85eea8..e038369c 100755
--- a/builder/dnbd3-rootfs/hooks/fetch-config.sh
+++ b/builder/dnbd3-rootfs/hooks/fetch-config.sh
@@ -6,17 +6,18 @@ source '/usr/lib/rebash/core.sh'
core.import exceptions
core.import logging
# endregion
-( # subshell for variable scoping
+exceptions.try
+{
logging.set_commands_level debug
logging.set_level debug
+# NOTE: "getarg" raises an exception so deactivate exceptions for now.
+exceptions.deactivate
configuration_file_name="$(getarg slx_configuration_filename=)"
if [ -z "$configuration_file_name" ]; then
configuration_file_name='config'
fi
slx_server="$(getarg slxsrv=)"
slx_server_base="$(getarg slxbase=)"
-# NOTE: "getarg" sometimes returns an error code so activating exception
-# handling after it.
exceptions.activate
logging.info 'Getting configuration file.'
@@ -37,9 +38,11 @@ if [[ ! -e "/etc/openslx" ]]; then
logging.warn "Downloading OpenSLX configuration file from any of the servers \"${slx_server}\" at location \"${slx_server_base}${configuration_file_name}\" failed. Return code: $return_code"
exit 1
fi
-
-); [[ $? == 1 ]] && exit 1
-exceptions.deactivate
+}
+exceptions.catch
+{
+ emergency_shell "error in ${BASH_SOURCE[0]}"
+}
# region vim modline
# vim: set tabstop=4 shiftwidth=4 expandtab:
# vim: foldmethod=marker foldmarker=region,endregion: