arc: fix false inputed user SN

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2024-08-19 20:47:35 +02:00
parent 84f33ed659
commit 9c52d811ed

View File

@ -375,16 +375,12 @@ function arcPatch() {
--inputbox "Please enter a valid SN!" 7 50 "" \ --inputbox "Please enter a valid SN!" 7 50 "" \
2>"${TMP_PATH}/resp" 2>"${TMP_PATH}/resp"
[ $? -ne 0 ] && break 2 [ $? -ne 0 ] && break 2
SN="$(cat ${TMP_PATH}/resp)" SN="$(cat ${TMP_PATH}/resp | tr '[:lower:]' '[:upper:]')"
if [ -z "${SN}" ]; then if [ -z "${SN}" ]; then
return return
elif [ $(validateSerial ${MODEL} ${SN}) -eq 1 ]; then else
break break
fi fi
# At present, the SN rules are not complete, and many SNs are not truly invalid, so not provide tips now.
dialog --backtitle "$(backtitle)" --colors --title "DSM SN" \
--yesno "SN looks invalid, continue?" 5 50
[ $? -eq 0 ] && break
done done
writeConfigKey "arc.patch" "user" "${USER_CONFIG_FILE}" writeConfigKey "arc.patch" "user" "${USER_CONFIG_FILE}"
fi fi
@ -407,16 +403,12 @@ function arcPatch() {
--inputbox "Please enter a SN " 7 50 "" \ --inputbox "Please enter a SN " 7 50 "" \
2>"${TMP_PATH}/resp" 2>"${TMP_PATH}/resp"
[ $? -ne 0 ] && break 2 [ $? -ne 0 ] && break 2
SN="$(cat ${TMP_PATH}/resp)" SN="$(cat ${TMP_PATH}/resp | tr '[:lower:]' '[:upper:]')"
if [ -z "${SN}" ]; then if [ -z "${SN}" ]; then
return return
elif [ $(validateSerial ${MODEL} ${SN}) -eq 1 ]; then else
break break
fi fi
# At present, the SN rules are not complete, and many SNs are not truly invalid, so not provide tips now.
dialog --backtitle "$(backtitle)" --colors --title "DSM SN" \
--yesno "SN looks invalid, continue?" 5 50
[ $? -eq 0 ] && break
done done
writeConfigKey "arc.patch" "user" "${USER_CONFIG_FILE}" writeConfigKey "arc.patch" "user" "${USER_CONFIG_FILE}"
fi fi