summaryrefslogtreecommitdiffstats
path: root/builder/modules.d/kexec-reboot/scripts/kexec-reboot.sh
diff options
context:
space:
mode:
Diffstat (limited to 'builder/modules.d/kexec-reboot/scripts/kexec-reboot.sh')
-rwxr-xr-xbuilder/modules.d/kexec-reboot/scripts/kexec-reboot.sh25
1 files changed, 6 insertions, 19 deletions
diff --git a/builder/modules.d/kexec-reboot/scripts/kexec-reboot.sh b/builder/modules.d/kexec-reboot/scripts/kexec-reboot.sh
index 709758bb..bbd05a0b 100755
--- a/builder/modules.d/kexec-reboot/scripts/kexec-reboot.sh
+++ b/builder/modules.d/kexec-reboot/scripts/kexec-reboot.sh
@@ -1,19 +1,5 @@
#!/bin/bash
-# download_retry <url> <path>
-download_retry() {
- [ $# -ne 2 ] && return 1
- for TIMEOUT in 1 1 2 3 END; do
- [ "x$TIMEOUT" = "xEND" ] && break
- if wget -T 2 -O "$2" "$1"; then
- return 0
- break
- fi
- sleep $TIMEOUT
- done
- return 1
-}
-
kexec_load() {
. /lib/dracut-lib.sh
@@ -26,25 +12,26 @@ kexec_load() {
return 1
fi
for FILE in kernel initramfs-stage31; do
- if ! download_retry "http://${SLXSRV}/${SLXBASE}/${FILE}" "${DIR}/${FILE}" ; then
+ if ! slx-tools download_retry "http://${SLXSRV}/${SLXBASE}/${FILE}" > "${DIR}/${FILE}" ; then
echo "Failed to download ${FILE}."
return 1
fi
done
- if ! kexec --load "${DIR}/kernel" --initrd "${DIR}/initramfs-stage31" --reuse-cmdline; then
+ if ! kexec --load "${DIR}/kernel" \
+ --initrd "${DIR}/initramfs-stage31"; then
+ --reuse-cmdline "${1:+--append "$@"}"; then
echo "Failed to load kernel/initrd from ${DIR}"
return 1
fi
return 0
}
-if ! type -p kexec 2>/dev/null; then
+if ! hash kexec; then
echo "kexec binary not found, aborting..."
exit 1
fi
-
-if kexec_load; then
+if kexec_load $@; then
kexec -e
else
echo "Failed to execute kexec --load"