arc: add more informations

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium
2025-01-28 17:02:55 +01:00
parent 8e1442eb66
commit 39d2ce6344
3 changed files with 32 additions and 17 deletions

View File

@@ -14,8 +14,8 @@ ARC_BRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")"
# Get Loader Disk Bus
[ -z "${LOADER_DISK}" ] && die "Loader Disk not found!"
BUS=$(getBus "${LOADER_DISK}")
FBI=$(cat /sys/class/graphics/fb*/name 2>/dev/null | head -1)
EFI=$([ -d /sys/firmware/efi ] && echo 1 || echo 0)
check_boot_mode
# Print Title centralized
clear
@@ -30,7 +30,8 @@ printf "\033[1;34m%*s\033[0m\n" ${COLUMNS} "${BANNER}"
printf "\033[1;34m%*s\033[0m\n" $(((${#TITLE} + ${COLUMNS}) / 2)) "${TITLE}"
TITLE="Boot:"
[ ${EFI} -eq 1 ] && TITLE+=" [UEFI]" || TITLE+=" [BIOS]"
TITLE+=" [${BUS}]"
TITLE+="| Device: [${BUS}]"
TITLE+="| Mode: [${BOOT_MODE}]"
printf "\033[1;34m%*s\033[0m\n" $(((${#TITLE} + ${COLUMNS}) / 2)) "${TITLE}"
# Check if DSM zImage/Ramdisk is changed, patch it if necessary, update Files if necessary
ZIMAGE_HASH="$(readConfigKey "zimage-hash" "${USER_CONFIG_FILE}")"
@@ -71,7 +72,7 @@ if [ "${ARCPATCH}" = "true" ]; then
HARDWAREID="$(readConfigKey "arc.hardwareid" "${USER_CONFIG_FILE}")"
HWID="$(genHWID)"
if [ "${HARDWAREID}" != "${HWID}" ]; then
echo "\033[1;31m*** HardwareID does not match! - Loader can't boot to DSM! You need to reconfigure your Loader - Rebooting to Config Mode! ***\033[0m"
echo -e "\033[1;31m*** HardwareID does not match! - Loader can't boot to DSM! You need to reconfigure your Loader - Rebooting to Config Mode! ***\033[0m"
writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
writeConfigKey "arc.hardwareid" "" "${USER_CONFIG_FILE}"
writeConfigKey "arc.userid" "" "${USER_CONFIG_FILE}"

View File

@@ -686,4 +686,26 @@ function write_menu() {
function write_menu_with_color() {
echo "$1 \"$2: \Z4${3:-none}\Zn\" " >>"${TMP_PATH}/menu"
}
###############################################################################
# Check boot mode
function check_boot_mode() {
if grep -q "automated_arc" /proc/cmdline; then
writeConfigKey "arc.mode" "automated" "${USER_CONFIG_FILE}"
BOOTMODE="automated"
elif grep -q "update_arc" /proc/cmdline; then
writeConfigKey "arc.mode" "update" "${USER_CONFIG_FILE}"
BOOTMODE="update"
elif grep -q "force_arc" /proc/cmdline; then
writeConfigKey "arc.mode" "config" "${USER_CONFIG_FILE}"
BOOTMODE="config"
else
writeConfigKey "arc.mode" "dsm" "${USER_CONFIG_FILE}"
BOOTMODE="dsm"
fi
[ -f "${PART3_PATH}/automated" ] && rm -f "${PART3_PATH}/automated" >/dev/null 2>&1 || true
if [ -n "${ARC_BRANCH}" ]; then
writeConfigKey "arc.branch" "${ARC_BRANCH}" "${USER_CONFIG_FILE}"
fi
}

View File

@@ -14,6 +14,7 @@ checkBootLoader || die "The loader is corrupted, please rewrite it!"
BUS=$(getBus "${LOADER_DISK}")
EFI=$([ -d /sys/firmware/efi ] && echo 1 || echo 0)
check_boot_mode
# Print Title centralized
clear
@@ -28,7 +29,8 @@ printf "\033[1;34m%*s\033[0m\n" ${COLUMNS} "${BANNER}"
printf "\033[1;34m%*s\033[0m\n" $(((${#TITLE} + ${COLUMNS}) / 2)) "${TITLE}"
TITLE="Boot:"
[ ${EFI} -eq 1 ] && TITLE+=" [UEFI]" || TITLE+=" [BIOS]"
TITLE+=" [${BUS}]"
TITLE+=" | Device: [${BUS}]"
TITLE+=" | Mode: [${BOOT_MODE}]"
printf "\033[1;34m%*s\033[0m\n" $(((${#TITLE} + ${COLUMNS}) / 2)) "${TITLE}"
# Check for Config File
@@ -84,22 +86,12 @@ initConfigKey "synoinfo" "{}" "${USER_CONFIG_FILE}"
initConfigKey "time" "{}" "${USER_CONFIG_FILE}"
initConfigKey "usbmount" "false" "${USER_CONFIG_FILE}"
initConfigKey "zimage-hash" "" "${USER_CONFIG_FILE}"
if grep -q "automated_arc" /proc/cmdline; then
writeConfigKey "arc.mode" "automated" "${USER_CONFIG_FILE}"
elif grep -q "update_arc" /proc/cmdline; then
writeConfigKey "arc.mode" "update" "${USER_CONFIG_FILE}"
elif grep -q "force_arc" /proc/cmdline; then
writeConfigKey "arc.mode" "config" "${USER_CONFIG_FILE}"
else
writeConfigKey "arc.mode" "dsm" "${USER_CONFIG_FILE}"
fi
[ -f "${PART3_PATH}/automated" ] && rm -f "${PART3_PATH}/automated" >/dev/null 2>&1 || true
if [ -n "${ARC_BRANCH}" ]; then
writeConfigKey "arc.branch" "${ARC_BRANCH}" "${USER_CONFIG_FILE}"
fi
# Sort network interfaces
if arrayExistItem "sortnetif:" $(readConfigMap "addons" "${USER_CONFIG_FILE}"); then
echo -e "Sorting NIC: \033[1;34mactive\033[0m"
_sort_netif "$(readConfigKey "addons.sortnetif" "${USER_CONFIG_FILE}")"
echo
fi
# Read/Write IP/Mac to config
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true