summaryrefslogtreecommitdiffstats
path: root/builder/modules.d/conf-tgz/hooks/fetch-config-tgz.sh
diff options
context:
space:
mode:
authorJonathan Bauer2019-07-23 17:56:28 +0200
committerJonathan Bauer2019-07-23 17:56:28 +0200
commit0573e048bf86e2e3a2d6256ee65db3836c28e464 (patch)
tree2b751b9bd16e5a1aa54ac3f567b49ee5daa86b00 /builder/modules.d/conf-tgz/hooks/fetch-config-tgz.sh
parent[slx-tools] add dep on busybox (diff)
downloadsystemd-init-0573e048bf86e2e3a2d6256ee65db3836c28e464.tar.gz
systemd-init-0573e048bf86e2e3a2d6256ee65db3836c28e464.tar.xz
systemd-init-0573e048bf86e2e3a2d6256ee65db3836c28e464.zip
[conf-tgz] respect SLX_NO_CONFIG_TGZ
+ use slx-tools
Diffstat (limited to 'builder/modules.d/conf-tgz/hooks/fetch-config-tgz.sh')
-rwxr-xr-xbuilder/modules.d/conf-tgz/hooks/fetch-config-tgz.sh40
1 files changed, 18 insertions, 22 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 aaf8db2f..4bef54ac 100755
--- a/builder/modules.d/conf-tgz/hooks/fetch-config-tgz.sh
+++ b/builder/modules.d/conf-tgz/hooks/fetch-config-tgz.sh
@@ -6,6 +6,7 @@ core.import exceptions
core.import logging
type emergency_shell >/dev/null 2>&1 || source /lib/dracut-lib.sh
+
exceptions.try
{
# NOTE: "getarg" raises an exception so deactivate exceptions for now.
@@ -14,30 +15,25 @@ exceptions.try
slx_server_base="$(getarg slxbase=)"
exceptions.activate
- # check if system's uuid was set
- if [ -s "/run/system-uuid" ]; then
- uuid="$(cat /run/system-uuid)"
- if [ -n "$uuid" ]; then
- uuid_url="?uuid=$uuid"
- fi
- fi
- logging.info "Download config.tgz from '${slx_server#@}'..."
- IFS_backup="$IFS"
- IFS=','
- # to stay compatible with busybox's wget we do not use '--tries'
- for TIMEOUT in 1 1 2 3; do
- if wget -q -T $TIMEOUT \
- "http://${slx_server#@}/${slx_server_base}/config.tgz$uuid_url" \
- --output-document "/etc/config.tgz"; then
- break
+ 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
fi
- done
- IFS="$IFS_backup"
+ logging.info "Download config.tgz from '$conftgz_url'..."
+ slx-tools download_retry "${conftgz_url}" > "/etc/config.tgz"
- if [[ ! -e "/etc/config.tgz" ]]; then
- logging.warn \
- "Downloading 'config.tgz' from '${slx_server}' failed with: $return_code"
- return 1
+ if [[ ! -s "/etc/config.tgz" ]]; then
+ logging.warn \
+ "Downloading 'config.tgz' from '${slx_server}' failed with: $return_code"
+ return 1
+ fi
fi
}
exceptions.catch