From 466424229d1016869c91b1d693a1a2ceb487eb37 Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Thu, 28 Nov 2024 23:22:57 +0100 Subject: [PATCH 1/5] tree: update Signed-off-by: AuxXxilium --- files/initrd/opt/arc/arc-functions.sh | 18 +++++++++--------- files/initrd/opt/arc/init.sh | 6 +----- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/files/initrd/opt/arc/arc-functions.sh b/files/initrd/opt/arc/arc-functions.sh index 9b195b5d..f15886ec 100755 --- a/files/initrd/opt/arc/arc-functions.sh +++ b/files/initrd/opt/arc/arc-functions.sh @@ -1794,12 +1794,12 @@ function bootipwaittime() { # let user format disks from inside arc function formatDisks() { rm -f "${TMP_PATH}/opts" - while read -r KNAME SIZE TYPE MODEL; do + while read -r KNAME SIZE TYPE MODEL PKNAME; do [ "${KNAME}" = "N/A" ] || [ "${SIZE:0:1}" = "0" ] && continue [ "${KNAME:0:7}" = "/dev/md" ] && continue - [ "${KNAME:0:8}" = "${LOADER_DISK}" ] && continue - printf "\"%s\" \"%-6s %-4s %s\" \"off\"\n" "${KNAME}" "${SIZE}" "${MODEL}" "${TYPE}" >>"${TMP_PATH}/opts" - done < <(lsblk -Jpno KNAME,SIZE,TYPE,MODEL 2>/dev/null | sed 's|null|"N/A"|g' | jq -r '.blockdevices[] | "\(.kname) \(.size) \(.type) \(.model)"' 2>/dev/null) + [ "${KNAME}" = "${LOADER_DISK}" ] || [ "${PKNAME}" = "${LOADER_DISK}" ] && continue + printf "\"%s\" \"%-6s %-4s %s\" \"off\"\n" "${KNAME}" "${SIZE}" "${TYPE}" "${MODEL}" >>"${TMP_PATH}/opts" + done < <(lsblk -Jpno KNAME,SIZE,TYPE,MODEL,PKNAME 2>/dev/null | sed 's|null|"N/A"|g' | jq -r '.blockdevices[] | "\(.kname) \(.size) \(.type) \(.model) \(.pkname)"' 2>/dev/null) if [ ! -f "${TMP_PATH}/opts" ]; then dialog --backtitle "$(backtitle)" --title "Format Disks" \ --msgbox "No disk found!" 0 0 @@ -1816,7 +1816,7 @@ function formatDisks() { [ $? -ne 0 ] && return if [ $(ls /dev/md[0-9]* 2>/dev/null | wc -l) -gt 0 ]; then dialog --backtitle "$(backtitle)" --title "Format Disks" \ - --yesno "Warning:\nThe current hds is in raid, do you still want to format them?" 0 0 + --yesno "Warning:\nThe current disks are in raid, do you still want to format them?" 0 0 [ $? -ne 0 ] && return for I in $(ls /dev/md[0-9]* 2>/dev/null); do mdadm -S "${I}" >/dev/null 2>&1 @@ -1839,12 +1839,12 @@ function formatDisks() { # Clone bootloader disk function cloneLoader() { rm -f "${TMP_PATH}/opts" - while read -r KNAME SIZE TYPE MODEL; do + while read -r KNAME SIZE TYPE MODEL PKNAME; do [ "${KNAME}" = "N/A" ] || [ "${SIZE:0:1}" = "0" ] && continue [ "${KNAME:0:7}" = "/dev/md" ] && continue - [ "${KNAME:0:8}" = "${LOADER_DISK}" ] && continue - printf "\"%s\" \"%-6s %-4s %s\" \"off\"\n" "${KNAME}" "${SIZE}" "${MODEL}" "${TYPE}" >>"${TMP_PATH}/opts" - done < <(lsblk -Jpno KNAME,SIZE,TYPE,MODEL 2>/dev/null | sed 's|null|"N/A"|g' | jq -r '.blockdevices[] | "\(.kname) \(.size) \(.type) \(.model)"' 2>/dev/null) + [ "${KNAME}" = "${LOADER_DISK}" ] || [ "${PKNAME}" = "${LOADER_DISK}" ] && continue + printf "\"%s\" \"%-6s %-4s %s\" \"off\"\n" "${KNAME}" "${SIZE}" "${TYPE}" "${MODEL}" >>"${TMP_PATH}/opts" + done < <(lsblk -Jpno KNAME,SIZE,TYPE,MODEL,PKNAME 2>/dev/null | sed 's|null|"N/A"|g' | jq -r '.blockdevices[] | "\(.kname) \(.size) \(.type) \(.model) \(.pkname)"' 2>/dev/null) if [ ! -f "${TMP_PATH}/opts" ]; then dialog --backtitle "$(backtitle)" --colors --title "Clone Loader" \ diff --git a/files/initrd/opt/arc/init.sh b/files/initrd/opt/arc/init.sh index 3ceb1702..99a02ceb 100755 --- a/files/initrd/opt/arc/init.sh +++ b/files/initrd/opt/arc/init.sh @@ -152,11 +152,7 @@ elif [ "${ARCMODE}" = "update" ]; then echo -e "\033[1;34mStarting Update Mode...\033[0m" elif [ "${BUILDDONE}" = "true" ] && [ "${ARCMODE}" = "dsm" ]; then echo -e "\033[1;34mStarting DSM Mode...\033[0m" - if [ -f "${ARC_PATH}/boot.sh" ]; then - exec boot.sh && exit 0 - else - echo -e "\033[1;31mError: Can't find Arc System Files...\033[0m" - fi + exec boot.sh else echo -e "\033[1;34mStarting Config Mode...\033[0m" fi From 74093f29b1c2dd0f997bcaed8b30bbd2f9167658 Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Fri, 29 Nov 2024 21:31:13 +0100 Subject: [PATCH 2/5] init/boot: fix Signed-off-by: AuxXxilium --- files/initrd/opt/arc/boot.sh | 1 - files/initrd/opt/arc/init.sh | 6 ++---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/files/initrd/opt/arc/boot.sh b/files/initrd/opt/arc/boot.sh index 340f4b39..c3379d9c 100755 --- a/files/initrd/opt/arc/boot.sh +++ b/files/initrd/opt/arc/boot.sh @@ -320,5 +320,4 @@ elif [ "${DIRECTBOOT}" = "false" ]; then echo -e "\033[1;37mBooting DSM...\033[0m" # Boot to DSM [ "${KERNELLOAD}" = "kexec" ] && kexec -e || poweroff - exit 0 fi \ No newline at end of file diff --git a/files/initrd/opt/arc/init.sh b/files/initrd/opt/arc/init.sh index 99a02ceb..6a6f66b0 100755 --- a/files/initrd/opt/arc/init.sh +++ b/files/initrd/opt/arc/init.sh @@ -216,7 +216,5 @@ RAM=$(awk '/MemTotal:/ {printf "%.0f", $2 / 1024}' /proc/meminfo 2>/dev/null) if [ ${RAM} -le 3500 ]; then echo -e "\033[1;31mYou have less than 4GB of RAM, if errors occur in loader creation, please increase the amount of RAM.\033[0m\n\033[1;31mUse arc.sh to proceed. Not recommended!\033[0m" else - arc.sh -fi - -exit 0 \ No newline at end of file + exec arc.sh +fi \ No newline at end of file From f6f86334ede8737eaf1b6558892c653f120a91c9 Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Fri, 29 Nov 2024 22:45:11 +0100 Subject: [PATCH 3/5] grub: fix Signed-off-by: AuxXxilium --- files/p1/boot/grub/grub.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/p1/boot/grub/grub.cfg b/files/p1/boot/grub/grub.cfg index 621ada99..d499aa7d 100644 --- a/files/p1/boot/grub/grub.cfg +++ b/files/p1/boot/grub/grub.cfg @@ -49,7 +49,7 @@ function load_video { load_video if loadfont unicode; then insmod gfxterm - set gfxmode=1024x768 + set gfxmode=auto set gfxpayload=auto terminal_output gfxterm insmod gfxmenu From 13fa3fc77176158a480de5e45523969ea0360832 Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Sat, 30 Nov 2024 02:20:33 +0100 Subject: [PATCH 4/5] tree: fix logic Signed-off-by: AuxXxilium --- files/initrd/opt/arc/boot.sh | 4 ++-- files/initrd/opt/arc/include/functions.sh | 2 +- files/initrd/opt/arc/include/network.sh | 7 +++---- files/initrd/opt/arc/init.sh | 4 ++-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/files/initrd/opt/arc/boot.sh b/files/initrd/opt/arc/boot.sh index c3379d9c..f91000e1 100755 --- a/files/initrd/opt/arc/boot.sh +++ b/files/initrd/opt/arc/boot.sh @@ -200,8 +200,8 @@ ETHN=$(echo ${ETHX} | wc -w) [ -z "${ETHM}" ] && ETHM="${ETHN}" NIC=0 for N in ${ETHX}; do - MAC="$(readConfigKey "${N}" "${USER_CONFIG_FILE}" | tr '[:lower:]' '[:upper:]')" - [ -z "${MAC}" ] && MAC="$(cat /sys/class/net/${N}/address 2>/dev/null | tr '[:lower:]' '[:upper:]')" || NIC=$((NIC + 1)) + MAC="$(readConfigKey "${N}" "${USER_CONFIG_FILE}")" + [ -z "${MAC}" ] && MAC="$(cat /sys/class/net/${N}/address 2>/dev/null | tr '[:upper:]' '[:lower:]')" || NIC=$((NIC + 1)) [ ${NIC} -le ${ETHM} ] && CMDLINE["mac${NIC}"]="${MAC}" [ ${NIC} -ge ${ETHM} ] && break done diff --git a/files/initrd/opt/arc/include/functions.sh b/files/initrd/opt/arc/include/functions.sh index 0d467322..fb0c18af 100755 --- a/files/initrd/opt/arc/include/functions.sh +++ b/files/initrd/opt/arc/include/functions.sh @@ -136,7 +136,7 @@ function generateMacAddress() { [ ${I} -lt ${NUM} ] && MACS+=" " done - MACS="$(echo "${MACS}" | tr '[:lower:]' '[:upper:]')" + MACS="$(echo "${MACS}" | tr '[:upper:]' '[:lower:]')" echo "${MACS}" return 0 } diff --git a/files/initrd/opt/arc/include/network.sh b/files/initrd/opt/arc/include/network.sh index 9439be70..3dabd9fe 100755 --- a/files/initrd/opt/arc/include/network.sh +++ b/files/initrd/opt/arc/include/network.sh @@ -21,15 +21,14 @@ function getnet() { # User Mac for N in ${ETHX}; do while true; do - MAC="$(cat /sys/class/net/${N}/address | sed 's/://g' | tr '[:lower:]' '[:upper:]')" dialog --backtitle "$(backtitle)" --title "Mac Setting" \ - --inputbox "Type a custom MAC for ${N} (Eq. 001132abc123)." 7 50 "${MAC}"\ + --inputbox "Type a custom MAC for ${N} (Eq. 001132a1b2c3).\nA custom Mac will not be applied to NIC!" 7 50\ 2>"${TMP_PATH}/resp" [ $? -ne 0 ] && break MAC=$(cat "${TMP_PATH}/resp") [ -z "${MAC}" ] && MAC="$(readConfigKey "${N}" "${USER_CONFIG_FILE}")" - [ -z "${MAC}" ] && MAC="$(cat /sys/class/net/${N}/address 2>/dev/null | sed 's/://g' | tr '[:lower:]' '[:upper:]')" - MAC="$(echo "${MAC}" | tr '[:lower:]' '[:upper:]')" + [ -z "${MAC}" ] && MAC="$(cat /sys/class/net/${N}/address 2>/dev/null | sed 's/://g' | tr '[:upper:]' '[:lower:]')" + MAC="$(echo "${MAC}" | tr '[:upper:]' '[:lower:]')" if [ ${#MAC} -eq 12 ]; then writeConfigKey "${N}" "${MAC}" "${USER_CONFIG_FILE}" break diff --git a/files/initrd/opt/arc/init.sh b/files/initrd/opt/arc/init.sh index 6a6f66b0..46187805 100755 --- a/files/initrd/opt/arc/init.sh +++ b/files/initrd/opt/arc/init.sh @@ -95,7 +95,7 @@ fi # Read/Write IP/Mac to config ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true for N in ${ETHX}; do - MACR="$(cat /sys/class/net/${N}/address 2>/dev/null | sed 's/://g')" + MACR="$(cat /sys/class/net/${N}/address 2>/dev/null | sed 's/://g' | tr '[:upper:]' '[:lower:]')" IPR="$(readConfigKey "network.${MACR}" "${USER_CONFIG_FILE}")" if [ -n "${IPR}" ] && [ "1" = "$(cat /sys/class/net/${N}/carrier 2>/dev/null)" ]; then IFS='/' read -r -a IPRA <<<"${IPR}" @@ -152,7 +152,7 @@ elif [ "${ARCMODE}" = "update" ]; then echo -e "\033[1;34mStarting Update Mode...\033[0m" elif [ "${BUILDDONE}" = "true" ] && [ "${ARCMODE}" = "dsm" ]; then echo -e "\033[1;34mStarting DSM Mode...\033[0m" - exec boot.sh + exec boot.sh && exit 0 else echo -e "\033[1;34mStarting Config Mode...\033[0m" fi From 65210543b7cf78318877b25b3acf4151acd228b0 Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Sat, 30 Nov 2024 20:17:44 +0100 Subject: [PATCH 5/5] tree: fix more logic Signed-off-by: AuxXxilium --- files/initrd/opt/arc/arc.sh | 5 ++--- files/initrd/opt/arc/include/update.sh | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/files/initrd/opt/arc/arc.sh b/files/initrd/opt/arc/arc.sh index 211b2b69..46fb911d 100755 --- a/files/initrd/opt/arc/arc.sh +++ b/files/initrd/opt/arc/arc.sh @@ -808,8 +808,7 @@ function boot() { dialog --backtitle "$(backtitle)" --title "Arc Boot" \ --infobox "Booting DSM...\nPlease stay patient!" 4 25 sleep 2 - clear - exec boot.sh + exec reboot fi } @@ -824,7 +823,7 @@ if [ "${ARCMODE}" = "update" ]; then dialog --backtitle "$(backtitle)" --title "Arc Update" \ --infobox "Update is not possible in Offline Mode!" 5 40 sleep 3 - reboot + exec reboot fi elif [ "${ARCMODE}" = "automated" ]; then # Check for Custom Build diff --git a/files/initrd/opt/arc/include/update.sh b/files/initrd/opt/arc/include/update.sh index 1b734eab..f8a6e3dc 100755 --- a/files/initrd/opt/arc/include/update.sh +++ b/files/initrd/opt/arc/include/update.sh @@ -76,13 +76,13 @@ function updateLoader() { --infobox "Update Loader successful! -> Reboot to automated Build Mode..." 3 60 sleep 3 writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}" - rebootTo "automated" + rebootTo automated else dialog --backtitle "$(backtitle)" --title "Update Loader" --aspect 18 \ --infobox "Update Loader successful! -> Reboot to Config Mode..." 3 50 sleep 3 writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}" - rebootTo "config" + rebootTo config fi }