mirror of
https://github.com/AuxXxilium/arc.git
synced 2024-11-24 01:39:52 +07:00
tree: rewrite mac
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
parent
cedbc1393e
commit
e1f8c285a7
@ -163,7 +163,7 @@ else
|
||||
fi
|
||||
for ETH in ${ETHX}; do
|
||||
MAC="$(readConfigKey "arc.${ETH}" "${USER_CONFIG_FILE}")"
|
||||
[ -z "${MAC}" ] && MAC="$(cat /sys/class/net/${ETH}/address 2>/dev/null | sed 's/://g')"
|
||||
[ -z "${MAC}" ] && MAC="$(cat /sys/class/net/${ETH}/address 2>/dev/null | sed 's/://g' | tr '[:upper:]' '[:lower:]')"
|
||||
ETHN=$((${ETHN} + 1))
|
||||
if [ ${ETHN} -le ${NICPORTS} ]; then
|
||||
CMDLINE['mac${ETHN}']="${MAC}"
|
||||
|
@ -22,13 +22,13 @@ function getnet() {
|
||||
while true; do
|
||||
MAC="$(cat /sys/class/net/${ETH}/address | sed 's/://g')"
|
||||
dialog --backtitle "$(backtitle)" --title "Mac Setting" \
|
||||
--inputbox "Type a custom MAC for ${ETH} (Eq. 001132123456)." 7 50 "${MAC}"\
|
||||
--inputbox "Type a custom MAC for ${ETH} (Eq. 001132abc123)." 7 50 "${MAC}"\
|
||||
2>"${TMP_PATH}/resp"
|
||||
[ $? -ne 0 ] && break
|
||||
MAC=$(cat "${TMP_PATH}/resp")
|
||||
[ -z "${MAC}" ] && MAC="$(readConfigKey "arc.${ETH}" "${USER_CONFIG_FILE}")"
|
||||
[ -z "${MAC}" ] && MAC="$(cat /sys/class/net/${ETH}/address | sed 's/://g')"
|
||||
MAC="$(echo "${MAC}" | sed "s/:\|-\| //g")"
|
||||
[ -z "${MAC}" ] && MAC="$(cat /sys/class/net/${ETH}/address 2>/dev/null | sed 's/://g' | tr '[:upper:]' '[:lower:]')"
|
||||
MAC="$(echo "${MAC}" | sed "s/:\|-\| //g" | tr '[:upper:]' '[:lower:]')"
|
||||
if [ ${#MAC} -eq 12 ]; then
|
||||
writeConfigKey "arc.${ETH}" "${MAC}" "${USER_CONFIG_FILE}"
|
||||
break
|
||||
|
@ -84,7 +84,7 @@ if arrayExistItem "sortnetif:" $(readConfigMap "addons" "${USER_CONFIG_FILE}");
|
||||
fi
|
||||
# Read/Write IP/Mac config
|
||||
for ETH in ${ETHX}; do
|
||||
MACR="$(cat /sys/class/net/${ETH}/address 2>/dev/null | sed 's/://g')"
|
||||
MACR="$(cat /sys/class/net/${ETH}/address 2>/dev/null | sed 's/://g' | tr '[:upper:]' '[:lower:]')"
|
||||
IPR="$(readConfigKey "network.${MACR}" "${USER_CONFIG_FILE}")"
|
||||
if [ -n "${IPR}" ]; then
|
||||
IFS='/' read -r -a IPRA <<<"$IPR"
|
||||
|
Loading…
Reference in New Issue
Block a user