From 293d881dac3a5afe06464f00b4dfcc2166843294 Mon Sep 17 00:00:00 2001 From: Stefaan Ghysels Date: Sat, 28 Nov 2020 22:35:03 +0100 Subject: [PATCH] Improve config restoration --- wdpk/rclone/env | 2 +- wdpk/rclone/install.sh | 14 ++++++++------ wdpk/rclone/preinst.sh | 5 +++-- wdpk/rclone/web/index.html | 2 +- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/wdpk/rclone/env b/wdpk/rclone/env index 63d7b8c..14abf24 100644 --- a/wdpk/rclone/env +++ b/wdpk/rclone/env @@ -1,6 +1,6 @@ #!/bin/bash APKG_NAME=rclone -PORT=5572 +PORT=5574 RCLONE_USER=mycloud RCLONE_PW=mycloud diff --git a/wdpk/rclone/install.sh b/wdpk/rclone/install.sh index 7c0c5d6..5be446a 100755 --- a/wdpk/rclone/install.sh +++ b/wdpk/rclone/install.sh @@ -10,7 +10,7 @@ log=/tmp/debug_apkg APKG_MODULE="rclone" APKG_PATH="${path_dst}/${APKG_MODULE}" APKG_CONFIG="${APKG_PATH}/env" -APKG_BACKUP_CONFIG="/shares/Volume_1/Nas_Prog/rclone.env" +APKG_BACKUP_DIR="${path_dst}/${APKG_MODULE}_backup/" # install all package scripts to the proper location mv $path_src $path_dst @@ -38,11 +38,13 @@ chmod +x rclone-*-linux-${PLF}/rclone rm rclone-current-linux-${PLF}.zip # restore previous config -if [ -f "${APKG_BACKUP_CONFIG}" ] +if [ -d "${APKG_BACKUP_DIR}" ] then - echo "Addon NZBget (install.sh) restore configs" >> $log - cp ${APKG_BACKUP_CONFIG} ${APKG_CONFIG} - rm -f ${APKG_BACKUP_CONFIG} + echo "Restore backup for ${APKG_MODULE}" >> $log + cp ${APKG_BACKUP_DIR}/* ${APKG_PATH} + rm -rf ${APKG_BACKUP_DIR} +else + echo "No backup found for ${APKG_MODULE} in ${APKG_BACKUP_DIR}" fi -echo "Addon rclone (install.sh) done" >> $log +echo "Addon ${APKG_MODULE} (install.sh) done" >> $log diff --git a/wdpk/rclone/preinst.sh b/wdpk/rclone/preinst.sh index fd565b0..e50b60e 100755 --- a/wdpk/rclone/preinst.sh +++ b/wdpk/rclone/preinst.sh @@ -9,8 +9,9 @@ APKG_BACKUP_PATH=${APKG_PATH}/../${APKG_MODULE}_backup # backup config files and user settings -if [ ! -d ${APKG_BACKUP_PATH}] ; then +if [ ! -d ${APKG_BACKUP_PATH} ] ; then # move config to backup path mkdir -p ${APKG_BACKUP_PATH} - mv -f ${APKG_PATH}/rclone.config ${APKG_BACKUP_PATH} + mv ${APKG_PATH}/rclone.config ${APKG_BACKUP_PATH} + mv ${APKG_PATH}/env ${APKG_BACKUP_PATH} fi diff --git a/wdpk/rclone/web/index.html b/wdpk/rclone/web/index.html index 421aac6..a812f6b 100644 --- a/wdpk/rclone/web/index.html +++ b/wdpk/rclone/web/index.html @@ -7,7 +7,7 @@