boot/network: add macsys "arc"

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium
2024-02-20 20:40:25 +01:00
parent 6816869c96
commit 2c8c1ced78
2 changed files with 28 additions and 15 deletions

View File

@@ -135,20 +135,29 @@ CMDLINE['sn']="${SN}"
CMDLINE['net.ifnames']="0"
CMDLINE['biosdevname']="0"
N=0
if [ "${MACSYS}" = "hardware" ]; then
if [ "${MACSYS}" = "arc" ]; then
MAC="$(readConfigKey "mac.eth0" "${USER_CONFIG_FILE}")"
[ -n "${MAC}" ] && CMDLINE["mac1"]="${MAC}"
for ETH in ${ETHX}; do
N=$((${N} + 1))
done
CMDLINE['netif_num']="1"
CMDLINE['skip_vender_mac_interfaces']="0,1,2,3,4,5,6,7"
elif [ "${MACSYS}" = "hardware" ]; then
for ETH in ${ETHX}; do
MAC="$(readConfigKey "mac.${ETH}" "${USER_CONFIG_FILE}")"
[ -n "${MAC}" ] && N=$((${N} + 1)) && CMDLINE["mac${N}"]="${MAC}"
done
CMDLINE['netif_num']="${N}"
CMDLINE['skip_vender_mac_interfaces']="0,1,2,3,4,5,6,7"
elif [ "${MACSYS}" = "custom" ]; then
for ETH in ${ETHX}; do
MAC="$(readConfigKey "mac.${ETH}" "${USER_CONFIG_FILE}")"
[ -n "${MAC}" ] && N=$((${N} + 1)) && CMDLINE["mac${N}"]="${MAC}"
done
CMDLINE['netif_num']="${N}"
CMDLINE['skip_vender_mac_interfaces']="$(seq -s, ${N} 7)"
fi
CMDLINE['netif_num']="${N}"
# Read cmdline
while IFS=': ' read -r KEY VALUE; do

View File

@@ -48,19 +48,23 @@ function getnet() {
dialog --backtitle "$(backtitle)" --title "Mac Setting" --msgbox "Invalid MAC" 0 0
done
fi
# Ask for Macsys
dialog --clear --backtitle "$(backtitle)" \
--nocancel --title "Macsys Setting" \
--menu "Do you want to apply Mac to NIC?" 7 50 0 \
1 "No - Do not apply (Fake)Mac" \
2 "Yes - Apply (Fake)Mac" \
2>"${TMP_PATH}/resp"
resp="$(<"${TMP_PATH}/resp")"
[ -z "${resp}" ] && return 1
if [ ${resp} -eq 1 ]; then
writeConfigKey "arc.macsys" "hardware" "${USER_CONFIG_FILE}"
elif [ ${resp} -eq 2 ]; then
writeConfigKey "arc.macsys" "custom" "${USER_CONFIG_FILE}"
if [ "${ARCPATCH}" = "true" ]; then
writeConfigKey "arc.macsys" "arc" "${USER_CONFIG_FILE}"
else
# Ask for Macsys
dialog --clear --backtitle "$(backtitle)" \
--nocancel --title "Macsys Setting" \
--menu "Do you want to apply Mac to NIC?" 7 50 0 \
1 "No - Do not apply (Fake)Mac" \
2 "Yes - Apply (Fake)Mac" \
2>"${TMP_PATH}/resp"
resp="$(<"${TMP_PATH}/resp")"
[ -z "${resp}" ] && return 1
if [ ${resp} -eq 1 ]; then
writeConfigKey "arc.macsys" "hardware" "${USER_CONFIG_FILE}"
elif [ ${resp} -eq 2 ]; then
writeConfigKey "arc.macsys" "custom" "${USER_CONFIG_FILE}"
fi
fi
MACSYS="$(readConfigKey "arc.macsys" "${USER_CONFIG_FILE}")"
}