summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbuilder/modules.d/conf-tgz/hooks/fetch-config-tgz.sh49
-rwxr-xr-xbuilder/modules.d/dnbd3-rootfs/hooks/fetch-config.sh3
2 files changed, 18 insertions, 34 deletions
diff --git a/builder/modules.d/conf-tgz/hooks/fetch-config-tgz.sh b/builder/modules.d/conf-tgz/hooks/fetch-config-tgz.sh
index 079d45be..bc2cb131 100755
--- a/builder/modules.d/conf-tgz/hooks/fetch-config-tgz.sh
+++ b/builder/modules.d/conf-tgz/hooks/fetch-config-tgz.sh
@@ -1,43 +1,26 @@
#!/usr/bin/env bash
# -*- coding: utf-8 -*-
-source '/usr/lib/rebash/core.sh'
-core.import exceptions
-core.import logging
type emergency_shell >/dev/null 2>&1 || source /lib/dracut-lib.sh
+. /etc/openslx
-exceptions.try
-{
- # NOTE: "getarg" raises an exception so deactivate exceptions for now.
- exceptions.deactivate
- slx_server="$(getarg slxsrv=)"
- slx_server_base="$(getarg slxbase=)"
- exceptions.activate
+if [ -z "$SLX_NO_CONFIG_TGZ" ]; then
+ # build config.tgz url from SLX_KCL_SERVERS and SLX_BASE_PATH
+ conftgz_url="http://${SLX_KCL_SERVERS}/${SLX_BASE_PATH}/config.tgz"
- if [ -z "$SLX_NO_CONFIG_TGZ" ]; then
- # build config.tgz url
- conftgz_url="http://${slx_server#@}/${slx_server_base}/config.tgz"
-
- # check if system's uuid was set
- if [ -s "/run/system-uuid" ]; then
- uuid="$(cat /run/system-uuid)"
- if [ -n "$uuid" ]; then
- conftgz_url="${conftgz_url}?uuid=${uuid}"
- fi
+ # check if system's uuid was set
+ if [ -s "/run/system-uuid" ]; then
+ uuid="$(cat /run/system-uuid)"
+ if [ -n "$uuid" ]; then
+ conftgz_url="${conftgz_url}?uuid=${uuid}"
fi
- logging.info "Download config.tgz from '$conftgz_url'..."
- slx-tools download_retry -s "${conftgz_url}" > "/etc/config.tgz"
+ fi
+ info "Download config.tgz from '$conftgz_url'..."
+ slx-tools download_retry -s "${conftgz_url}" > "/etc/config.tgz"
- if [[ ! -s "/etc/config.tgz" ]]; then
- logging.warn \
- "Downloading 'config.tgz' from '${slx_server}' failed with: $return_code"
- return 1
- fi
+ if [[ ! -s "/etc/config.tgz" ]]; then
+ emergency_shell \
+ "Downloading 'config.tgz' from '${slx_server}/${SLX_BASE_PATH}' failed with: $return_code"
fi
-}
-exceptions.catch
-{
- logging.error "$exceptions_last_traceback"
- emergency_shell "error in ${BASH_SOURCE[0]}"
-}
+fi
diff --git a/builder/modules.d/dnbd3-rootfs/hooks/fetch-config.sh b/builder/modules.d/dnbd3-rootfs/hooks/fetch-config.sh
index 2b63f917..60e3bde9 100755
--- a/builder/modules.d/dnbd3-rootfs/hooks/fetch-config.sh
+++ b/builder/modules.d/dnbd3-rootfs/hooks/fetch-config.sh
@@ -15,7 +15,6 @@ logging.set_log_file "${SLX_LOG_FILE_PATH:-/var/log/openslx}"
exceptions.deactivate
slx_server="$(getarg slxsrv=)"
slx_server_base="$(getarg slxbase=)"
-exceptions.activate
# if no slxsrv was specified, use the server the kernel was
# downloaded from as fallback. Mostly for legacy PXE boot.
@@ -31,6 +30,8 @@ if [ -z "$slx_server" ]; then
emergency_shell "Failed to determine SLX server to fetch config from."
fi
+exceptions.activate
+
# build config_url
config_url="http://${slx_server#@}/${slx_server_base}/config"