Skip to content

Commit 447b7fb

Browse files
authored
Merge pull request #7474 from AuxXxilium/dev
tree: update logic
2 parents dbf53ce + fccfb89 commit 447b7fb

File tree

4 files changed

+117
-91
lines changed

4 files changed

+117
-91
lines changed

files/initrd/opt/arc/arc-functions.sh

Lines changed: 112 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -705,21 +705,21 @@ function addonSelection() {
705705
[ -n "${KEY}" ] && ADDONS["${KEY}"]="${VALUE}"
706706
done < <(readConfigMap "addons" "${USER_CONFIG_FILE}")
707707

708-
rm -f "${TMP_PATH}/resp"
709-
touch "${TMP_PATH}/resp"
708+
rm -f "${TMP_PATH}/opts"
709+
touch "${TMP_PATH}/opts"
710710

711711
while read -r ADDON DESC; do
712712
arrayExistItem "${ADDON}" "${!ADDONS[@]}" && ACT="on" || ACT="off"
713713
if { [[ "${ADDON}" = "amepatch" || "${ADDON}" = "arcdns" ]] && [ -z "${ARC_CONF}" ]; } || { [ "${ADDON}" = "codecpatch" ] && [ -n "${ARC_CONF}" ]; }; then
714714
continue
715715
else
716-
echo -e "${ADDON} \"${DESC}\" ${ACT}" >>"${TMP_PATH}/resp"
716+
echo -e "${ADDON} \"${DESC}\" ${ACT}" >>"${TMP_PATH}/opts"
717717
fi
718718
done < <(availableAddons "${PLATFORM}")
719719

720720
dialog --backtitle "$(backtitle)" --title "Addons" --colors --aspect 18 \
721721
--checklist "Select Addons to include.\nAddons: \Z1System Addon\Zn | \Z4App Addon\Zn\nSelect with SPACE, Confirm with ENTER!" 0 0 0 \
722-
--file "${TMP_PATH}/resp" 2>"${TMP_PATH}/resp"
722+
--file "${TMP_PATH}/opts" 2>"${TMP_PATH}/resp"
723723
[ $? -ne 0 ] && return 1
724724
resp="$(cat "${TMP_PATH}/resp" 2>/dev/null)"
725725

@@ -769,16 +769,16 @@ function modulesMenu() {
769769
while IFS=': ' read -r KEY VALUE; do
770770
[ -n "${KEY}" ] && USERMODULES["${KEY}"]="${VALUE}"
771771
done < <(readConfigMap "modules" "${USER_CONFIG_FILE}")
772-
rm -f "${TMP_PATH}/resp"
772+
rm -f "${TMP_PATH}/opts"
773773
while read -r ID DESC; do
774774
arrayExistItem "${ID}" "${!USERMODULES[@]}" && ACT="on" || ACT="off"
775-
echo "${ID} ${DESC} ${ACT}" >>"${TMP_PATH}/resp"
775+
echo "${ID} ${DESC} ${ACT}" >>"${TMP_PATH}/opts"
776776
done <<<${ALLMODULES}
777777
dialog --backtitle "$(backtitle)" --title "Modules" \
778778
--cancel-label "Exit" \
779779
--extra-button --extra-label "Select all" \
780780
--help-button --help-label "Deselect all" \
781-
--checklist "Select Modules to include" 0 0 0 --file "${TMP_PATH}/resp" \
781+
--checklist "Select Modules to include" 0 0 0 --file "${TMP_PATH}/opts" \
782782
2>"${TMP_PATH}/resp"
783783
RET=$?
784784
case ${RET} in
@@ -1128,12 +1128,12 @@ function cmdlineMenu() {
11281128
;;
11291129
7)
11301130
while true; do
1131-
rm -f "${TMP_PATH}/resp" >/dev/null
1132-
echo "5 \"Reboot after 5 seconds\"" >>"${TMP_PATH}/resp"
1133-
echo "0 \"No reboot\"" >>"${TMP_PATH}/resp"
1134-
echo "-1 \"Restart immediately\"" >>"${TMP_PATH}/resp"
1131+
rm -f "${TMP_PATH}/opts" >/dev/null
1132+
echo "5 \"Reboot after 5 seconds\"" >>"${TMP_PATH}/opts"
1133+
echo "0 \"No reboot\"" >>"${TMP_PATH}/opts"
1134+
echo "-1 \"Restart immediately\"" >>"${TMP_PATH}/opts"
11351135
dialog --backtitle "$(backtitle)" --colors --title "Kernelpanic" \
1136-
--default-item "${KERNELPANIC}" --menu "Choose a time(seconds)" 0 0 0 --file "${TMP_PATH}/resp" \
1136+
--default-item "${KERNELPANIC}" --menu "Choose a time(seconds)" 0 0 0 --file "${TMP_PATH}/opts" \
11371137
2>"${TMP_PATH}/resp"
11381138
[ $? -ne 0 ] && break
11391139
resp="$(cat "${TMP_PATH}/resp" 2>/dev/null)"
@@ -1222,12 +1222,12 @@ function synoinfoMenu() {
12221222
--msgbox "No synoinfo entries to remove" 0 0
12231223
continue
12241224
fi
1225-
rm -f "${TMP_PATH}/resp"
1225+
rm -f "${TMP_PATH}/opts"
12261226
for I in ${!SYNOINFO[@]}; do
1227-
echo "\"${I}\" \"${SYNOINFO[${I}]}\" \"off\"" >>"${TMP_PATH}/resp"
1227+
echo "\"${I}\" \"${SYNOINFO[${I}]}\" \"off\"" >>"${TMP_PATH}/opts"
12281228
done
12291229
dialog --backtitle "$(backtitle)" --title "Synoinfo" \
1230-
--checklist "Select synoinfo entry to remove" 0 0 0 --file "${TMP_PATH}/resp" \
1230+
--checklist "Select synoinfo entry to remove" 0 0 0 --file "${TMP_PATH}/opts" \
12311231
2>"${TMP_PATH}/resp"
12321232
[ $? -ne 0 ] && continue
12331233
resp="$(cat "${TMP_PATH}/resp" 2>/dev/null)"
@@ -1504,9 +1504,9 @@ function updateMenu() {
15041504
2 "Beta ${BETATAG}" \
15051505
3 "Select Version" \
15061506
4 "Upload .zip File" \
1507-
2>"${TMP_PATH}/resp"
1507+
2>"${TMP_PATH}/opts"
15081508
[ $? -ne 0 ] && break
1509-
opts="$(cat "${TMP_PATH}/resp")"
1509+
opts="$(cat "${TMP_PATH}/opts")"
15101510
if [ "${opts}" -eq 1 ]; then
15111511
[ -z "${TAG}" ] && return 1
15121512
updateLoader "${TAG}"
@@ -2500,20 +2500,20 @@ function bootipwaittime() {
25002500
###############################################################################
25012501
# let user format disks from inside arc
25022502
function formatDisks() {
2503-
rm -f "${TMP_PATH}/resp"
2503+
rm -f "${TMP_PATH}/opts"
25042504
while read -r KNAME SIZE TYPE DMODEL PKNAME; do
25052505
[ "${KNAME}" = "N/A" ] || [ "${SIZE:0:1}" = "0" ] && continue
25062506
[ "${KNAME:0:7}" = "/dev/md" ] && continue
25072507
[ "${KNAME}" = "${LOADER_DISK}" ] || [ "${PKNAME}" = "${LOADER_DISK}" ] && continue
2508-
printf "\"%s\" \"%-6s %-4s %s\" \"off\"\n" "${KNAME}" "${SIZE}" "${TYPE}" "${DMODEL}" >>"${TMP_PATH}/resp"
2508+
printf "\"%s\" \"%-6s %-4s %s\" \"off\"\n" "${KNAME}" "${SIZE}" "${TYPE}" "${DMODEL}" >>"${TMP_PATH}/opts"
25092509
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)
2510-
if [ ! -f "${TMP_PATH}/resp" ]; then
2510+
if [ ! -f "${TMP_PATH}/opts" ]; then
25112511
dialog --backtitle "$(backtitle)" --title "Format Disks" \
25122512
--msgbox "No disk found!" 0 0
25132513
return
25142514
fi
25152515
dialog --backtitle "$(backtitle)" --title "Format Disks" \
2516-
--checklist "Select Disks" 0 0 0 --file "${TMP_PATH}/resp" \
2516+
--checklist "Select Disks" 0 0 0 --file "${TMP_PATH}/opts" \
25172517
2>"${TMP_PATH}/resp"
25182518
[ $? -ne 0 ] && return
25192519
resp="$(cat "${TMP_PATH}/resp" 2>/dev/null)"
@@ -2546,21 +2546,21 @@ function formatDisks() {
25462546
###############################################################################
25472547
# Clone bootloader disk
25482548
function cloneLoader() {
2549-
rm -f "${TMP_PATH}/resp" 2>/dev/null
2549+
rm -f "${TMP_PATH}/opts" 2>/dev/null
25502550
while read -r KNAME SIZE TYPE DMODEL PKNAME; do
25512551
[ "${KNAME}" = "N/A" ] || [ "${SIZE:0:1}" = "0" ] && continue
25522552
[ "${KNAME:0:7}" = "/dev/md" ] && continue
25532553
[ "${KNAME}" = "${LOADER_DISK}" ] || [ "${PKNAME}" = "${LOADER_DISK}" ] && continue
2554-
printf "\"%s\" \"%-6s %-4s %s\" \"off\"\n" "${KNAME}" "${SIZE}" "${TYPE}" "${DMODEL}" >>"${TMP_PATH}/resp"
2554+
printf "\"%s\" \"%-6s %-4s %s\" \"off\"\n" "${KNAME}" "${SIZE}" "${TYPE}" "${DMODEL}" >>"${TMP_PATH}/opts"
25552555
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)
25562556

2557-
if [ ! -f "${TMP_PATH}/resp" ]; then
2557+
if [ ! -f "${TMP_PATH}/opts" ]; then
25582558
dialog --backtitle "$(backtitle)" --colors --title "Clone Loader" \
25592559
--msgbox "No disk found!" 0 0
25602560
return
25612561
fi
25622562
dialog --backtitle "$(backtitle)" --colors --title "Clone Loader" \
2563-
--radiolist "Choose a Destination" 0 0 0 --file "${TMP_PATH}/resp" \
2563+
--radiolist "Choose a Destination" 0 0 0 --file "${TMP_PATH}/opts" \
25642564
2>"${TMP_PATH}/resp"
25652565
[ $? -ne 0 ] && return
25662566
resp="$(cat "${TMP_PATH}/resp" 2>/dev/null)"
@@ -2778,12 +2778,12 @@ function getbackup() {
27782778
###############################################################################
27792779
# SataDOM Menu
27802780
function satadomMenu() {
2781-
rm -f "${TMP_PATH}/resp" 2>/dev/null
2782-
echo "0 \"Create SATA node(ARC)\"" >>"${TMP_PATH}/resp"
2783-
echo "1 \"Native SATA Disk(SYNO)\"" >>"${TMP_PATH}/resp"
2784-
echo "2 \"Fake SATA DOM(Redpill)\"" >>"${TMP_PATH}/resp"
2781+
rm -f "${TMP_PATH}/opts" 2>/dev/null
2782+
echo "0 \"Create SATA node(ARC)\"" >>"${TMP_PATH}/opts"
2783+
echo "1 \"Native SATA Disk(SYNO)\"" >>"${TMP_PATH}/opts"
2784+
echo "2 \"Fake SATA DOM(Redpill)\"" >>"${TMP_PATH}/opts"
27852785
dialog --backtitle "$(backtitle)" --title "Switch SATA DOM" \
2786-
--default-item "${SATADOM}" --menu "Choose an Option" 0 0 0 --file "${TMP_PATH}/resp" \
2786+
--default-item "${SATADOM}" --menu "Choose an Option" 0 0 0 --file "${TMP_PATH}/opts" \
27872787
2>"${TMP_PATH}/resp"
27882788
[ $? -ne 0 ] && return
27892789
resp="$(cat "${TMP_PATH}/resp" 2>/dev/null)"
@@ -2799,21 +2799,21 @@ function satadomMenu() {
27992799
# Reboot Menu
28002800
function rebootMenu() {
28012801
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
2802-
rm -f "${TMP_PATH}/resp" >/dev/null
2803-
touch "${TMP_PATH}/resp"
2802+
rm -f "${TMP_PATH}/opts" >/dev/null
2803+
touch "${TMP_PATH}/opts"
28042804
# Selectable Reboot Options
2805-
echo -e "config \"Arc: Config Mode\"" >>"${TMP_PATH}/resp"
2806-
echo -e "update \"Arc: Automated Update Mode\"" >>"${TMP_PATH}/resp"
2807-
echo -e "network \"Arc: Restart Network Service\"" >>"${TMP_PATH}/resp"
2805+
echo -e "config \"Arc: Config Mode\"" >>"${TMP_PATH}/opts"
2806+
echo -e "update \"Arc: Automated Update Mode\"" >>"${TMP_PATH}/opts"
2807+
echo -e "network \"Arc: Restart Network Service\"" >>"${TMP_PATH}/opts"
28082808
if [ "${BUILDDONE}" = "true" ]; then
2809-
echo -e "recovery \"DSM: Recovery Mode\"" >>"${TMP_PATH}/resp"
2810-
echo -e "junior \"DSM: Reinstall Mode\"" >>"${TMP_PATH}/resp"
2809+
echo -e "recovery \"DSM: Recovery Mode\"" >>"${TMP_PATH}/opts"
2810+
echo -e "junior \"DSM: Reinstall Mode\"" >>"${TMP_PATH}/opts"
28112811
fi
2812-
echo -e "uefi \"System: UEFI\"" >>"${TMP_PATH}/resp"
2813-
echo -e "poweroff \"System: Shutdown\"" >>"${TMP_PATH}/resp"
2814-
echo -e "shell \"System: Shell Cmdline\"" >>"${TMP_PATH}/resp"
2812+
echo -e "uefi \"System: UEFI\"" >>"${TMP_PATH}/opts"
2813+
echo -e "poweroff \"System: Shutdown\"" >>"${TMP_PATH}/opts"
2814+
echo -e "shell \"System: Shell Cmdline\"" >>"${TMP_PATH}/opts"
28152815
dialog --backtitle "$(backtitle)" --title "Power Menu" \
2816-
--menu "Choose a Destination" 0 0 0 --file "${TMP_PATH}/resp" \
2816+
--menu "Choose a Destination" 0 0 0 --file "${TMP_PATH}/opts" \
28172817
2>"${TMP_PATH}/resp"
28182818
[ $? -ne 0 ] && return
28192819
resp="$(cat "${TMP_PATH}/resp" 2>/dev/null)"
@@ -2916,16 +2916,16 @@ function governorMenu () {
29162916
}
29172917

29182918
function governorSelection () {
2919-
rm -f "${TMP_PATH}/resp" >/dev/null
2920-
touch "${TMP_PATH}/resp"
2919+
rm -f "${TMP_PATH}/opts" >/dev/null
2920+
touch "${TMP_PATH}/opts"
29212921
# Selectable CPU governors
2922-
[ "${KVER:0:1}" = "5" ] && echo -e "schedutil \"use schedutil to scale frequency *\"" >>"${TMP_PATH}/resp"
2923-
[ "${KVER:0:1}" = "4" ] && echo -e "conservative \"use conservative to scale frequency *\"" >>"${TMP_PATH}/resp"
2924-
[ "${KVER:0:1}" = "4" ] && echo -e "ondemand \"use ondemand to scale frequency\"" >>"${TMP_PATH}/resp"
2925-
echo -e "performance \"always run at max frequency\"" >>"${TMP_PATH}/resp"
2926-
echo -e "powersave \"always run at lowest frequency\"" >>"${TMP_PATH}/resp"
2922+
[ "${KVER:0:1}" = "5" ] && echo -e "schedutil \"use schedutil to scale frequency *\"" >>"${TMP_PATH}/opts"
2923+
[ "${KVER:0:1}" = "4" ] && echo -e "conservative \"use conservative to scale frequency *\"" >>"${TMP_PATH}/opts"
2924+
[ "${KVER:0:1}" = "4" ] && echo -e "ondemand \"use ondemand to scale frequency\"" >>"${TMP_PATH}/opts"
2925+
echo -e "performance \"always run at max frequency\"" >>"${TMP_PATH}/opts"
2926+
echo -e "powersave \"always run at lowest frequency\"" >>"${TMP_PATH}/opts"
29272927
dialog --backtitle "$(backtitle)" --title "CPU Frequency Scaling" \
2928-
--menu "Choose a Governor\n* Recommended Option" 0 0 0 --file "${TMP_PATH}/resp" \
2928+
--menu "Choose a Governor\n* Recommended Option" 0 0 0 --file "${TMP_PATH}/opts" \
29292929
2>"${TMP_PATH}/resp"
29302930
[ $? -ne 0 ] && return
29312931
resp="$(cat "${TMP_PATH}/resp" 2>/dev/null)"
@@ -3143,7 +3143,7 @@ function checkHardwareID() {
31433143
###############################################################################
31443144
# Bootsreen Menu
31453145
function bootScreen () {
3146-
rm -f "${TMP_PATH}/bootscreen" "${TMP_PATH}/resp" "${TMP_PATH}/resp" >/dev/null
3146+
rm -f "${TMP_PATH}/bootscreen" "${TMP_PATH}/opts" "${TMP_PATH}/resp" >/dev/null
31473147
unset BOOTSCREENS
31483148
declare -A BOOTSCREENS
31493149
while IFS=': ' read -r KEY VALUE; do
@@ -3162,11 +3162,11 @@ EOL
31623162
else
31633163
ACT="off"
31643164
fi
3165-
echo -e "${BOOTSCREEN} \"${BOOTDESCRIPTION}\" ${ACT}" >>"${TMP_PATH}/resp"
3165+
echo -e "${BOOTSCREEN} \"${BOOTDESCRIPTION}\" ${ACT}" >>"${TMP_PATH}/opts"
31663166
done < "${TMP_PATH}/bootscreen"
31673167
dialog --backtitle "$(backtitle)" --title "Bootscreen" --colors --aspect 18 \
31683168
--checklist "Select Bootscreen Informations\Zn\nSelect with SPACE, Confirm with ENTER!" 0 0 0 \
3169-
--file "${TMP_PATH}/resp" 2>"${TMP_PATH}/resp"
3169+
--file "${TMP_PATH}/opts" 2>"${TMP_PATH}/resp"
31703170
[ $? -ne 0 ] && return 1
31713171
resp="$(cat "${TMP_PATH}/resp" 2>/dev/null)"
31723172
for BOOTSCREEN in dsminfo systeminfo diskinfo hwidinfo dsmlogo; do
@@ -3218,32 +3218,12 @@ function getnet() {
32183218
# Generate PortMap
32193219
function getmap() {
32203220
SATADRIVES=0
3221-
SASDRIVES=0
3222-
SCSIDRIVES=0
3223-
RAIDDRIVES=0
3224-
NVMEDRIVES=0
3225-
USBDRIVES=0
3226-
MMCDRIVES=0
32273221

32283222
# Clean old files
32293223
for file in drivesmax drivescon ports remap; do
32303224
> "${TMP_PATH}/${file}"
32313225
done
32323226

3233-
# Helper function to process PCI devices
3234-
function process_pci_devices() {
3235-
local pci_class=$1
3236-
local device_path=$2
3237-
local count_var=$3
3238-
local port_filter=$4
3239-
3240-
for PCI in $(lspci -d ::${pci_class} 2>/dev/null | awk '{print $1}'); do
3241-
local PORTS=$(ls -l /sys/class/${device_path} | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n)
3242-
local PORTNUM=$(lsscsi -b | grep -v - | grep "${port_filter}" | wc -l)
3243-
eval "${count_var}=$(( ${!count_var} + PORTNUM ))"
3244-
done
3245-
}
3246-
32473227
# Process SATA Disks
32483228
if [ $(lspci -d ::106 | wc -l) -gt 0 ]; then
32493229
let DISKIDXMAPIDX=0
@@ -3279,35 +3259,82 @@ function getmap() {
32793259
done
32803260
fi
32813261

3282-
# Process Other Disk Types
3283-
process_pci_devices 107 "scsi_host" SASDRIVES "\[${PORT}:"
3284-
process_pci_devices 100 "scsi_host" SCSIDRIVES "\[${PORT}:"
3285-
process_pci_devices 104 "scsi_host" RAIDDRIVES "\[${PORT}:"
3286-
process_pci_devices c03 "scsi_host" USBDRIVES "\[${PORT}:"
3287-
32883262
# Process NVMe Disks
3289-
if [ $(ls -l /sys/class/nvme 2>/dev/null | wc -l) -gt 0 ]; then
3263+
NVMEDRIVES=0
3264+
if [ $(lspci -d ::108 2>/dev/null | wc -l) -gt 0 ]; then
32903265
for PCI in $(lspci -d ::108 2>/dev/null | awk '{print $1}'); do
3291-
local PORTNUM=$(ls -l /sys/class/nvme | grep "${PCI}" | wc -l 2>/dev/null)
3292-
[ "${PORTNUM}" -eq 0 ] && continue
3266+
NAME=$(lspci -s "${PCI}" 2>/dev/null | sed "s/\ .*://")
3267+
PORT=$(ls -l /sys/class/nvme 2>/dev/null | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/nvme//' | sort -n)
3268+
PORTNUM=$(lsscsi -bS 2>/dev/null | awk '$3 != "0"' | grep -v - | grep "\[N:${PORT}:" | wc -l)
32933269
NVMEDRIVES=$((NVMEDRIVES + PORTNUM))
32943270
done
3271+
writeConfigKey "device.nvmedrives" "${NVMEDRIVES}" "${USER_CONFIG_FILE}"
32953272
fi
32963273

32973274
# Process MMC Disks
3298-
if [ $(ls -l /sys/block/mmc* 2>/dev/null | wc -l) -gt 0 ]; then
3275+
MMCDRIVES=0
3276+
if [ $(lspci -d ::805 2>/dev/null | wc -l) -gt 0 ]; then
32993277
for PCI in $(lspci -d ::805 2>/dev/null | awk '{print $1}'); do
3300-
local PORTNUM=$(ls -l /sys/block/mmc* | grep "${PCI}" | wc -l 2>/dev/null)
3301-
[ "${PORTNUM}" -eq 0 ] && continue
3278+
NAME=$(lspci -s "${PCI}" 2>/dev/null | sed "s/\ .*://")
3279+
PORT=$(ls -l /sys/block/mmc* 2>/dev/null | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/mmcblk//' | sort -n)
3280+
PORTNUM=$(lsscsi -bS 2>/dev/null | awk '$3 != "0"' | grep -v - | grep "\[M:${PORT}:" | wc -l)
33023281
MMCDRIVES=$((MMCDRIVES + PORTNUM))
33033282
done
3283+
writeConfigKey "device.mmcdrives" "${MMCDRIVES}" "${USER_CONFIG_FILE}"
3284+
fi
3285+
3286+
# Process SAS Disks
3287+
SASDRIVES=0
3288+
if [ $(lspci -d ::107 2>/dev/null | wc -l) -gt 0 ]; then
3289+
for PCI in $(lspci -d ::107 2>/dev/null | awk '{print $1}'); do
3290+
NAME=$(lspci -s "${PCI}" 2>/dev/null | sed "s/\ .*://")
3291+
PORT=$(ls -l /sys/class/scsi_host 2>/dev/null | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n)
3292+
PORTNUM=$(lsscsi -bS 2>/dev/null | awk '$3 != "0"' | grep -v - | grep "\[${PORT}:" | wc -l)
3293+
SASDRIVES=$((SASDRIVES + PORTNUM))
3294+
done
3295+
writeConfigKey "device.sasdrives" "${SASDRIVES}" "${USER_CONFIG_FILE}"
3296+
fi
3297+
3298+
# Process SCSI Disks
3299+
SCSIDRIVES=0
3300+
if [ $(lspci -d ::100 2>/dev/null | wc -l) -gt 0 ]; then
3301+
for PCI in $(lspci -d ::100 2>/dev/null | awk '{print $1}'); do
3302+
NAME=$(lspci -s "${PCI}" 2>/dev/null | sed "s/\ .*://")
3303+
PORT=$(ls -l /sys/class/scsi_host 2>/dev/null | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n)
3304+
PORTNUM=$(lsscsi -bS 2>/dev/null | awk '$3 != "0"' | grep -v - | grep "\[${PORT}:" | wc -l)
3305+
SCSIDRIVES=$((SCSIDRIVES + PORTNUM))
3306+
done
3307+
writeConfigKey "device.scsidrives" "${SCSIDRIVES}" "${USER_CONFIG_FILE}"
3308+
fi
3309+
3310+
# Process RAID Disks
3311+
RAIDDRIVES=0
3312+
if [ $(lspci -d ::104 2>/dev/null | wc -l) -gt 0 ]; then
3313+
for PCI in $(lspci -d ::104 2>/dev/null | awk '{print $1}'); do
3314+
NAME=$(lspci -s "${PCI}" 2>/dev/null | sed "s/\ .*://")
3315+
PORT=$(ls -l /sys/class/scsi_host 2>/dev/null | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n)
3316+
PORTNUM=$(lsscsi -bS 2>/dev/null | awk '$3 != "0"' | grep -v - | grep "\[${PORT}:" | wc -l)
3317+
RAIDDRIVES=$((RAIDDRIVES + PORTNUM))
3318+
done
3319+
writeConfigKey "device.raiddrives" "${RAIDDRIVES}" "${USER_CONFIG_FILE}"
3320+
fi
3321+
3322+
# Process USB Disks
3323+
USBDRIVES=0
3324+
if [ $(lspci -d ::c03 2>/dev/null | wc -l) -gt 0 ]; then
3325+
for PCI in $(lspci -d ::c03 2>/dev/null | awk '{print $1}'); do
3326+
NAME=$(lspci -s "${PCI}" 2>/dev/null | sed "s/\ .*://")
3327+
PORT=$(ls -l /sys/class/scsi_host 2>/dev/null | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n)
3328+
PORTNUM=$(lsscsi -bS 2>/dev/null | awk '$3 != "0"' | grep -v - | grep "\[${PORT}:" | wc -l)
3329+
USBDRIVES=$((USBDRIVES + PORTNUM))
3330+
done
3331+
writeConfigKey "device.usbdrives" "${USBDRIVES}" "${USER_CONFIG_FILE}"
33043332
fi
33053333

33063334
# Write Disk Counts to Config
33073335
DRIVES=$((SATADRIVES + SASDRIVES + SCSIDRIVES + RAIDDRIVES + USBDRIVES + MMCDRIVES + NVMEDRIVES))
33083336
HARDDRIVES=$((SATADRIVES + SASDRIVES + SCSIDRIVES + RAIDDRIVES + NVMEDRIVES))
33093337
writeConfigKey "device.satadrives" "${SATADRIVES}" "${USER_CONFIG_FILE}"
3310-
writeConfigKey "device.sasdrives" "${SASDRIVES}" "${USER_CONFIG_FILE}"
33113338
writeConfigKey "device.scsidrives" "${SCSIDRIVES}" "${USER_CONFIG_FILE}"
33123339
writeConfigKey "device.raiddrives" "${RAIDDRIVES}" "${USER_CONFIG_FILE}"
33133340
writeConfigKey "device.usbdrives" "${USBDRIVES}" "${USER_CONFIG_FILE}"

files/initrd/opt/arc/arc.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@
1010
. "${ARC_PATH}/include/modules.sh"
1111
. "${ARC_PATH}/include/update.sh"
1212

13-
# Get Keymap and Timezone and check System
13+
# Check System
1414
onlineCheck
15-
KEYMAP="$(readConfigKey "keymap" "${USER_CONFIG_FILE}")"
1615
systemCheck
1716
readData
1817

files/initrd/opt/arc/evo.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@
1010
. "${ARC_PATH}/include/modules.sh"
1111
. "${ARC_PATH}/include/update.sh"
1212

13-
# Get Keymap and Timezone and check System
13+
# Check System
1414
onlineCheck
15-
KEYMAP="$(readConfigKey "keymap" "${USER_CONFIG_FILE}")"
1615
systemCheck
1716
readData
1817

0 commit comments

Comments
 (0)