init/functions: fix loader disk bus

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2024-07-04 22:08:50 +02:00
parent c799f465a9
commit fd7a433d10
2 changed files with 7 additions and 7 deletions

View File

@ -212,8 +212,8 @@ function _sort_netif() {
ETHX="$(ls /sys/class/net/ 2>/dev/null | grep eth)" # real network cards list
for ETH in ${ETHX}; do
MAC="$(cat /sys/class/net/${ETH}/address 2>/dev/null | sed 's/://g' | tr '[:upper:]' '[:lower:]')"
BUS="$(ethtool -i ${ETH} 2>/dev/null | grep bus-info | cut -d' ' -f2)"
ETHLIST="${ETHLIST}${BUS} ${MAC} ${ETH}\n"
ETHBUS="$(ethtool -i ${ETH} 2>/dev/null | grep bus-info | cut -d' ' -f2)"
ETHLIST="${ETHLIST}${ETHBUS} ${MAC} ${ETH}\n"
done
ETHLISTTMPM=""
ETHLISTTMPB="$(echo -e "${ETHLIST}" | sort)"

View File

@ -120,18 +120,18 @@ echo
VID="0x46f4"
PID="0x0001"
# Inform user and check bus
echo -e "Loader Disk: \033[1;34m${LOADER_DISK}\033[0m"
echo -e "Loader Disk Type: \033[1;34m${BUS}\033[0m"
BUSLIST="usb sata scsi nvme mmc xen"
if [ "${BUS}" == "usb" ]; then
VID="0x$(udevadm info --query property --name "${LOADER_DISK}" | grep ID_VENDOR_ID | cut -d= -f2)"
PID="0x$(udevadm info --query property --name "${LOADER_DISK}" | grep ID_MODEL_ID | cut -d= -f2)"
elif ! echo "${BUSLIST}" | grep -wq "${BUS}"; then
die "Loader Disk ${BUS} is not USB or SATA/SCSI/NVME/eMMC"
die "Loader Disk (${BUS}) is not USB or SATA/SCSI/NVME/eMMC"
fi
# Inform user and check bus
echo -e "Loader Disk: \033[1;34m${LOADER_DISK}\033[0m"
echo -e "Loader Disk Type: \033[1;34m${BUS}\033[0m"
# Save variables to user config file
writeConfigKey "vid" ${VID} "${USER_CONFIG_FILE}"
writeConfigKey "pid" ${PID} "${USER_CONFIG_FILE}"