storage: fix remap option

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2024-04-19 15:33:03 +02:00
parent b062cd98d2
commit e720a5c8fa

View File

@ -106,22 +106,6 @@ function getmap() {
NVMEDRIVES=$((${NVMEDRIVES} + ${PORTNUM}))
done
fi
# Check for Sata Boot
LASTDRIVE=0
while read -r LINE; do
if [[ "${BUS}" != "usb" && ${LINE} -eq 0 && "${LOADER_DISK}" = "/dev/sda" ]]; then
MAXDISKS="$(readModelKey "${MODEL}" "disks")"
if [ ${MAXDISKS} -lt ${DRIVES} ]; then
MAXDISKS=${DRIVES}
fi
echo -n "${LINE}>${MAXDISKS}:">>"${TMP_PATH}/remap"
elif [ ! ${LINE} = ${LASTDRIVE} ]; then
echo -n "${LINE}>${LASTDRIVE}:">>"${TMP_PATH}/remap"
LASTDRIVE=$((${LASTDRIVE} + 1))
elif [ ${LINE} = ${LASTDRIVE} ]; then
LASTDRIVE=$((${LINE} + 1))
fi
done <<<$(cat "${TMP_PATH}/ports")
# Disk Count for MaxDisks
DRIVES=$((${SATADRIVES} + ${SASDRIVES} + ${SCSIDRIVES} + ${RAIDDRIVES} + ${USBDRIVES} + ${MMCDRIVES} + ${NVMEDRIVES}))
HARDDRIVES=$((${SATADRIVES} + ${SASDRIVES} + ${SCSIDRIVES} + ${RAIDDRIVES} + ${NVMEDRIVES}))
@ -134,6 +118,22 @@ function getmap() {
writeConfigKey "device.nvmedrives" "${NVMEDRIVES}" "${USER_CONFIG_FILE}"
writeConfigKey "device.drives" "${DRIVES}" "${USER_CONFIG_FILE}"
writeConfigKey "device.harddrives" "${HARDDRIVES}" "${USER_CONFIG_FILE}"
# Check for Sata Boot
LASTDRIVE=0
while read -r LINE; do
if [[ "${BUS}" != "usb" && ${LINE} -eq 0 ]]; then
MAXDISKS="$(readModelKey "${MODEL}" "disks")"
if [ ${MAXDISKS} -lt ${DRIVES} ]; then
MAXDISKS=${DRIVES}
fi
echo -n "${LINE}>${MAXDISKS}:">>"${TMP_PATH}/remap"
elif [ ! ${LINE} = ${LASTDRIVE} ]; then
echo -n "${LINE}>${LASTDRIVE}:">>"${TMP_PATH}/remap"
LASTDRIVE=$((${LASTDRIVE} + 1))
elif [ ${LINE} = ${LASTDRIVE} ]; then
LASTDRIVE=$((${LINE} + 1))
fi
done <<<$(cat "${TMP_PATH}/ports")
}
function getmapSelection() {