arch-kexec: Works for other kernels

This commit is contained in:
Geoffrey Frogeye 2021-10-17 14:30:38 +02:00
parent 8743082b21
commit 97b6cec7d1
1 changed files with 16 additions and 1 deletions

View File

@ -1,3 +1,18 @@
#!/usr/bin/env bash #!/usr/bin/env bash
sudo kexec -l /boot/vmlinuz-linux --initrd=/boot/initramfs-linux.img --reuse-cmdline
set -euxo pipefail
# Set variables
name="${1:-linux}"
kernel="/boot/vmlinuz-$name"
initrd="/boot/initramfs-$name.img"
# Test if required files are present
[ -f $kernel ]
[ -f $initrd ]
command -v kexec &> /dev/null
# Configure the next kernel to load
sudo kexec -l $kernel --initrd=$initrd --reuse-cmdline
# Gracefully restart on the next kernel
sudo systemctl kexec sudo systemctl kexec