#!/bin/bash kexec_load() { . /lib/dracut-lib.sh local SLXSRV="$(getarg slxsrv)" local SLXBASE="$(getarg slxbase)" local DIR="$(mktemp -d)" if [ -z "$SLXSRV" -o -z "$SLXBASE" -o -z "$DIR" ]; then echo "Failed to construct download URL..." return 1 fi for FILE in kernel initramfs-stage31; do 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 "${1:+--append "$@"}"; then echo "Failed to load kernel/initrd from ${DIR}" return 1 fi return 0 } if ! hash kexec; then echo "kexec binary not found, aborting..." exit 1 fi if kexec_load $@; then kexec -e else echo "Failed to execute kexec --load" exit 1 fi