tree: rewrite grub related

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium
2024-06-13 19:57:28 +02:00
parent f8cbc01cb9
commit cd762d8d0f
5 changed files with 13 additions and 10 deletions

View File

@@ -1978,9 +1978,9 @@ function resetLoader() {
function editGrubCfg() {
while true; do
dialog --backtitle "$(backtitle)" --title "Edit with caution" \
--ok-label "Save" --editbox "${GRUB_PATH}/grub.cfg" 0 0 2>"${TMP_PATH}/usergrub.cfg"
--ok-label "Save" --editbox "${USER_GRUB_CONFIG}" 0 0 2>"${TMP_PATH}/usergrub.cfg"
[ $? -ne 0 ] && return
mv -f "${TMP_PATH}/usergrub.cfg" "${GRUB_PATH}/grub.cfg"
mv -f "${TMP_PATH}/usergrub.cfg" "${USER_GRUB_CONFIG}"
break
done
return

View File

@@ -855,7 +855,7 @@ function juniorboot() {
if [ $? -eq 0 ]; then
make
fi
grub-editenv ${GRUB_PATH}/grubenv set next_entry="junior"
grub-editenv ${USER_GRUBENVFILE} set next_entry="junior"
dialog --backtitle "$(backtitle)" --title "Arc Boot" \
--infobox "Booting DSM Reinstall Mode...\nPlease stay patient!" 4 30
sleep 2
@@ -871,7 +871,7 @@ function recoveryboot() {
if [ $? -eq 0 ]; then
make
fi
grub-editenv ${GRUB_PATH}/grubenv set next_entry="recovery"
grub-editenv ${USER_GRUBENVFILE} set next_entry="recovery"
dialog --backtitle "$(backtitle)" --title "Arc Boot" \
--infobox "Booting DSM Recovery Mode...\nPlease stay patient!" 4 30
sleep 2
@@ -885,7 +885,7 @@ function boot() {
[ "${BUILDDONE}" == "false" ] && dialog --backtitle "$(backtitle)" --title "Alert" \
--yesno "Config changed, you need to rebuild the Loader?" 0 0
if [ $? -eq 0 ]; then
make
arcSummary
fi
dialog --backtitle "$(backtitle)" --title "Arc Boot" \
--infobox "Booting DSM...\nPlease stay patient!" 4 25
@@ -1074,7 +1074,7 @@ else
;;
i) bootipwaittime; NEXT="i" ;;
q) [ "${DIRECTBOOT}" == "false" ] && DIRECTBOOT='true' || DIRECTBOOT='false'
grub-editenv "${GRUB_PATH}/grubenv" create
grub-editenv ${USER_GRUBENVFILE} create
writeConfigKey "arc.directboot" "${DIRECTBOOT}" "${USER_CONFIG_FILE}"
NEXT="q"
;;

View File

@@ -184,10 +184,10 @@ CMDLINE_LINE=$(echo "${CMDLINE_LINE}" | sed 's/^ //') # Remove leading space
# Boot
if [ "${DIRECTBOOT}" == "true" ]; then
CMDLINE_DIRECT=$(echo ${CMDLINE_LINE} | sed 's/>/\\\\>/g') # Escape special chars
grub-editenv ${GRUB_PATH}/grubenv set dsm_cmdline="${CMDLINE_DIRECT}"
grub-editenv ${GRUB_PATH}/grubenv set next_entry="direct"
grub-editenv ${USER_GRUBENVFILE} set dsm_cmdline="${CMDLINE_DIRECT}"
echo -e "\033[1;34mReboot with Directboot\033[0m"
exec reboot
grub-editenv ${USER_GRUBENVFILE} set next_entry="direct"
reboot
exit 0
elif [ "${DIRECTBOOT}" == "false" ]; then
BOOTIPWAIT="$(readConfigKey "arc.bootipwait" "${USER_CONFIG_FILE}")"

View File

@@ -12,7 +12,10 @@ RAMDISK_PATH="${TMP_PATH}/ramdisk"
LOG_FILE="${TMP_PATH}/log.txt"
TMP_UP_PATH="${TMP_PATH}/upload"
USER_GRUB_CONFIG="${PART1_PATH}/boot/grub/grub.cfg"
USER_GRUBENVFILE="${PART1_PATH}/boot/grub/grubenv"
USER_CONFIG_FILE="${PART1_PATH}/user-config.yml"
USER_LOCALE_FILE="${PART1_PATH}/.locale"
GRUB_PATH="${PART1_PATH}/boot/grub"
ORI_ZIMAGE_FILE="${PART2_PATH}/zImage"

View File

@@ -40,7 +40,7 @@ function updateLoader() {
echo "Download successful!"
unzip -oq "${TMP_PATH}/update.zip" -d "${TMP_PATH}"
echo "Installing new Loader Image..."
cp -f "${TMP_PATH}/grub.cfg" "${GRUB_PATH}/grub.cfg"
cp -f "${TMP_PATH}/grub.cfg" "${USER_GRUB_CONFIG}"
cp -f "${TMP_PATH}/bzImage-arc" "${ARC_BZIMAGE_FILE}"
cp -f "${TMP_PATH}/initrd-arc" "${ARC_RAMDISK_FILE}"
rm -f "${TMP_PATH}/grub.cfg" "${TMP_PATH}/bzImage-arc" "${TMP_PATH}/initrd-arc"