From c4a6d4ccd32cf092f4c0c1a4a6ddd0b55f6b4dcf Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Fri, 31 Jan 2025 16:50:23 +0100 Subject: [PATCH] tree: rewrite menu function Signed-off-by: AuxXxilium --- files/initrd/opt/arc/arc.sh | 24 ++++++------ files/initrd/opt/arc/evo.sh | 46 +++++++++++------------ files/initrd/opt/arc/include/functions.sh | 2 +- 3 files changed, 36 insertions(+), 36 deletions(-) diff --git a/files/initrd/opt/arc/arc.sh b/files/initrd/opt/arc/arc.sh index e2b3dc9e..d1a28024 100755 --- a/files/initrd/opt/arc/arc.sh +++ b/files/initrd/opt/arc/arc.sh @@ -108,13 +108,13 @@ elif [ "${ARCMODE}" = "config" ]; then done if [ "${PLATFORM}" = "epyc7002" ]; then - write_menu_with_color "K" "Kernel" "${KERNEL}" + write_menu_value "K" "Kernel" "${KERNEL}" fi if [ "${DT}" = "true" ]; then - write_menu_with_color "H" "Hotplug/SortDrives" "${HDDSORT}" + write_menu_value "H" "Hotplug/SortDrives" "${HDDSORT}" else - write_menu_with_color "h" "USB as Internal" "${USBMOUNT}" + write_menu_value "h" "USB as Internal" "${USBMOUNT}" fi else write_menu "4" "\Z1Show Arc DSM Options\Zn" @@ -122,12 +122,12 @@ elif [ "${ARCMODE}" = "config" ]; then if [ "${BOOTOPTS}" = "true" ]; then write_menu "6" "\Z1Hide Boot Options\Zn" - write_menu_with_color "m" "Boot Kernelload" "${KERNELLOAD}" - write_menu_with_color "E" "eMMC Boot Support" "${EMMCBOOT}" + write_menu_value "m" "Boot Kernelload" "${KERNELLOAD}" + write_menu_value "E" "eMMC Boot Support" "${EMMCBOOT}" if [ "${DIRECTBOOT}" = "false" ]; then - write_menu_with_color "i" "Boot IP Waittime" "${BOOTIPWAIT}" + write_menu_value "i" "Boot IP Waittime" "${BOOTIPWAIT}" fi - write_menu_with_color "q" "Directboot" "${DIRECTBOOT}" + write_menu_value "q" "Directboot" "${DIRECTBOOT}" else write_menu "6" "\Z1Show Boot Options\Zn" fi @@ -143,7 +143,7 @@ elif [ "${ARCMODE}" = "config" ]; then write_menu "M" "Mount DSM Storage Pool" write_menu "l" "Edit User Config" write_menu "s" "Allow Downgrade Version" - write_menu_with_color "O" "Official Driver Priority" "${ODP}" + write_menu_value "O" "Official Driver Priority" "${ODP}" else write_menu "7" "\Z1Show DSM Options\Zn" fi @@ -151,7 +151,7 @@ elif [ "${ARCMODE}" = "config" ]; then if [ "${LOADEROPTS}" = "true" ]; then write_menu "8" "\Z1Hide Loader Options\Zn" - write_menu_with_color "c" "Offline Mode" "${ARCOFFLINE}" + write_menu_value "c" "Offline Mode" "${ARCOFFLINE}" write_menu "D" "StaticIP for Loader/DSM" write_menu "f" "Bootscreen Options" write_menu "U" "Change Loader Password" @@ -160,9 +160,9 @@ elif [ "${ARCMODE}" = "config" ]; then write_menu "L" "Grep Logs from dbgutils" write_menu "B" "Grep DSM Config from Backup" write_menu "=" "\Z1== Edit with caution! ==\Zn" - write_menu_with_color "W" "RD Compression" "${RD_COMPRESSED}" - write_menu_with_color "X" "Sata DOM" "${SATADOM}" - write_menu_with_color "u" "LKM Version" "${LKM}" + write_menu_value "W" "RD Compression" "${RD_COMPRESSED}" + write_menu_value "X" "Sata DOM" "${SATADOM}" + write_menu_value "u" "LKM Version" "${LKM}" write_menu "C" "Clone Loader to another Disk" write_menu "n" "Grub Bootloader Config" write_menu "y" "Choose a Keymap for Loader" diff --git a/files/initrd/opt/arc/evo.sh b/files/initrd/opt/arc/evo.sh index 67219682..b86ca8d2 100755 --- a/files/initrd/opt/arc/evo.sh +++ b/files/initrd/opt/arc/evo.sh @@ -44,15 +44,15 @@ function advancedMenu() { if [ "${CONFDONE}" = "true" ]; then if [ "${BOOTOPTS}" = "true" ]; then write_menu "6" "\Z1Hide Boot Options\Zn" - write_menu_with_color "m" "Kernelload" "${KERNELLOAD}" - write_menu_with_color "E" "eMMC Boot Support" "${EMMCBOOT}" + write_menu_value "m" "Kernelload" "${KERNELLOAD}" + write_menu_value "E" "eMMC Boot Support" "${EMMCBOOT}" if [ "${DIRECTBOOT}" = "false" ]; then - write_menu_with_color "i" "Boot IP Waittime" "${BOOTIPWAIT}" + write_menu_value "i" "Boot IP Waittime" "${BOOTIPWAIT}" fi - write_menu_with_color "q" "Directboot" "${DIRECTBOOT}" - write_menu_with_color "W" "RD Compression" "${RD_COMPRESSED}" - write_menu_with_color "X" "Sata DOM" "${SATADOM}" - write_menu_with_color "u" "LKM Version" "${LKM}" + write_menu_value "q" "Directboot" "${DIRECTBOOT}" + write_menu_value "W" "RD Compression" "${RD_COMPRESSED}" + write_menu_value "X" "Sata DOM" "${SATADOM}" + write_menu_value "u" "LKM Version" "${LKM}" else write_menu "6" "\Z1Show Boot Options\Zn" fi @@ -210,18 +210,18 @@ elif [ "${ARCMODE}" = "config" ]; then rm -f "${TMP_PATH}/menu" "${TMP_PATH}/resp" >/dev/null 2>&1 || true write_menu "=" "\Z4===== Main =====\Zn" if [ -z "${USERID}" ] && [ "${ARCOFFLINE}" = "false" ]; then - write_menu_with_color "0" "HardwareID" "${HARDWAREID}" + write_menu_value "0" "HardwareID" "${HARDWAREID}" fi - write_menu_with_color "1" "Model" "${MODEL}" + write_menu_value "1" "Model" "${MODEL}" if [ "${CONFDONE}" = "true" ]; then - write_menu_with_color "e" "Version" "${PRODUCTVER}" - write_menu_with_color "=" "DT" "${DT}" - write_menu_with_color "=" "Platform" "${PLATFORM}" + write_menu_value "e" "Version" "${PRODUCTVER}" + write_menu_value "=" "DT" "${DT}" + write_menu_value "=" "Platform" "${PLATFORM}" if [ -n "${USERID}" ] && [ "${ARCOFFLINE}" = "false" ]; then - write_menu_with_color "p" "Arc Patch" "${ARCPATCH}" + write_menu_value "p" "Arc Patch" "${ARCPATCH}" elif [ "${ARCOFFLINE}" = "false" ]; then write_menu "p" "Arc Patch: \Z4Register HardwareID first\Zn" else @@ -233,7 +233,7 @@ elif [ "${ARCMODE}" = "config" ]; then if [ ${CPUINFO} -gt 24 ]; then write_menu "=" "Custom Kernel should be used for this CPU" fi - write_menu_with_color "K" "Kernel" "${KERNEL}" + write_menu_value "K" "Kernel" "${KERNEL}" fi write_menu "b" "Addons" @@ -241,29 +241,29 @@ elif [ "${ARCMODE}" = "config" ]; then for addon in "cpufreqscaling" "storagepanel" "sequentialio"; do if readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "${addon}"; then case "${addon}" in - "cpufreqscaling") write_menu_with_color "g" "Scaling Governor" "${GOVERNOR}" ;; - "storagepanel") write_menu_with_color "P" "StoragePanel" "${STORAGEPANEL:-auto}" ;; - "sequentialio") write_menu_with_color "Q" "SequentialIO" "${SEQUENTIALIO}" ;; + "cpufreqscaling") write_menu_value "g" "Scaling Governor" "${GOVERNOR}" ;; + "storagepanel") write_menu_value "P" "StoragePanel" "${STORAGEPANEL:-auto}" ;; + "sequentialio") write_menu_value "Q" "SequentialIO" "${SEQUENTIALIO}" ;; esac fi done write_menu "d" "Modules" - write_menu_with_color "O" "Official Driver Priority" "${ODP}" + write_menu_value "O" "Official Driver Priority" "${ODP}" if [ "${DT}" = "false" ] && [ ${SATACONTROLLER} -gt 0 ]; then - write_menu_with_color "S" "PortMap" "${REMAP}" - write_menu_with_color "=" "Mapping" "${PORTMAP}" + write_menu_value "S" "PortMap" "${REMAP}" + write_menu_value "=" "Mapping" "${PORTMAP}" fi if [ "${DT}" = "true" ]; then - write_menu_with_color "H" "Hotplug/SortDrives" "${HDDSORT}" + write_menu_value "H" "Hotplug/SortDrives" "${HDDSORT}" else - write_menu_with_color "h" "USB as Internal" "${USBMOUNT}" + write_menu_value "h" "USB as Internal" "${USBMOUNT}" fi fi - write_menu_with_color "c" "Offline Mode" "${ARCOFFLINE}" + write_menu_value "c" "Offline Mode" "${ARCOFFLINE}" write_menu "9" "Advanced Options" write_menu "=" "\Z4===== Diag =====\Zn" write_menu "a" "Sysinfo" diff --git a/files/initrd/opt/arc/include/functions.sh b/files/initrd/opt/arc/include/functions.sh index 88612d96..d492239e 100755 --- a/files/initrd/opt/arc/include/functions.sh +++ b/files/initrd/opt/arc/include/functions.sh @@ -809,6 +809,6 @@ function write_menu() { echo "$1 \"$2\" " >>"${TMP_PATH}/menu" } -function write_menu_with_color() { +function write_menu_value() { echo "$1 \"$2: \Z4${3:-none}\Zn\" " >>"${TMP_PATH}/menu" } \ No newline at end of file