summaryrefslogtreecommitdiffstats
path: root/builder/modules.d/kexec-reboot
diff options
context:
space:
mode:
authorJonathan Bauer2019-07-23 17:54:09 +0200
committerJonathan Bauer2019-07-23 17:54:09 +0200
commitf086b90d1d767a2179bf429c08c45b30bc23d698 (patch)
treeb9f64d7cc0530b61f96b5218536e46630c82945a /builder/modules.d/kexec-reboot
parent[slx-clock] ntpdate > timesyncd (diff)
downloadsystemd-init-f086b90d1d767a2179bf429c08c45b30bc23d698.tar.gz
systemd-init-f086b90d1d767a2179bf429c08c45b30bc23d698.tar.xz
systemd-init-f086b90d1d767a2179bf429c08c45b30bc23d698.zip
[kexec-reboot] use slx-tools
Diffstat (limited to 'builder/modules.d/kexec-reboot')
-rwxr-xr-xbuilder/modules.d/kexec-reboot/module-setup.sh4
-rwxr-xr-xbuilder/modules.d/kexec-reboot/scripts/kexec-reboot.sh25
2 files changed, 8 insertions, 21 deletions
diff --git a/builder/modules.d/kexec-reboot/module-setup.sh b/builder/modules.d/kexec-reboot/module-setup.sh
index db41cce6..1cda92a0 100755
--- a/builder/modules.d/kexec-reboot/module-setup.sh
+++ b/builder/modules.d/kexec-reboot/module-setup.sh
@@ -3,14 +3,14 @@
check() {
# Tell dracut that this module should only be included if it is required
# explicitly.
- if ! which kexec 2>/dev/null; then
+ if ! hash kexec; then
derror "Failed to find kexec, please install it when using this module."
return 1
fi
return 255
}
depends() {
- echo dnbd3-rootfs
+ echo dnbd3-rootfs slx-tools
}
install() {
inst_simple "$moddir/scripts/kexec-reboot.sh" "/bin/kexec-reboot"
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"