init/boot: fix nic amount

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2023-11-26 00:50:24 +01:00
parent f8d602ec3d
commit ffd121feaf
2 changed files with 4 additions and 2 deletions

View File

@ -169,9 +169,10 @@ elif [[ "${DIRECTBOOT}" = "true" && ${BOOTCOUNT} -eq 0 ]]; then
exec reboot
elif [ "${DIRECTBOOT}" = "false" ]; then
ETHX=$(ls /sys/class/net/ | grep -v lo || true)
NIC=$(ls /sys/class/net/ | grep eth | wc -l)
STATICIP="$(readConfigKey "arc.staticip" "${USER_CONFIG_FILE}")"
BOOTIPWAIT="$(readConfigKey "arc.bootipwait" "${USER_CONFIG_FILE}")"
echo -e "\033[1;34mDetected ${#ETHX[@]} NIC.\033[0m \033[1;37mWaiting for Connection:\033[0m"
echo -e "\033[1;34mDetected ${NIC} NIC.\033[0m \033[1;37mWaiting for Connection:\033[0m"
for N in ${ETHX}; do
DRIVER=$(ls -ld /sys/class/net/${N}/device/driver 2>/dev/null | awk -F '/' '{print $NF}')
COUNT=0

View File

@ -59,6 +59,7 @@ initConfigKey "device" "{}" "${USER_CONFIG_FILE}"
# Init Network
ETHX=$(ls /sys/class/net/ | grep -v lo || true)
NIC=$(ls /sys/class/net/ | grep eth | wc -l)
# No network devices
[ $(echo ${ETHX} | wc -w) -le 0 ] && die "No NIC found! - Loader does not work without Network connection."
MACSYS="$(readConfigKey "arc.macsys" "${USER_CONFIG_FILE}")"
@ -128,7 +129,7 @@ BOOTCOUNT="$(readConfigKey "arc.bootcount" "${USER_CONFIG_FILE}")"
STATICIP="$(readConfigKey "arc.staticip" "${USER_CONFIG_FILE}")"
BOOTIPWAIT="$(readConfigKey "arc.bootipwait" "${USER_CONFIG_FILE}")"
[ -z "${BOOTIPWAIT}" ] && BOOTIPWAIT=20
echo -e "\033[1;34mDetected ${#ETHX[@]} NIC.\033[0m \033[1;37mWaiting for Connection:\033[0m"
echo -e "\033[1;34mDetected ${NIC} NIC.\033[0m \033[1;37mWaiting for Connection:\033[0m"
for N in ${ETHX}; do
DRIVER=$(ls -ld /sys/class/net/${N}/device/driver 2>/dev/null | awk -F '/' '{print $NF}')
COUNT=0