tree: rewrite mac

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2024-06-27 18:46:03 +02:00
parent cedbc1393e
commit e1f8c285a7
3 changed files with 5 additions and 5 deletions

View File

@ -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}"

View File

@ -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

View File

@ -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"