update: add backup logic

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2024-10-31 10:56:49 +01:00
parent 843fa0aa30
commit 8e2794c1bf

View File

@ -430,8 +430,9 @@ function updateLKMs() {
function updateOffline() { function updateOffline() {
local ARCOFFLINE="$(readConfigKey "arc.offline" "${USER_CONFIG_FILE}")" local ARCOFFLINE="$(readConfigKey "arc.offline" "${USER_CONFIG_FILE}")"
if [ "${ARCOFFLINE}" != "true" ]; then if [ "${ARCOFFLINE}" != "true" ]; then
rm -f "${CONFIGS_PATH}/offline.json" cp -f "${CONFIGS_PATH}/offline.json" "${CONFIGS_PATH}/offline.json.bak"
curl -skL "https://autoupdate.synology.com/os/v2" -o "${CONFIGS_PATH}/offline.json" curl -skL "https://autoupdate.synology.com/os/v2" -o "${CONFIGS_PATH}/offline.json"
[ ! -f "${CONFIGS_PATH}/offline.json" ] && cp -f "${CONFIGS_PATH}/offline.json.bak" "${CONFIGS_PATH}/offline.json"
fi fi
return 0 return 0
} }