arc: fix generated values

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium
2024-05-11 16:30:30 +02:00
parent 7bd80d8e47
commit 39174a0304
3 changed files with 6 additions and 6 deletions

View File

@@ -353,7 +353,7 @@ function arcPatch() {
writeConfigKey "arc.sn" "${SN}" "${USER_CONFIG_FILE}"
writeConfigKey "arc.patch" "true" "${USER_CONFIG_FILE}"
else
SN="$(generateSerial "${MODEL}")"
SN=$(generateSerial "${MODEL}")
writeConfigKey "arc.sn" "${SN}" "${USER_CONFIG_FILE}"
writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
fi
@@ -374,7 +374,7 @@ function arcPatch() {
writeConfigKey "arc.patch" "true" "${USER_CONFIG_FILE}"
elif [ ${resp} -eq 2 ]; then
# Generate random Serial
SN="$(generateSerial "${MODEL}")"
SN=$(generateSerial "${MODEL}")
writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
elif [ ${resp} -eq 3 ]; then
while true; do
@@ -408,7 +408,7 @@ function arcPatch() {
[ -z "${resp}" ] && return 1
if [ ${resp} -eq 1 ]; then
# Generate random Serial
SN="$(generateSerial "${MODEL}")"
SN=$(generateSerial "${MODEL}")
writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
elif [ ${resp} -eq 2 ]; then
while true; do

View File

@@ -96,8 +96,7 @@ function generateSerial() {
# 2 - Amount of MACs to generate
# Returns serial number
function generateMacAddress() {
ID="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
MACPRE="$(readConfigKey "${ID}.macpre" "${S_FILE}")"
MACPRE="$(readConfigKey "${1}.macpre" "${S_FILE}")"
MACSUF="$(printf '%02x%02x%02x' $((${RANDOM} % 256)) $((${RANDOM} % 256)) $((${RANDOM} % 256)))"
NUM=${2:-1}
MACS=""

View File

@@ -1,6 +1,7 @@
# Get Network Config for Loader
function getnet() {
ETHX="$(ls /sys/class/net/ 2>/dev/null | grep eth)" # real network cards list
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
CUSTOM="$(readConfigKey "arc.custom" "${USER_CONFIG_FILE}")"
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
if [ "${ARCPATCH}" = "true" ]; then
@@ -14,7 +15,7 @@ function getnet() {
done
elif [ "${ARCPATCH}" = "false" ]; then
ETHN=$(ls /sys/class/net/ 2>/dev/null | grep eth | wc -l)
MACS=$(generateMacAddress "${MODEL}" ${ETHN})
MACS=($(generateMacAddress "${MODEL}" ${ETHN}))
N=1
for ETH in ${ETHX}; do
MAC=$(echo "${MACS}" | cut -d ' ' -f ${N})