From 1d04d3f59fc989b3f5dfb623383298e6e27551ad Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Sun, 10 Nov 2024 18:15:54 +0100 Subject: [PATCH] arc: more logic rewrite Signed-off-by: AuxXxilium --- files/initrd/opt/arc/arc-functions.sh | 6 ++++++ files/initrd/opt/arc/arc.sh | 7 ++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/files/initrd/opt/arc/arc-functions.sh b/files/initrd/opt/arc/arc-functions.sh index 77ad8ccc..89b3afde 100755 --- a/files/initrd/opt/arc/arc-functions.sh +++ b/files/initrd/opt/arc/arc-functions.sh @@ -2210,11 +2210,15 @@ function genHardwareID() { else dialog --backtitle "$(backtitle)" --title "HardwareID" \ --yes-label "Retry" --no-label "Cancel" --yesno "HardwareID: ${HWID}\nRegister your HardwareID on\nhttps://arc.auxxxilium.tech (Discord Account needed)." 8 60 + writeConfigKey "arc.hwid" "" "${USER_CONFIG_FILE}" + writeConfigKey "arc.userid" "" "${USER_CONFIG_FILE}" [ $? -ne 0 ] && break fi else dialog --backtitle "$(backtitle)" --title "HardwareID" \ --msgbox "HardwareID: Verification failed!" 6 50 + writeConfigKey "arc.hwid" "" "${USER_CONFIG_FILE}" + writeConfigKey "arc.userid" "" "${USER_CONFIG_FILE}" break fi done @@ -2234,6 +2238,8 @@ function checkHardwareID() { curl -skL "https://arc.auxxxilium.tech?hwid=${HWID}&userid=${USERID}" > "${S_FILE}" fi else + writeConfigKey "arc.hwid" "" "${USER_CONFIG_FILE}" + writeConfigKey "arc.userid" "" "${USER_CONFIG_FILE}" dialog --backtitle "$(backtitle)" --title "HardwareID" \ --infobox "Couldn't verify your HardwareID!\nArc Patch not enabled!" 6 40 cp -f "${S_FILE}.bak" "${S_FILE}" diff --git a/files/initrd/opt/arc/arc.sh b/files/initrd/opt/arc/arc.sh index 94f9171a..87690691 100755 --- a/files/initrd/opt/arc/arc.sh +++ b/files/initrd/opt/arc/arc.sh @@ -33,6 +33,7 @@ fi # Get Arc Data from Config ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")" +USERID="$(readConfigKey "arc.userid" "${USER_CONFIG_FILE}")" ARCCONF="$(readConfigKey "${MODEL:-SA6400}.serial" "${S_FILE}")" BOOTIPWAIT="$(readConfigKey "bootipwait" "${USER_CONFIG_FILE}")" DIRECTBOOT="$(readConfigKey "directboot" "${USER_CONFIG_FILE}")" @@ -409,7 +410,7 @@ function arcPatch() { # Check for Custom Build if [ "${ARCMODE}" == "automated" ]; then [ -z "${ARCCONF}" ] && checkHardwareID || true - sleep 2 + sleep 1 ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")" [ -n "${ARCCONF}" ] && SN="$(generateSerial "${MODEL}" "true")" || SN="$(generateSerial "${MODEL}" "false")" [ -n "${ARCCONF}" ] && writeConfigKey "arc.patch" "true" "${USER_CONFIG_FILE}" || writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}" @@ -425,7 +426,7 @@ function arcPatch() { [ -z "${resp}" ] && return 1 if [ ${resp} -eq 1 ]; then [ -z "${ARCCONF}" ] && checkHardwareID || true - sleep 2 + sleep 1 ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")" [ -n "${ARCCONF}" ] && SN="$(generateSerial "${MODEL}" "true")" || SN="$(generateSerial "${MODEL}" "false")" [ -n "${ARCCONF}" ] && writeConfigKey "arc.patch" "true" "${USER_CONFIG_FILE}" || writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}" @@ -824,7 +825,7 @@ else [ "${BUILDDONE}" == "true" ] && NEXT="3" || NEXT="1" while true; do echo "= \"\Z4========== Main ==========\Zn \" " >"${TMP_PATH}/menu" - if [ -z "${ARCCONF}" ] && [ "${ARCOFFLINE}" != "true" ]; then + if [ -z "${USERID}" ] && [ "${ARCOFFLINE}" != "true" ]; then echo "0 \"HardwareID for Arc Patch\" " >>"${TMP_PATH}/menu" fi echo "1 \"Choose Model \" " >>"${TMP_PATH}/menu"