improvement by using systemctl kexec if possible

This commit is contained in:
guochao 2023-11-07 09:59:08 +08:00
parent 611b923921
commit 4079a0cb4c

View File

@ -78,6 +78,9 @@ while [[ $# -gt 0 ]]; do
-b|--boot) -b|--boot)
BOOT=y BOOT=y
;; ;;
-*|--*)
fail "unrecognized option"
;;
*) *)
if set-target "$opt"; then if set-target "$opt"; then
: :
@ -137,5 +140,10 @@ fi
run kexec -l --initrd=$INITRD --command-line="$CMDLINE" $KERNEL run kexec -l --initrd=$INITRD --command-line="$CMDLINE" $KERNEL
if [ $BOOT == y ]; then if [ $BOOT == y ]; then
run kexec -e sync
if type systemctl &> /dev/null; then
systemctl kexec
else
run kexec -e
fi
fi fi