diff --git a/files/initrd/opt/arc/boot.sh b/files/initrd/opt/arc/boot.sh index 63664260..8128aefc 100755 --- a/files/initrd/opt/arc/boot.sh +++ b/files/initrd/opt/arc/boot.sh @@ -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" fi - if ! readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q nvmesystem; then HASATA=0 for D in $(lsblk -dpno NAME); do diff --git a/files/initrd/opt/arc/include/functions.sh b/files/initrd/opt/arc/include/functions.sh index dbae7646..91cde66a 100755 --- a/files/initrd/opt/arc/include/functions.sh +++ b/files/initrd/opt/arc/include/functions.sh @@ -226,26 +226,17 @@ function _set_conf_kv() { } ############################################################################### -# sort netif name -# @1 -mac1,mac2,mac3... +# sort netif busid function _sort_netif() { local ETHLIST="" local ETHX="$(ls /sys/class/net/ 2>/dev/null | grep eth)" # real network cards list 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)" ETHLIST="${ETHLIST}${BUS} ${MAC} ${ETH}\n" done - local ETHLISTTMPM="" local ETHLISTTMPB="$(echo -e "${ETHLIST}" | sort)" - if [ -n "${1}" ]; then - 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 ETHLIST="$(echo -e "${ETHLISTTMPM}" | grep -v '^$')" local ETHSEQ="$(echo -e "${ETHLIST}" | awk '{print $3}' | sed 's/eth//g')" local ETHNUM="$(echo -e "${ETHLIST}" | wc -l)" diff --git a/files/initrd/opt/arc/init.sh b/files/initrd/opt/arc/init.sh index 2a686136..4e0a7408 100755 --- a/files/initrd/opt/arc/init.sh +++ b/files/initrd/opt/arc/init.sh @@ -92,6 +92,10 @@ fi if [ -n "${ARC_BRANCH}" ]; then writeConfigKey "arc.branch" "${ARC_BRANCH}" "${USER_CONFIG_FILE}" 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 ETHX="$(ls /sys/class/net 2>/dev/null | grep eth)" for ETH in ${ETHX}; do