From 02d2b526ffcf7f8b22cba2d21eb0a95c00f10ef9 Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Sun, 17 Mar 2024 19:06:33 +0100 Subject: [PATCH] arc: logic rewrite Signed-off-by: AuxXxilium --- files/initrd/opt/arc/arc.sh | 1 + files/initrd/opt/arc/include/storage.sh | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/files/initrd/opt/arc/arc.sh b/files/initrd/opt/arc/arc.sh index 6ffdd296..7874f0d9 100755 --- a/files/initrd/opt/arc/arc.sh +++ b/files/initrd/opt/arc/arc.sh @@ -17,6 +17,7 @@ while read -r LINE; do RAMTOTAL=$((${RAMTOTAL} + ${RAMSIZE})) done < <(dmidecode -t memory | grep -i "Size" | cut -d" " -f2 | grep -i "[1-9]") RAMTOTAL=$((${RAMTOTAL} * 1024)) +[ -z "${RAMTOTAL}" ] || [ ${RAMTOTAL} -le 0 ] && RAMMAX=8192 RAMMAX=$((${RAMTOTAL} * 2)) RAMMIN=$((${RAMTOTAL} / 2)) diff --git a/files/initrd/opt/arc/include/storage.sh b/files/initrd/opt/arc/include/storage.sh index 8f94da67..a12532ba 100755 --- a/files/initrd/opt/arc/include/storage.sh +++ b/files/initrd/opt/arc/include/storage.sh @@ -109,13 +109,13 @@ function getmap() { # Disk Count for MaxDisks DRIVES=$((${SATADRIVES} + ${SASDRIVES} + ${SCSIDRIVES} + ${RAIDDRIVES} + ${USBDRIVES} + ${MMCDRIVES} + ${NVMEDRIVES})) HARDDRIVES=$((${SATADRIVES} + ${SASDRIVES} + ${SCSIDRIVES} + ${RAIDDRIVES} + ${NVMEDRIVES})) - [ ${SATADRIVES} -gt 0 ] && writeConfigKey "device.satadrives" "${SATADRIVES}" "${USER_CONFIG_FILE}" - [ ${SASDRIVES} -gt 0 ] && writeConfigKey "device.sasdrives" "${SASDRIVES}" "${USER_CONFIG_FILE}" - [ ${SCSIDRIVES} -gt 0 ] && writeConfigKey "device.scsidrives" "${SCSIDRIVES}" "${USER_CONFIG_FILE}" - [ ${RAIDDRIVES} -gt 0 ] && writeConfigKey "device.raiddrives" "${RAIDDRIVES}" "${USER_CONFIG_FILE}" - [ ${USBDRIVES} -gt 0 ] && writeConfigKey "device.usbdrives" "${USBDRIVES}" "${USER_CONFIG_FILE}" - [ ${MMCDRIVES} -gt 0 ] && writeConfigKey "device.mmcdrives" "${MMCDRIVES}" "${USER_CONFIG_FILE}" - [ ${NVMEDRIVES} -gt 0 ] && writeConfigKey "device.nvmedrives" "${NVMEDRIVES}" "${USER_CONFIG_FILE}" + writeConfigKey "device.satadrives" "${SATADRIVES}" "${USER_CONFIG_FILE}" + writeConfigKey "device.sasdrives" "${SASDRIVES}" "${USER_CONFIG_FILE}" + writeConfigKey "device.scsidrives" "${SCSIDRIVES}" "${USER_CONFIG_FILE}" + writeConfigKey "device.raiddrives" "${RAIDDRIVES}" "${USER_CONFIG_FILE}" + writeConfigKey "device.usbdrives" "${USBDRIVES}" "${USER_CONFIG_FILE}" + writeConfigKey "device.mmcdrives" "${MMCDRIVES}" "${USER_CONFIG_FILE}" + writeConfigKey "device.nvmedrives" "${NVMEDRIVES}" "${USER_CONFIG_FILE}" writeConfigKey "device.drives" "${DRIVES}" "${USER_CONFIG_FILE}" writeConfigKey "device.harddrives" "${HARDDRIVES}" "${USER_CONFIG_FILE}" }