From 8e2794c1bf8f34462766aaa910d049af63178cdd Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Thu, 31 Oct 2024 10:56:49 +0100 Subject: [PATCH] update: add backup logic Signed-off-by: AuxXxilium --- files/initrd/opt/arc/include/update.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/files/initrd/opt/arc/include/update.sh b/files/initrd/opt/arc/include/update.sh index d4ec6d81..c6c6a268 100755 --- a/files/initrd/opt/arc/include/update.sh +++ b/files/initrd/opt/arc/include/update.sh @@ -430,8 +430,9 @@ function updateLKMs() { function updateOffline() { local ARCOFFLINE="$(readConfigKey "arc.offline" "${USER_CONFIG_FILE}")" 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" + [ ! -f "${CONFIGS_PATH}/offline.json" ] && cp -f "${CONFIGS_PATH}/offline.json.bak" "${CONFIGS_PATH}/offline.json" fi return 0 }