# !/bin/sh M_TITLE="Choose kernel for next boot" # Deprecated due to altbootctl exit 0 # Only kernel 2.6 offers kexec support uname -r | grep -q "^2.6" || exit 0 run_module() { test -e /etc/altboot.func && . /etc/altboot.func || die "ERROR: /etc/altboot.func not found. Check your installation!" test -z "$KEXEC_KERNEL_DIR" && KEXEC_KERNEL_DIR="/boot" test -x "$KEXEC_BIN" || mdie "kexec-tools not found [$KEXEC_BIN]" # Mount /proc, etc # init_rootfs if test `ls -1 $KEXEC_KERNEL_DIR | grep -v "kexec.cfg" | wc -l | tr -d " "` -gt 1 then echo -e "\nSelect the kernel for use of the next boot:\n" cnt=1 ; reset_pref "kexec_klist" for k in `ls -1 $KEXEC_KERNEL_DIR/zImage* | grep -v "kexec.cfg" ` do echo -e "\t[$cnt] $k" set_pref "kexec_klist" "$cnt" "$k" let cnt=$cnt+1 done echo "" while true do echo -n "Select a kernel: " read junk #echo_pref kexec_klist get_pref "kexec_klist" "$junk" KEXEC_SELECTED_KERNEL && break done else KEXEC_SELECTED_KERNEL="`ls -1 $KEXEC_KERNEL_DIR/zImage* | grep -v "kexec.cfg" `" fi echo -e "\nUsing [$KEXEC_SELECTED_KERNEL]" if ! test -e "$KEXEC_SELECTED_KERNEL.kexec.cfg" then echo -e "\nWARNING: This kernel has not been configured." echo -e "It will only boot correctly if CMDLINE is compiled in.\n" fi export USE_KEXEC_ON_NEXT_BOOT=yes export KEXEC_SELECTED_KERNEL show_menu } case "$1" in title) echo "$M_TITLE";; run) run_module;; esac