mirror of
https://github.com/AuxXxilium/arc.git
synced 2024-11-23 23:49:52 +07:00
update: add version check
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
parent
0171dcd9ee
commit
ce8148ab3e
@ -6,6 +6,7 @@
|
||||
# Upgrade Loader
|
||||
function upgradeLoader () {
|
||||
local ARCNIC="$(readConfigKey "arc.nic" "${USER_CONFIG_FILE}")"
|
||||
local AUTOMATED="$(readConfigKey "automated" "${USER_CONFIG_FILE}")"
|
||||
TAG=""
|
||||
if [ -z "${1}" ]; then
|
||||
# Check for new Version
|
||||
@ -26,6 +27,20 @@ function upgradeLoader () {
|
||||
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
|
||||
UPDATE=$(cat "${TMP_PATH}/check.update" | sed -e 's/\.//g' )
|
||||
ARC_VERSION=$(cat "${PART1_PATH}/ARC-VERSION" | sed -e 's/\.//g' )
|
||||
if [ ${ARC_VERSION} -lt ${UPDATE} ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Upgrade Loader" \
|
||||
--yesno "Current Config not compatible to new Version!\nDo not restore Config!\nDo you want to upgrade?" 0 0
|
||||
if [ $? -eq 0 ]; then
|
||||
rm -f "${TMP_PATH}/check.update"
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
(
|
||||
# Download update file
|
||||
echo "Downloading ${TAG}"
|
||||
@ -69,6 +84,7 @@ function upgradeLoader () {
|
||||
# Update Loader
|
||||
function updateLoader() {
|
||||
local ARCNIC="$(readConfigKey "arc.nic" "${USER_CONFIG_FILE}")"
|
||||
local AUTOMATED="$(readConfigKey "automated" "${USER_CONFIG_FILE}")"
|
||||
TAG=""
|
||||
if [ -z "${1}" ]; then
|
||||
# Check for new Version
|
||||
@ -89,6 +105,25 @@ function updateLoader() {
|
||||
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
|
||||
UPDATE_VERSION=$(cat "${TMP_PATH}/check.update" | sed -e 's/\.//g' )
|
||||
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
|
||||
updateFailed
|
||||
fi
|
||||
fi
|
||||
(
|
||||
# Download update file
|
||||
echo "Downloading ${TAG}"
|
||||
|
Loading…
Reference in New Issue
Block a user