arc: rewrite

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2024-08-27 14:45:37 -04:00
parent 7684075e86
commit 8608b0695c

View File

@ -90,6 +90,7 @@ function backtitle() {
###############################################################################
# Model Selection
function arcModel() {
CHANGED=false
dialog --backtitle "$(backtitle)" --title "DSM Model" \
--infobox "Reading Models..." 3 25
# Loop menu
@ -206,44 +207,51 @@ function arcModel() {
MODELID=$(echo ${MODEL} | sed 's/d$/D/; s/rp$/RP/; s/rp+/RP+/')
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
writeConfigKey "arc.confdone" "false" "${USER_CONFIG_FILE}"
writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
writeConfigKey "arc.remap" "" "${USER_CONFIG_FILE}"
writeConfigKey "buildnum" "" "${USER_CONFIG_FILE}"
writeConfigKey "cmdline" "{}" "${USER_CONFIG_FILE}"
writeConfigKey "emmcboot" "false" "${USER_CONFIG_FILE}"
writeConfigKey "hddsort" "false" "${USER_CONFIG_FILE}"
writeConfigKey "modelid" "${MODELID}" "${USER_CONFIG_FILE}"
writeConfigKey "paturl" "" "${USER_CONFIG_FILE}"
writeConfigKey "pathash" "" "${USER_CONFIG_FILE}"
writeConfigKey "arc.remap" "" "${USER_CONFIG_FILE}"
writeConfigKey "modelid" "${MODELID}" "${USER_CONFIG_FILE}"
writeConfigKey "platform" "${PLATFORM}" "${USER_CONFIG_FILE}"
writeConfigKey "ramdisk-hash" "" "${USER_CONFIG_FILE}"
writeConfigKey "smallnum" "" "${USER_CONFIG_FILE}"
writeConfigKey "sn" "" "${USER_CONFIG_FILE}"
writeConfigKey "zimage-hash" "" "${USER_CONFIG_FILE}"
CHANGED=true
elif [ "${MODEL}" != "${resp}" ]; then
PRODUCTVER=""
MODEL="${resp}"
PLATFORM="$(grep -w "${MODEL}" "${TMP_PATH}/modellist" | awk '{print $2}' | head -n 1)"
writeConfigKey "model" "${MODEL}" "${USER_CONFIG_FILE}"
writeConfigKey "modelid" "" "${USER_CONFIG_FILE}"
writeConfigKey "productver" "" "${USER_CONFIG_FILE}"
writeConfigKey "buildnum" "" "${USER_CONFIG_FILE}"
writeConfigKey "smallnum" "" "${USER_CONFIG_FILE}"
writeConfigKey "addons" "{}" "${USER_CONFIG_FILE}"
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
writeConfigKey "arc.confdone" "false" "${USER_CONFIG_FILE}"
writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
writeConfigKey "arc.remap" "" "${USER_CONFIG_FILE}"
writeConfigKey "buildnum" "" "${USER_CONFIG_FILE}"
writeConfigKey "emmcboot" "false" "${USER_CONFIG_FILE}"
writeConfigKey "hddsort" "false" "${USER_CONFIG_FILE}"
writeConfigKey "kernel" "official" "${USER_CONFIG_FILE}"
writeConfigKey "model" "${MODEL}" "${USER_CONFIG_FILE}"
writeConfigKey "modelid" "" "${USER_CONFIG_FILE}"
writeConfigKey "odp" "false" "${USER_CONFIG_FILE}"
writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
writeConfigKey "paturl" "" "${USER_CONFIG_FILE}"
writeConfigKey "pathash" "" "${USER_CONFIG_FILE}"
writeConfigKey "arc.remap" "" "${USER_CONFIG_FILE}"
writeConfigKey "sn" "" "${USER_CONFIG_FILE}"
writeConfigKey "platform" "${PLATFORM}" "${USER_CONFIG_FILE}"
writeConfigKey "productver" "" "${USER_CONFIG_FILE}"
writeConfigKey "ramdisk-hash" "" "${USER_CONFIG_FILE}"
writeConfigKey "smallnum" "" "${USER_CONFIG_FILE}"
writeConfigKey "sn" "" "${USER_CONFIG_FILE}"
writeConfigKey "zimage-hash" "" "${USER_CONFIG_FILE}"
CHANGED=true
fi
if [ -f "${ORI_ZIMAGE_FILE}" ] || [ -f "${ORI_RDGZ_FILE}" ] || [ -f "${MOD_ZIMAGE_FILE}" ] || [ -f "${MOD_RDGZ_FILE}" ]; then
if [ "${CHANGED}" == "true" ]; then
rm -f "${ORI_ZIMAGE_FILE}" "${ORI_RDGZ_FILE}" "${MOD_ZIMAGE_FILE}" "${MOD_RDGZ_FILE}" 2>/dev/null || true
rm -f "${PART1_PATH}/grub_cksum.syno" "${PART1_PATH}/GRUB_VER" "${PART2_PATH}/"* >/dev/null 2>&1 || true
fi
# Reset Cmdline
writeConfigKey "cmdline" "{}" "${USER_CONFIG_FILE}"
# Read Platform Data
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
@ -289,6 +297,13 @@ function arcVersion() {
writeConfigKey "productver" "${PRODUCTVER}" "${USER_CONFIG_FILE}"
NANOVER="${opt}"
writeConfigKey "nanover" "${NANOVER}" "${USER_CONFIG_FILE}"
# Reset Config if changed
writeConfigKey "buildnum" "" "${USER_CONFIG_FILE}"
writeConfigKey "paturl" "" "${USER_CONFIG_FILE}"
writeConfigKey "pathash" "" "${USER_CONFIG_FILE}"
writeConfigKey "ramdisk-hash" "" "${USER_CONFIG_FILE}"
writeConfigKey "smallnum" "" "${USER_CONFIG_FILE}"
writeConfigKey "zimage-hash" "" "${USER_CONFIG_FILE}"
# Delete old files
rm -f "${ORI_ZIMAGE_FILE}" "${ORI_RDGZ_FILE}" "${MOD_ZIMAGE_FILE}" "${MOD_RDGZ_FILE}" 2>/dev/null || true
rm -f "${PART1_PATH}/grub_cksum.syno" "${PART1_PATH}/GRUB_VER" "${PART2_PATH}/"* >/dev/null 2>&1 || true