tree: rework

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2024-10-25 19:55:21 +02:00
parent 138d683318
commit 2594a8a599
3 changed files with 7 additions and 13 deletions

View File

@ -80,7 +80,6 @@ if [ "${DISKINFO}" == "true" ]; then
echo -e "Disks: \033[1;37m$(lsblk -dpno NAME | grep -v "${LOADER_DISK}" | wc -l)\033[0m" echo -e "Disks: \033[1;37m$(lsblk -dpno NAME | grep -v "${LOADER_DISK}" | wc -l)\033[0m"
fi fi
if ! readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q nvmesystem; then if ! readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q nvmesystem; then
HASATA=0 HASATA=0
for D in $(lsblk -dpno NAME); do for D in $(lsblk -dpno NAME); do

View File

@ -226,26 +226,17 @@ function _set_conf_kv() {
} }
############################################################################### ###############################################################################
# sort netif name # sort netif busid
# @1 -mac1,mac2,mac3...
function _sort_netif() { function _sort_netif() {
local ETHLIST="" local ETHLIST=""
local ETHX="$(ls /sys/class/net/ 2>/dev/null | grep eth)" # real network cards list local ETHX="$(ls /sys/class/net/ 2>/dev/null | grep eth)" # real network cards list
for ETH in ${ETHX}; do for ETH in ${ETHX}; do
local MAC="$(cat /sys/class/net/${ETH}/address 2>/dev/null | sed 's/://g; s/.*/\L&/' | tr '[:lower:]' '[:upper:]')" local MAC="$(cat /sys/class/net/${ETH}/address 2>/dev/null | sed 's/://g; s/.*/\L&/')"
local BUS="$(ethtool -i ${ETH} 2>/dev/null | grep bus-info | cut -d' ' -f2)" local BUS="$(ethtool -i ${ETH} 2>/dev/null | grep bus-info | cut -d' ' -f2)"
ETHLIST="${ETHLIST}${BUS} ${MAC} ${ETH}\n" ETHLIST="${ETHLIST}${BUS} ${MAC} ${ETH}\n"
done done
local ETHLISTTMPM=""
local ETHLISTTMPB="$(echo -e "${ETHLIST}" | sort)" local ETHLISTTMPB="$(echo -e "${ETHLIST}" | sort)"
if [ -n "${1}" ]; then local ETHLIST="$(echo -e "${ETHLISTTMPM}" | grep -v '^$')"
local MACS="$(echo "${1}" | sed 's/://g; s/,/ /g; s/.*/\L&/' | tr '[:lower:]' '[:upper:]')"
for MACX in ${MACS}; do
ETHLISTTMPM="${ETHLISTTMPM}$(echo -e "${ETHLISTTMPB}" | grep "${MACX}")\n"
ETHLISTTMPB="$(echo -e "${ETHLISTTMPB}" | grep -v "${MACX}")\n"
done
fi
local ETHLIST="$(echo -e "${ETHLISTTMPM}${ETHLISTTMPB}" | grep -v '^$')"
local ETHSEQ="$(echo -e "${ETHLIST}" | awk '{print $3}' | sed 's/eth//g')" local ETHSEQ="$(echo -e "${ETHLIST}" | awk '{print $3}' | sed 's/eth//g')"
local ETHNUM="$(echo -e "${ETHLIST}" | wc -l)" local ETHNUM="$(echo -e "${ETHLIST}" | wc -l)"

View File

@ -92,6 +92,10 @@ fi
if [ -n "${ARC_BRANCH}" ]; then if [ -n "${ARC_BRANCH}" ]; then
writeConfigKey "arc.branch" "${ARC_BRANCH}" "${USER_CONFIG_FILE}" writeConfigKey "arc.branch" "${ARC_BRANCH}" "${USER_CONFIG_FILE}"
fi fi
# Sort network interfaces
if arrayExistItem "sortnetif:" $(readConfigMap "addons" "${USER_CONFIG_FILE}"); then
_sort_netif "$(readConfigKey "addons.sortnetif" "${USER_CONFIG_FILE}")"
fi
# Read/Write IP/Mac to config # Read/Write IP/Mac to config
ETHX="$(ls /sys/class/net 2>/dev/null | grep eth)" ETHX="$(ls /sys/class/net 2>/dev/null | grep eth)"
for ETH in ${ETHX}; do for ETH in ${ETHX}; do