diff options
author | Jonathan Bauer | 2018-11-12 12:31:33 +0100 |
---|---|---|
committer | Jonathan Bauer | 2018-11-12 17:30:33 +0100 |
commit | 49fb72dbce75a6b48ff49426596931320ddb1a7a (patch) | |
tree | 0e6693109a1925ab92337ef3bd51a1ae3f2bd659 | |
parent | [conf-tgz] chown files extracted (diff) | |
download | systemd-init-49fb72dbce75a6b48ff49426596931320ddb1a7a.tar.gz systemd-init-49fb72dbce75a6b48ff49426596931320ddb1a7a.tar.xz systemd-init-49fb72dbce75a6b48ff49426596931320ddb1a7a.zip |
[conf-tgz] send uuid in the request, if present
+ formatting
-rwxr-xr-x | builder/modules.d/conf-tgz/hooks/fetch-config-tgz.sh | 50 |
1 files changed, 28 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 263eff75..eb32cfda 100755 --- a/builder/modules.d/conf-tgz/hooks/fetch-config-tgz.sh +++ b/builder/modules.d/conf-tgz/hooks/fetch-config-tgz.sh @@ -8,30 +8,36 @@ type emergency_shell >/dev/null 2>&1 || source /lib/dracut-lib.sh exceptions.try { - logging.set_commands_level debug - logging.set_level debug - # NOTE: "getarg" raises an exception so deactivate exceptions for now. - exceptions.deactivate - slx_server="$(getarg slxsrv=)" - slx_server_base="$(getarg slxbase=)" - exceptions.activate + # NOTE: "getarg" raises an exception so deactivate exceptions for now. + exceptions.deactivate + slx_server="$(getarg slxsrv=)" + slx_server_base="$(getarg slxbase=)" + exceptions.activate - logging.info "Download config.tgz from '${slx_server#@}'..." - IFS_backup="$IFS" - IFS=',' - for TIMEOUT in 1 1 2 3; do - if wget --timeout 5 \ - "http://${slx_server#@}/${slx_server_base}/config.tgz" \ - --output-document "/etc/config.tgz"; then - break - fi - done - IFS="$IFS_backup" + # 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 + fi + done + IFS="$IFS_backup" - if [[ ! -e "/etc/config.tgz" ]]; then - logging.warn "Downloading 'config.tgz' from '${slx_server}' failed. Return code: $return_code" - exit 1 - fi + if [[ ! -e "/etc/config.tgz" ]]; then + logging.warn "Downloading 'config.tgz' from '${slx_server}' failed. Return code: $return_code" + return 1 + fi } exceptions.catch { |