mirror of
https://github.com/AuxXxilium/arc.git
synced 2024-11-23 21:49:52 +07:00
arc: fix sn/mac stuff
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
parent
56d9c038a4
commit
0f64c0ed80
@ -1209,7 +1209,7 @@ function networkdiag() {
|
||||
fi
|
||||
done
|
||||
echo
|
||||
GITHUBAPI=$(curl --interface ${ETH} -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | grep -v "dev" | sort -rV | head -1)
|
||||
GITHUBAPI=$(curl --interface ${ETH} -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | grep -v "dev" | sort -rV | head -1 2>/dev/null)
|
||||
if [[ $? -ne 0 || -z "${GITHUBAPI}" ]]; then
|
||||
echo -e "Github API not reachable!"
|
||||
else
|
||||
|
@ -436,10 +436,10 @@ function arcPatch() {
|
||||
# Check for Custom Build
|
||||
if [ "${ARCMODE}" == "automated" ]; then
|
||||
if [ -n "${ARCCONF}" ]; then
|
||||
SN=$(generateSerial "${MODEL}" "true" | tr '[:lower:]' '[:upper:]')
|
||||
SN=$(generateSerial "${MODEL}" "true")
|
||||
writeConfigKey "arc.patch" "true" "${USER_CONFIG_FILE}"
|
||||
else
|
||||
SN=$(generateSerial "${MODEL}" "false" | tr '[:lower:]' '[:upper:]')
|
||||
SN=$(generateSerial "${MODEL}" "false")
|
||||
writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
elif [ "${ARCMODE}" == "config" ]; then
|
||||
@ -456,16 +456,16 @@ function arcPatch() {
|
||||
[ -z "${ARCCONF}" ] && decryptMenu || true
|
||||
if [ -n "${ARCCONF}" ]; then
|
||||
# Read Arc Patch from File
|
||||
SN="$(generateSerial "${MODEL}" "true" | tr '[:lower:]' '[:upper:]')"
|
||||
SN="$(generateSerial "${MODEL}" "true")"
|
||||
writeConfigKey "arc.patch" "true" "${USER_CONFIG_FILE}"
|
||||
else
|
||||
# Read Arc Patch from File
|
||||
SN="$(generateSerial "${MODEL}" "false" | tr '[:lower:]' '[:upper:]')"
|
||||
SN="$(generateSerial "${MODEL}" "false")"
|
||||
writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
|
||||
fi
|
||||
elif [ ${resp} -eq 2 ]; then
|
||||
# Generate random Serial
|
||||
SN="$(generateSerial "${MODEL}" "false" | tr '[:lower:]' '[:upper:]')"
|
||||
SN="$(generateSerial "${MODEL}" "false")"
|
||||
writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
|
||||
elif [ ${resp} -eq 3 ]; then
|
||||
while true; do
|
||||
@ -473,7 +473,7 @@ function arcPatch() {
|
||||
--inputbox "Please enter a valid SN!" 7 50 "" \
|
||||
2>"${TMP_PATH}/resp"
|
||||
[ $? -ne 0 ] && break 2
|
||||
SN="$(cat ${TMP_PATH}/resp | tr '[:lower:]' '[:upper:]')"
|
||||
SN="$(cat ${TMP_PATH}/resp)"
|
||||
if [ -z "${SN}" ]; then
|
||||
return
|
||||
else
|
||||
@ -709,10 +709,10 @@ function make() {
|
||||
BOOTMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
if [ "${BOOTMODE}" != "automated" ] && [[ "${ARCPATCH}" != "true" || -z "${ARCCONF}" ]]; then
|
||||
if ! curl -skL "https://auxxxilium.tech/check.yml" -o "${TMP_PATH}/check.yml" 2>/dev/null; then
|
||||
SN=$(generateSerial "${MODEL}" "false" | tr '[:lower:]' '[:upper:]')
|
||||
SN=$(generateSerial "${MODEL}" "false")
|
||||
else
|
||||
if grep -q "${SN}" "${TMP_PATH}/check.yml"; then
|
||||
SN=$(generateSerial "${MODEL}" "false" | tr '[:lower:]' '[:upper:]')
|
||||
SN=$(generateSerial "${MODEL}" "false")
|
||||
fi
|
||||
fi
|
||||
writeConfigKey "sn" "${SN}" "${USER_CONFIG_FILE}"
|
||||
|
@ -111,6 +111,7 @@ function generateSerial() {
|
||||
;;
|
||||
esac
|
||||
|
||||
SERIAL="$(echo "${SERIAL}" | tr '[:lower:]' '[:upper:]')"
|
||||
echo "${SERIAL}"
|
||||
return 0
|
||||
}
|
||||
@ -134,6 +135,8 @@ function generateMacAddress() {
|
||||
MACS+="$(printf '%06x%06x' $((0x${MACPRE:-"001132"})) $(($((0x${MACSUF})) + ${I})))"
|
||||
[ ${I} -lt ${NUM} ] && MACS+=" "
|
||||
done
|
||||
|
||||
MACS="$(echo "${MACS}" | tr '[:lower:]' '[:upper:]')"
|
||||
echo "${MACS}"
|
||||
return 0
|
||||
}
|
||||
@ -284,7 +287,7 @@ function getBus() {
|
||||
# 1 - ethN
|
||||
function getIP() {
|
||||
local IP=""
|
||||
MACR="$(cat /sys/class/net/${1}/address 2>/dev/null | sed 's/://g' | tr '[:upper:]' '[:lower:]')"
|
||||
MACR="$(cat /sys/class/net/${1}/address 2>/dev/null | sed 's/://g' | tr '[:lower:]' '[:upper:]')"
|
||||
IPR="$(readConfigKey "network.${MACR}" "${USER_CONFIG_FILE}")"
|
||||
if [ -n "${IPR}" ]; then
|
||||
IFS='/' read -r -a IPRA <<<"${IPR}"
|
||||
|
@ -6,14 +6,14 @@ function getnet() {
|
||||
NICPORTS="$(readConfigKey "${MODEL}.ports" "${S_FILE}" 2>/dev/null)"
|
||||
if [ "${ARCPATCH}" == "true" ]; then
|
||||
ETHN="$(echo ${ETHX} | wc -w)"
|
||||
MACS=($(generateMacAddress "${MODEL}" "${ETHN}" "true" | tr '[:upper:]' '[:lower:]'))
|
||||
MACS=($(generateMacAddress "${MODEL}" "${ETHN}" "true"))
|
||||
for I in $(seq 1 ${ETHN}); do
|
||||
eval MAC${I}="${MACS[$((${I} - 1))]}"
|
||||
writeConfigKey "eth$((${I} - 1))" "${MACS[$((${I} - 1))]}" "${USER_CONFIG_FILE}"
|
||||
done
|
||||
elif [ "${ARCPATCH}" == "false" ]; then
|
||||
ETHN="$(echo ${ETHX} | wc -w)"
|
||||
MACS=($(generateMacAddress "${MODEL}" "${ETHN}" "false" | tr '[:upper:]' '[:lower:]'))
|
||||
MACS=($(generateMacAddress "${MODEL}" "${ETHN}" "false"))
|
||||
for I in $(seq 1 ${ETHN}); do
|
||||
eval MAC${I}="${MACS[$((${I} - 1))]}"
|
||||
writeConfigKey "eth$((${I} - 1))" "${MACS[$((${I} - 1))]}" "${USER_CONFIG_FILE}"
|
||||
@ -22,15 +22,15 @@ function getnet() {
|
||||
# User Mac
|
||||
for ETH in ${ETHX}; do
|
||||
while true; do
|
||||
MAC="$(cat /sys/class/net/${ETH}/address | sed 's/://g')"
|
||||
MAC="$(cat /sys/class/net/${ETH}/address | sed 's/://g' | tr '[:lower:]' '[:upper:]')"
|
||||
dialog --backtitle "$(backtitle)" --title "Mac Setting" \
|
||||
--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 "${ETH}" "${USER_CONFIG_FILE}")"
|
||||
[ -z "${MAC}" ] && MAC="$(cat /sys/class/net/${ETH}/address 2>/dev/null | sed 's/://g')"
|
||||
MAC="$(echo "${MAC}" | tr '[:upper:]' '[:lower:]')"
|
||||
[ -z "${MAC}" ] && MAC="$(cat /sys/class/net/${ETH}/address 2>/dev/null | sed 's/://g' | tr '[:lower:]' '[:upper:]')"
|
||||
MAC="$(echo "${MAC}" | tr '[:lower:]' '[:upper:]')"
|
||||
if [ ${#MAC} -eq 12 ]; then
|
||||
writeConfigKey "${ETH}" "${MAC}" "${USER_CONFIG_FILE}"
|
||||
break
|
||||
|
@ -93,7 +93,7 @@ fi
|
||||
# Read/Write IP/Mac to config
|
||||
ETHX="$(ls /sys/class/net 2>/dev/null | grep eth)"
|
||||
for ETH in ${ETHX}; do
|
||||
MACR="$(cat /sys/class/net/${ETH}/address 2>/dev/null | sed 's/://g' | tr '[:upper:]' '[:lower:]')"
|
||||
MACR="$(cat /sys/class/net/${ETH}/address 2>/dev/null | sed 's/://g' | tr '[:lower:]' '[:upper:]')"
|
||||
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