tree: more rewrite for dynamic mode

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2024-08-03 13:05:27 +02:00
parent f1ee8042dd
commit afcd73a659
4 changed files with 25 additions and 22 deletions

View File

@ -66,15 +66,7 @@ BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
ntpCheck
# Check for Dynamic Mode
if [ "${ARCDYN}" == "true" ] && [ "${OFFLINE}" == "false" ] && [ ! -f "${PART1_PATH}/dynamic" ]; then
curl -skL "https://github.com/AuxXxilium/arc/archive/refs/heads/main.zip" -o "${TMP_PATH}/main.zip"
unzip -o "${TMP_PATH}/main.zip" -d "${TMP_PATH}" 2>/dev/null
cp -rf "${TMP_PATH}/arc-main/files/initrd/opt" "${ARC_PATH}"
rm -rf "${TMP_PATH}/arc-main"
rm -f "${TMP_PATH}/main.zip"
echo "true" >"${PART1_PATH}/dynamic"
init.sh
fi
dynCheck
###############################################################################
# Mounts backtitle dynamically
@ -1158,17 +1150,7 @@ else
C) cloneLoader; NEXT="C" ;;
Y) [ "${ARCDYN}" == "false" ] && ARCDYN='true' || ARCDYN='false'
writeConfigKey "arc.dynamic" "${ARCDYN}" "${USER_CONFIG_FILE}"
if [ "${ARCDYN}" == "true" ]; then
curl -skL "https://github.com/AuxXxilium/arc/archive/refs/heads/main.zip" -o "${TMP_PATH}/main.zip"
unzip -o "${TMP_PATH}/main.zip" -d "${TMP_PATH}" 2>/dev/null
cp -rf "${TMP_PATH}/arc-main/files/initrd/opt" "${ARC_PATH}"
rm -rf "${TMP_PATH}/arc-main"
rm -f "${TMP_PATH}/main.zip"
echo "true" >"${PART1_PATH}/dynamic"
init.sh
else
rm -f "${PART1_PATH}/dynamic"
fi
dynCheck
NEXT="Y"
;;
F) formatDisks; NEXT="F" ;;

View File

@ -7,6 +7,9 @@ function bootDSM () {
# Check if machine has EFI
[ -d /sys/firmware/efi ] && EFI=1 || EFI=0
# Cleanup Dynamic Mode
[ -f "${PART1_PATH}/dynamic" ] && rm -f "${PART1_PATH}/dynamic" >/dev/null 2>&1 || true
# Print Title centralized
clear
COLUMNS=${COLUMNS:-50}

View File

@ -642,4 +642,22 @@ function systemCheck () {
fi
# Screen Timeout
checkCmdline "arc_cmdline" "nomodeset" && SCREENOFF="false" || SCREENOFF="true"
}
###############################################################################
# Check Dynamic Mode
function dynCheck () {
ARCDYN="$(readConfigKey "arc.dynamic" "${USER_CONFIG_FILE}")"
OFFLINE="$(readConfigKey "arc.offline" "${USER_CONFIG_FILE}")"
if [ "${ARCDYN}" == "true" ] && [ "${OFFLINE}" == "false" ] && [ -f "${PART1_PATH}/dynamic" ]; then
curl -skL "https://github.com/AuxXxilium/arc/archive/refs/heads/main.zip" -o "${TMP_PATH}/main.zip"
unzip -qq -o "${TMP_PATH}/main.zip" -d "${TMP_PATH}" 2>/dev/null
cp -rf "${TMP_PATH}/arc-main/files/initrd/opt" "${ARC_PATH}"
rm -rf "${TMP_PATH}/arc-main"
rm -f "${TMP_PATH}/main.zip"
echo "true" >"${PART1_PATH}/dynamic"
init.sh
else
[ -f "${PART1_PATH}/dynamic" ] && rm -f "${PART1_PATH}/dynamic" >/dev/null 2>&1 || true
fi
}

View File

@ -85,8 +85,8 @@ else
writeConfigKey "automated" "false" "${USER_CONFIG_FILE}"
fi
[ $(echo "${ARC_VERSION}" | grep -q "s" | wc -l) -gt 0 ] && writeConfigKey "arc.branch" "s" "${USER_CONFIG_FILE}" || writeConfigKey "arc.branch" "" "${USER_CONFIG_FILE}"
[ -f "${PART3_PATH}/automated" ] && rm -f "${PART3_PATH}/automated" >/dev/null
[ -f "${PART1_PATH}/dynamic" ] && rm -f "${PART1_PATH}/dynamic" >/dev/null
[ -f "${PART3_PATH}/automated" ] && rm -f "${PART3_PATH}/automated" >/dev/null 2>&1 || true
[ -f "${PART1_PATH}/dynamic" ] && rm -f "${PART1_PATH}/dynamic" >/dev/null 2>&1 || true
# Check for compatibility
compatboot