fix rebootTo

This commit is contained in:
Ing 2024-04-28 10:32:20 +08:00
parent 46598132fd
commit 9dba6e5a6f

View File

@ -343,10 +343,10 @@ function getLogo() {
# 1 - mode
function rebootTo() {
MODES="config recovery junior"
[ -z "${1}" ] && exit 1
if ! echo "${MODES}" | grep -qw "${1}"; then exit 1; fi
if [ -z "${1}" ] || ! echo "${MODES}" | grep -qw "${1}"; then exit 1; fi
# echo "Rebooting to ${1} mode"
GRUBPATH="$(dirname $(find ${PART1_PATH}/ -name grub.cfg 2>/dev/null | head -1))"
[ -z "${GRUBPATH}" ] && exit 1
ENVFILE="${GRUBPATH}/grubenv"
[ ! -f "${ENVFILE}" ] && grub-editenv ${ENVFILE} create
grub-editenv ${ENVFILE} set next_entry="${1}"