mirror of
https://github.com/AuxXxilium/arc-addons.git
synced 2024-11-23 21:50:52 +07:00
sortnetif: reduce code
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
parent
f5c6f6ccf1
commit
2d2bc8b388
@ -16,16 +16,8 @@ if [ "${1}" = "patches" ]; then
|
||||
BUS="$(ethtool -i ${ETH} 2>/dev/null | grep bus-info | cut -d' ' -f2)"
|
||||
ETHLIST="${ETHLIST}${BUS} ${MAC} ${ETH}\n"
|
||||
done
|
||||
ETHLISTTMPM=""
|
||||
ETHLISTTMPB="$(echo -e "${ETHLIST}" | sort)"
|
||||
if [ -n "${2}" ]; then
|
||||
MACS="$(echo "${2}" | sed 's/://g; s/,/ /g; s/.*/\L&/')"
|
||||
for MACX in ${MACS}; do
|
||||
ETHLISTTMPM="${ETHLISTTMPM}$(echo -e "${ETHLISTTMPB}" | grep "${MACX}")\n"
|
||||
ETHLISTTMPB="$(echo -e "${ETHLISTTMPB}" | grep -v "${MACX}")\n"
|
||||
done
|
||||
fi
|
||||
ETHLIST="$(echo -e "${ETHLISTTMPM}${ETHLISTTMPB}" | grep -v '^$')"
|
||||
ETHLIST="$(echo -e "${ETHLISTTMPB}" | grep -v '^$')"
|
||||
ETHSEQ="$(echo -e "${ETHLIST}" | awk '{print $3}' | sed 's/eth//g')"
|
||||
ETHNUM="$(echo -e "${ETHLIST}" | wc -l)"
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
version: 1
|
||||
name: sortnetif
|
||||
description: "Sort network interface names | empty: sorted by busid; mac1,mac2,...: sorted by macs sequence"
|
||||
description: "Sort network interface names: sorted by busid"
|
||||
system: false
|
||||
beta: false
|
||||
target: system
|
||||
|
Loading…
Reference in New Issue
Block a user