mirror of
https://github.com/AuxXxilium/arc.git
synced 2024-11-24 00:29:53 +07:00
tree: rework functions
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
parent
9ee2b6cc23
commit
686b894e91
@ -330,9 +330,9 @@ function arcVersion() {
|
||||
[ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ] && VALID="true"
|
||||
fi
|
||||
fi
|
||||
MSG="Model and Version selected!\nDo you want to try Automated Mode for Config?"
|
||||
MSG="Do you want to try Automated Mode for Config?\nIf yes, Loader will configure, build and boot DSM."
|
||||
dialog --backtitle "$(backtitle)" --colors --title "Automated Mode" \
|
||||
--yesno "${MSG}" 6 50
|
||||
--yesno "${MSG}" 6 55
|
||||
if [ $? -eq 0 ]; then
|
||||
AUTOMATED="true"
|
||||
else
|
||||
|
@ -220,6 +220,27 @@ function updateAddons() {
|
||||
local TAG="${1}"
|
||||
fi
|
||||
if [ -n "${TAG}" ]; then
|
||||
curl -skL "https://github.com/AuxXxilium/arc/releases/download/${TAG}/check.update" -o "${TMP_PATH}/check.update"
|
||||
if [ -f "${TMP_PATH}/check.update" ]; then
|
||||
local UPDATE_VERSION=$(cat "${TMP_PATH}/check.update" | sed -e 's/\.//g' )
|
||||
local ARC_VERSION=$(cat "${PART1_PATH}/ARC-VERSION" | sed -e 's/\.//g' )
|
||||
if [ ${ARC_VERSION} -lt ${UPDATE_VERSION} ] && [ "${AUTOMATED}" == "false" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Upgrade Loader" \
|
||||
--yesno "Config is not compatible to new Version!\nPlease reconfigure Loader after Update!\nDo you want to update?" 0 0
|
||||
if [ $? -eq 0 ]; then
|
||||
rm -f "${TMP_PATH}/check.update"
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
elif [ ${ARC_VERSION} -lt ${UPDATE_VERSION} ] && [ "${AUTOMATED}" == "true" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Update Loader" \
|
||||
--infobox "Config is not compatible to new Version!\nUpdate not possible!\nPlease reflash Loader." 0 0
|
||||
sleep 5
|
||||
updateFaileddialog
|
||||
fi
|
||||
else
|
||||
updateFaileddialog
|
||||
fi
|
||||
(
|
||||
# Download update file
|
||||
echo "Downloading ${TAG}"
|
||||
|
@ -55,6 +55,12 @@ function backtitle() {
|
||||
###############################################################################
|
||||
# Auto Update Loader
|
||||
function arcUpdate() {
|
||||
if grep -q "update_arc" /proc/cmdline; then
|
||||
UPDATEMODE="true"
|
||||
else
|
||||
UPDATEMODE="false"
|
||||
fi
|
||||
FAILED="false"
|
||||
if echo "${ARC_VERSION}" | grep -q "dev"; then
|
||||
dialog --backtitle "$(backtitle)" --title "Update Loader" --aspect 18 \
|
||||
--infobox "Development Version detected." 0 0
|
||||
@ -63,12 +69,30 @@ function arcUpdate() {
|
||||
fi
|
||||
# Automatic Update
|
||||
[ "${DEV}" == "true" ] && updateLoader "${ARC_VERSION}" || updateLoader
|
||||
updateAddons
|
||||
updateConfigs
|
||||
updateLKMs
|
||||
updateModules
|
||||
updatePatches
|
||||
updateCustom
|
||||
[ $? -ne 0 ] && FAILED="true"
|
||||
[ "${FAILED}" == "false" ] && updateAddons || true
|
||||
[ $? -ne 0 ] && FAILED="true"
|
||||
[ "${FAILED}" == "false" ] && updateConfigs || true
|
||||
[ $? -ne 0 ] && FAILED="true"
|
||||
[ "${FAILED}" == "false" ] && updateLKMs || true
|
||||
[ $? -ne 0 ] && FAILED="true"
|
||||
[ "${FAILED}" == "false" ] && updateModules || true
|
||||
[ $? -ne 0 ] && FAILED="true"
|
||||
[ "${FAILED}" == "false" ] && updatePatches || true
|
||||
[ $? -ne 0 ] && FAILED="true"
|
||||
[ "${FAILED}" == "false" ] && updateCustom || true
|
||||
[ $? -ne 0 ] && FAILED="true"
|
||||
if [ "${FAILED}" == "true" ] && [ "${UPDATEMODE}" == "true" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Update Loader" --aspect 18 \
|
||||
--infobox "Update failed!\nPlease try again later." 0 0
|
||||
sleep 3
|
||||
exec reboot
|
||||
elif [ "${FAILED}" == "true" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Update Loader" --aspect 18 \
|
||||
--infobox "Update failed!\nRebooting to Config Mode..." 0 0
|
||||
sleep 3
|
||||
rebootTo config
|
||||
fi
|
||||
# Ask for Boot
|
||||
dialog --backtitle "$(backtitle)" --title "Update Loader" --aspect 18 \
|
||||
--infobox "Update successful!" 0 0
|
||||
@ -102,5 +126,5 @@ else
|
||||
dialog --backtitle "$(backtitle)" --title "Update Loader" --aspect 18 \
|
||||
--infobox "Offline Mode enabled.\nCan't Update Loader!" 0 0
|
||||
sleep 5
|
||||
. ${ARC_PATH}/boot.sh
|
||||
exec reboot
|
||||
fi
|
Loading…
Reference in New Issue
Block a user