18 lines
444 B
Bash
18 lines
444 B
Bash
SYSTEM=${1:-/nix/var/nix/profiles/system}
|
|
|
|
if [[ ! -e "$SYSTEM/kernel" ]]; then
|
|
echo "error: no kernel found at $SYSTEM" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "kexec: loading $SYSTEM"
|
|
echo "kernel-params: $(cat "$SYSTEM/kernel-params")"
|
|
|
|
sudo kexec \
|
|
--load "$SYSTEM/kernel" \
|
|
--initrd="$SYSTEM/initrd" \
|
|
--command-line="$(cat "$SYSTEM/kernel-params") init=$SYSTEM/init"
|
|
|
|
echo "kexec: executing (systemd will stop services first)"
|
|
sudo systemctl kexec
|