arc: rewrite automated and add sanity check for url

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2024-05-21 18:16:19 +02:00
parent c775348c94
commit 9f4ffae0bc

View File

@ -123,6 +123,7 @@ function backtitle() {
###############################################################################
# Model Selection
function arcModel() {
if [ "${CUSTOM}" = "false" ]; then
dialog --backtitle "$(backtitle)" --title "DSM Model" \
--infobox "Reading Models..." 3 25
# Loop menu
@ -234,30 +235,31 @@ function arcModel() {
;;
esac
done
fi
# Reset Model Config if changed
if [ "${MODEL}" != "${resp}" ]; then
if [ "${CUSTOM}" = "false" ]; then
PRODUCTVER=""
PLATFORM="$(grep -w "${resp}" "${TMP_PATH}/modellist" | awk '{print $2}' | head -n 1)"
MODEL="${resp}"
writeConfigKey "model" "${MODEL}" "${USER_CONFIG_FILE}"
writeConfigKey "productver" "" "${USER_CONFIG_FILE}"
else
MODEL="${readConfigKey "model" "${USER_CONFIG_FILE}"}"
fi
PLATFORM="$(grep -w "${MODEL}" "${TMP_PATH}/modellist" | awk '{print $2}' | head -n 1)"
MODELID="$(echo ${MODEL} | sed 's/d$/D/; s/rp$/RP/; s/rp+/RP+/; s/XS+/xs+/')"
writeConfigKey "addons" "{}" "${USER_CONFIG_FILE}"
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
writeConfigKey "arc.confdone" "false" "${USER_CONFIG_FILE}"
writeConfigKey "arc.kernel" "official" "${USER_CONFIG_FILE}"
writeConfigKey "arc.paturl" "" "${USER_CONFIG_FILE}"
writeConfigKey "arc.pathash" "" "${USER_CONFIG_FILE}"
writeConfigKey "arc.remap" "" "${USER_CONFIG_FILE}"
writeConfigKey "arc.sn" "" "${USER_CONFIG_FILE}"
writeConfigKey "cmdline" "{}" "${USER_CONFIG_FILE}"
writeConfigKey "model" "${MODEL}" "${USER_CONFIG_FILE}"
writeConfigKey "modelid" "${MODELID}" "${USER_CONFIG_FILE}"
writeConfigKey "modules" "{}" "${USER_CONFIG_FILE}"
writeConfigKey "platform" "${PLATFORM}" "${USER_CONFIG_FILE}"
writeConfigKey "productver" "" "${USER_CONFIG_FILE}"
writeConfigKey "synoinfo" "{}" "${USER_CONFIG_FILE}"
if [ "${OFFLINE}" = "false" ]; then
getLogo "${MODEL}"
fi
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
if [[ -f "${ORI_ZIMAGE_FILE}" || -f "${ORI_RDGZ_FILE}" || -f "${MOD_ZIMAGE_FILE}" || -f "${MOD_RDGZ_FILE}" ]]; then
@ -639,7 +641,7 @@ function make() {
PAT_URL=$(echo ${PAT_DATA} | jq -r '.info.system.detail[0].items[0].files[0].url')
PAT_HASH=$(echo ${PAT_DATA} | jq -r '.info.system.detail[0].items[0].files[0].checksum')
PAT_URL=${PAT_URL%%\?*}
if [ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ]; then
if [ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ] && [ echo ${PAT_URL} | grep "https://" ]; then
break
fi
fi
@ -878,7 +880,7 @@ function boot() {
if grep -q "automated_arc" /proc/cmdline; then
# Check for Custom Build
if [ "${CUSTOM}" = "true" ]; then
arcVersion
arcModel
else
make
fi