From 67c45d15ada44b94f92675d0f9154606ac0f7365 Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Fri, 25 Oct 2024 19:51:13 +0200 Subject: [PATCH] Revert "sortnetif: remove for now" This reverts commit 254623175d1f0a87cf61fdae9296201c4f26a613. --- sortnetif/install.sh | 38 ++++++++++++++++++++++++++++++++++++++ sortnetif/manifest.yml | 20 ++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100755 sortnetif/install.sh create mode 100644 sortnetif/manifest.yml diff --git a/sortnetif/install.sh b/sortnetif/install.sh new file mode 100755 index 0000000..4cc611c --- /dev/null +++ b/sortnetif/install.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env ash +# +# Copyright (C) 2023 AuxXxilium and Ing +# +# This is free software, licensed under the MIT License. +# See /LICENSE for more information. +# + +if [ "${1}" = "patches" ]; then + echo "Installing addon sortnetif - ${1}" + + ETHLIST="" + 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; s/.*/\L&/')" + BUS="$(ethtool -i ${ETH} 2>/dev/null | grep bus-info | cut -d' ' -f2)" + ETHLIST="${ETHLIST}${BUS} ${MAC} ${ETH}\n" + done + ETHLISTTMPB="$(echo -e "${ETHLIST}" | sort)" + ETHLIST="$(echo -e "${ETHLISTTMPB}" | grep -v '^$')" + ETHSEQ="$(echo -e "${ETHLIST}" | awk '{print $3}' | sed 's/eth//g')" + ETHNUM="$(echo -e "${ETHLIST}" | wc -l)" + + echo "${ETHSEQ}" + # sort + if [ ! "${ETHSEQ}" = "$(seq 0 $((${ETHNUM:0} - 1)))" ]; then + /etc/rc.network stop + for i in $(seq 0 $((${ETHNUM:0} - 1))); do + ip link set dev eth${i} name tmp${i} + done + I=0 + for i in ${ETHSEQ}; do + ip link set dev tmp${i} name eth${I} + I=$((${I} + 1)) + done + /etc/rc.network start + fi +fi diff --git a/sortnetif/manifest.yml b/sortnetif/manifest.yml new file mode 100644 index 0000000..c5e4591 --- /dev/null +++ b/sortnetif/manifest.yml @@ -0,0 +1,20 @@ +version: 1 +name: sortnetif +description: "Sort network interface names: sorted by busid" +system: false +beta: false +target: system +all: + install-script: "install.sh" + copy: "" +apollolake: true +broadwell: true +broadwellnk: true +broadwellnkv2: true +broadwellntbap: true +denverton: true +geminilake: true +purley: true +v1000: true +r1000: true +epyc7002: true \ No newline at end of file