From 5f030c23498f80ae6a3a9eab1de2b9815e1a4453 Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Sat, 16 Nov 2024 21:53:43 +0100 Subject: [PATCH] tree: add some sanity check Signed-off-by: AuxXxilium --- files/initrd/opt/arc/arc-functions.sh | 6 ++++-- files/initrd/opt/arc/arc.sh | 2 -- files/initrd/opt/arc/include/update.sh | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/files/initrd/opt/arc/arc-functions.sh b/files/initrd/opt/arc/arc-functions.sh index 035dcc7b..758f3608 100755 --- a/files/initrd/opt/arc/arc-functions.sh +++ b/files/initrd/opt/arc/arc-functions.sh @@ -1229,7 +1229,7 @@ function getCMDline () { function uploadDiag () { if [ -f "${TMP_PATH}/sysinfo.yml" ]; then HWID="$(genHWID)" - curl -sk -X POST -F "file=@${TMP_PATH}/sysinfo.yml" "https://arc.auxxxilium.tech?sysinfo=${HWID}&userid=${USERID}" 2>/dev/null + curl -sk -m 20 -X POST -F "file=@${TMP_PATH}/sysinfo.yml" "https://arc.auxxxilium.tech?sysinfo=${HWID}&userid=${USERID}" 2>/dev/null if [ $? -eq 0 ]; then dialog --backtitle "$(backtitle)" --title "Sysinfo Upload" --msgbox "Your Code: ${HWID}" 5 40 else @@ -2288,7 +2288,7 @@ function checkHardwareID() { HWID="$(genHWID)" USERID="$(curl -skL -m 10 "https://arc.auxxxilium.tech?hwid=${HWID}" 2>/dev/null)" if echo "${USERID}" | grep -vq "Hardware ID"; then - cp -f "${S_FILE}" "${S_FILE}.bak" + [ ! -f "${S_FILE}" ] && cp -f "${S_FILE}" "${S_FILE}.bak" 2>/dev/null || true if curl -skL -m 10 "https://arc.auxxxilium.tech?hwid=${HWID}&userid=${USERID}" -o "${S_FILE}" 2>/dev/null; then writeConfigKey "arc.hwid" "${HWID}" "${USER_CONFIG_FILE}" writeConfigKey "arc.userid" "${USERID}" "${USER_CONFIG_FILE}" @@ -2299,6 +2299,7 @@ function checkHardwareID() { USERID="" writeConfigKey "arc.hwid" "" "${USER_CONFIG_FILE}" writeConfigKey "arc.userid" "" "${USER_CONFIG_FILE}" + mv -f "${S_FILE}.bak" "${S_FILE}" 2>/dev/null fi else dialog --backtitle "$(backtitle)" --title "HardwareID" \ @@ -2307,6 +2308,7 @@ function checkHardwareID() { USERID="" writeConfigKey "arc.hwid" "" "${USER_CONFIG_FILE}" writeConfigKey "arc.userid" "" "${USER_CONFIG_FILE}" + mv -f "${S_FILE}.bak" "${S_FILE}" 2>/dev/null fi return } diff --git a/files/initrd/opt/arc/arc.sh b/files/initrd/opt/arc/arc.sh index 30f3bcab..b81f3111 100755 --- a/files/initrd/opt/arc/arc.sh +++ b/files/initrd/opt/arc/arc.sh @@ -92,8 +92,6 @@ function arcModel() { if [ ! -f "${S_FILE}" ] || [ ! -f "${P_FILE}" ]; then updateConfigs fi - # Check for Hardware ID - checkHardwareID dialog --backtitle "$(backtitlep)" --title "Model" \ --infobox "Reading Models..." 3 25 ARCCONF="$(readConfigKey "${MODEL:-SA6400}.serial" "${S_FILE}")" diff --git a/files/initrd/opt/arc/include/update.sh b/files/initrd/opt/arc/include/update.sh index 3279e3d7..57d306ec 100755 --- a/files/initrd/opt/arc/include/update.sh +++ b/files/initrd/opt/arc/include/update.sh @@ -362,7 +362,7 @@ function updateConfigs() { dialog --backtitle "$(backtitle)" --title "Update Configs" \ --infobox "Update successful!" 3 50 sleep 2 - [ -z "${USERID}" ] && checkHardwareID || true + [ -n "${USERID}" ] && checkHardwareID || true else return 1 fi