Skip to content

Commit

Permalink
Improve config restoration
Browse files Browse the repository at this point in the history
  • Loading branch information
stefaang committed Nov 28, 2020
1 parent e0781c9 commit 293d881
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion wdpk/rclone/env
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

APKG_NAME=rclone
PORT=5572
PORT=5574
RCLONE_USER=mycloud
RCLONE_PW=mycloud
14 changes: 8 additions & 6 deletions wdpk/rclone/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

5 changes: 3 additions & 2 deletions wdpk/rclone/preinst.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion wdpk/rclone/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<script>
function go(){
var my_url = document.domain;
location.href = "http://" + my_url + ":5572";
location.href = "http://" + my_url + ":5574";
}
</script>
</head>
Expand Down

0 comments on commit 293d881

Please sign in to comment.