network: rework nic count function

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2024-01-13 12:40:04 +01:00
parent a83cf4214a
commit 0db93601be
4 changed files with 6 additions and 4 deletions

View File

@ -173,7 +173,7 @@ elif [[ "${DIRECTBOOT}" = "true" && ${BOOTCOUNT} -eq 0 ]]; then
exec reboot
elif [ "${DIRECTBOOT}" = "false" ]; then
ETHX=$(ls /sys/class/net/ | grep -v lo || true)
ETH=$(ls /sys/class/net/ | grep eth | wc -l)
ETH=$(echo ${ETHX} | wc -w)
STATICIP="$(readConfigKey "arc.staticip" "${USER_CONFIG_FILE}")"
BOOTIPWAIT="$(readConfigKey "arc.bootipwait" "${USER_CONFIG_FILE}")"
echo -e "\033[1;34mDetected ${ETH} NIC.\033[0m \033[1;37mWaiting for Connection:\033[0m"

View File

@ -65,7 +65,8 @@ function getnet() {
}
# Get Amount of NIC
ETH=$(ls /sys/class/net/ | grep eth | wc -l)
ETHX=$(ls /sys/class/net/ | grep -v lo || true)
ETH=$(echo ${ETHX} | wc -w)
writeConfigKey "device.nic" "${ETH}" "${USER_CONFIG_FILE}"
# Get actual IP
ARCIP="$(readConfigKey "arc.ip" "${USER_CONFIG_FILE}")"

View File

@ -61,9 +61,9 @@ initConfigKey "device" "{}" "${USER_CONFIG_FILE}"
# Init Network
ETHX=$(ls /sys/class/net/ | grep -v lo || true)
ETH=$(ls /sys/class/net/ | grep eth | wc -l)
ETH=$(echo ${ETHX} | wc -w)
# No network devices
[ $(echo ${ETHX} | wc -w) -le 0 ] && die "No NIC found! - Loader does not work without Network connection."
[ ${ETH} -le 0 ] && die "No NIC found! - Loader does not work without Network connection."
MACSYS="$(readConfigKey "arc.macsys" "${USER_CONFIG_FILE}")"
if [ "${MACSYS}" = "custom" ]; then
MACR="$(cat /sys/class/net/eth0/address | sed 's/://g')"

View File

@ -138,6 +138,7 @@ cp -f "${TMP_PATH}/modules/rp.ko" "${RAMDISK_PATH}/usr/lib/modules/rp.ko"
rm -rf "${TMP_PATH}/modules"
# Copying hwdb.bin to destination
mkdir -p "${RAMDISK_PATH}/etc/udev"
cp -f "/etc/udev/hwdb.bin" "${RAMDISK_PATH}/etc/udev/hwdb.bin"
# Copying fake modprobe