2018-01-22 08:29:43 +01:00
|
|
|
#!/usr/bin/env bash
|
2021-10-17 14:30:38 +02:00
|
|
|
|
|
|
|
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
|
2018-01-22 08:29:43 +01:00
|
|
|
sudo systemctl kexec
|