From b04c40c23cae7edcf80cb0297a21d3f3061b4b7e Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Sun, 4 Aug 2024 14:32:18 +0200 Subject: [PATCH] arc: if nondt and portmap user selected, check for config values Signed-off-by: AuxXxilium --- files/initrd/opt/arc/arc-functions.sh | 8 +++++++- files/initrd/opt/arc/arc.sh | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/files/initrd/opt/arc/arc-functions.sh b/files/initrd/opt/arc/arc-functions.sh index 46b91a13..5ebbd926 100755 --- a/files/initrd/opt/arc/arc-functions.sh +++ b/files/initrd/opt/arc/arc-functions.sh @@ -1128,7 +1128,7 @@ function sysinfo() { elif [ "${REMAP}" == "remap" ]; then PORTMAP="$(readConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}")" elif [ "${REMAP}" == "ahci" ]; then - PORTMAP="$(readConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}")" + AHCIPORTMAP="$(readConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}")" fi USERCMDLINEINFO="$(readConfigMap "cmdline" "${USER_CONFIG_FILE}")" USERSYNOINFO="$(readConfigMap "synoinfo" "${USER_CONFIG_FILE}")" @@ -1230,8 +1230,14 @@ function sysinfo() { TEXT+="\n SataPortMap | DiskIdxMap: \Zb${PORTMAP} | ${DISKMAP}\Zn" elif [ "${REMAP}" == "remap" ]; then TEXT+="\n SataRemap: \Zb${PORTMAP}\Zn" + elif [ "${REMAP}" == "ahci" ]; then + TEXT+="\n AhciRemap: \Zb${AHCIPORTMAP}\Zn" elif [ "${REMAP}" == "user" ]; then TEXT+="\n PortMap: \Zb"User"\Zn" + [ -n "${PORTMAP}" ] && TEXT+="\n SataPortmap: \Zb${PORTMAP}\Zn" + [ -n "${DISKMAP}" ] && TEXT+="\n DiskIdxMap: \Zb${DISKMAP}\Zn" + [ -n "${PORTREMAP}" ] && TEXT+="\n SataRemap: \Zb${PORTREMAP}\Zn" + [ -n "${AHCIPORTREMAP}" ] && TEXT+="\n AhciRemap: \Zb${AHCIPORTREMAP}\Zn" fi if [ "${DT}" == "true" ]; then TEXT+="\n Hotplug: \Zb${HDDSORT}\Zn" diff --git a/files/initrd/opt/arc/arc.sh b/files/initrd/opt/arc/arc.sh index 94c0cc74..555d3540 100755 --- a/files/initrd/opt/arc/arc.sh +++ b/files/initrd/opt/arc/arc.sh @@ -547,6 +547,13 @@ function arcSummary() { DISKMAP="$(readConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}")" elif [ "${REMAP}" == "remap" ]; then PORTREMAP="$(readConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}")" + elif [ "${REMAP}" == "ahci" ]; then + AHCIPORTREMAP="$(readConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}")" + else + PORTMAP="$(readConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}")" + DISKMAP="$(readConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}")" + PORTREMAP="$(readConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}")" + AHCIPORTREMAP="$(readConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}")" fi DIRECTBOOT="$(readConfigKey "directboot" "${USER_CONFIG_FILE}")" KERNELLOAD="$(readConfigKey "kernelload" "${USER_CONFIG_FILE}")" @@ -559,6 +566,12 @@ function arcSummary() { EMMCBOOT="$(readConfigKey "emmcboot" "${USER_CONFIG_FILE}")" OFFLINE="$(readConfigKey "arc.offline" "${USER_CONFIG_FILE}")" KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")" + if [ "${DT}" == "false" ] && [ "${REMAP}" == "user" ]; then + if [ -z "${PORTMAP}" ] && [ -z "${DISKMAP}"] && [ -z "${PORTREMAP}" ] && [ -z "${AHCIPORTREMAP}" ]; then + dialog --backtitle "$(backtitle)" --title "Arc Error" \ + --msgbox "ERROR: You selected Portmap: User and didn't set any values. -> Can't build Loader." 5 80 + return 1 + fi # Print Summary SUMMARY="\Z4> DSM Information\Zn" SUMMARY+="\n>> DSM Model: \Zb${MODEL}\Zn" @@ -573,6 +586,7 @@ function arcSummary() { [ -n "${PORTMAP}" ] && SUMMARY+="\n>> SataPortmap: \Zb${PORTMAP}\Zn" [ -n "${DISKMAP}" ] && SUMMARY+="\n>> DiskIdxMap: \Zb${DISKMAP}\Zn" [ -n "${PORTREMAP}" ] && SUMMARY+="\n>> SataRemap: \Zb${PORTREMAP}\Zn" + [ -n "${AHCIPORTREMAP}" ] && SUMMARY+="\n>> AhciRemap: \Zb${AHCIPORTREMAP}\Zn" [ "${DT}" == "true" ] && SUMMARY+="\n>> Sort Drives: \Zb${HDDSORT}\Zn" SUMMARY+="\n>> Offline Mode: \Zb${OFFLINE}\Zn" SUMMARY+="\n>> Directboot: \Zb${DIRECTBOOT}\Zn"