From b8ea59b3e9809468161078c4ff37a9842aabf6c8 Mon Sep 17 00:00:00 2001 From: Stefaan Ghysels Date: Sat, 28 Nov 2020 01:43:03 +0100 Subject: [PATCH 1/4] Add rclone package --- wdpk/rclone/LICENSE | 20 ++++++++++++++++ wdpk/rclone/apkg.rc | 19 +++++++++++++++ wdpk/rclone/before_apkg.sh | 4 ++++ wdpk/rclone/build.sh | 28 ++++++++++++++++++++++ wdpk/rclone/clean.sh | 13 ++++++++++ wdpk/rclone/env | 6 +++++ wdpk/rclone/init.sh | 17 +++++++++++++ wdpk/rclone/install.sh | 48 +++++++++++++++++++++++++++++++++++++ wdpk/rclone/preinst.sh | 16 +++++++++++++ wdpk/rclone/remove.sh | 20 ++++++++++++++++ wdpk/rclone/start.sh | 15 ++++++++++++ wdpk/rclone/stop.sh | 4 ++++ wdpk/rclone/web/index.html | 17 +++++++++++++ wdpk/rclone/web/rclone.png | Bin 0 -> 4526 bytes 14 files changed, 227 insertions(+) create mode 100644 wdpk/rclone/LICENSE create mode 100644 wdpk/rclone/apkg.rc create mode 100755 wdpk/rclone/before_apkg.sh create mode 100755 wdpk/rclone/build.sh create mode 100755 wdpk/rclone/clean.sh create mode 100644 wdpk/rclone/env create mode 100755 wdpk/rclone/init.sh create mode 100755 wdpk/rclone/install.sh create mode 100755 wdpk/rclone/preinst.sh create mode 100755 wdpk/rclone/remove.sh create mode 100755 wdpk/rclone/start.sh create mode 100755 wdpk/rclone/stop.sh create mode 100644 wdpk/rclone/web/index.html create mode 100644 wdpk/rclone/web/rclone.png diff --git a/wdpk/rclone/LICENSE b/wdpk/rclone/LICENSE new file mode 100644 index 0000000..8c27c67 --- /dev/null +++ b/wdpk/rclone/LICENSE @@ -0,0 +1,20 @@ +Copyright (C) 2012 by Nick Craig-Wood http://www.craig-wood.com/nick/ + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/wdpk/rclone/apkg.rc b/wdpk/rclone/apkg.rc new file mode 100644 index 0000000..8a29222 --- /dev/null +++ b/wdpk/rclone/apkg.rc @@ -0,0 +1,19 @@ +Package: rclone +Version: 27.11.17 +Packager: TFL +Email: +Homepage: https://rclone.org +Description: Manage files on cloud storage, including S3, business - consumer file storage services and standard transfer protocols. +Icon: rclone.png +AddonShowName: Rclone +AddonIndexPage: index.html +AddonUsedPort: +InstDepend: +InstConflict: +StartDepend: +StartConflict: +CenterType: +UserControl: +MinFWVer: +MaxFWVer: +IndividualFlag: 0 diff --git a/wdpk/rclone/before_apkg.sh b/wdpk/rclone/before_apkg.sh new file mode 100755 index 0000000..b08115a --- /dev/null +++ b/wdpk/rclone/before_apkg.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +[ -f /tmp/debug_apkg ] && echo "APKG_DEBUG: $0 $@" >> /tmp/debug_apkg + diff --git a/wdpk/rclone/build.sh b/wdpk/rclone/build.sh new file mode 100755 index 0000000..477525a --- /dev/null +++ b/wdpk/rclone/build.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +APP_NAME="$(basename $(pwd))" +DATE="$(date +"%m%d%Y")" +CWD="$(pwd)" +VERSION="$(awk '/Version/{print $NF}' apkg.rc)" + +echo "Building ${APP_NAME} version ${VERSION}" + +RELEASE_DIR="../../packages/${APP_NAME}/OS5" +mkdir -p "${RELEASE_DIR}" + +MODELS="WDMyCloudEX4100-EX4100 WDMyCloudDL4100-DL4100 WDMyCloudEX2100-EX2100 WDMyCloudDL2100-DL2100 + WDMyCloudMirror-MirrorG2 MyCloudEX2Ultra-EX2Ultra MyCloudPR4100-PR4100 MyCloudPR2100-PR2100" + +for fullmodel in $MODELS; do + model=${fullmodel%-*} + name=${fullmodel#*-} + echo "$model $name" + ../../mksapkg-OS5 -E -s -m $model > /dev/null + mv ../${model}*.bin* "${RELEASE_DIR}/${APP_NAME}_${VERSION}_${name}.bin" +done + +echo "Bundle sources" +SRC_TAR="${RELEASE_DIR}/${APP_NAME}_${VERSION}_src.tar.gz" +tar -czf $SRC_TAR . + + diff --git a/wdpk/rclone/clean.sh b/wdpk/rclone/clean.sh new file mode 100755 index 0000000..b9d1d03 --- /dev/null +++ b/wdpk/rclone/clean.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +[ -f /tmp/debug_apkg ] && echo "APKG_DEBUG: $0 $@" >> /tmp/debug_apkg + +WEBPATH="/var/www/rclone" + +# remove bin +rm -f /usr/bin/rclone + +# remove lib + +# remove web +rm -rf $WEBPATH diff --git a/wdpk/rclone/env b/wdpk/rclone/env new file mode 100644 index 0000000..63d7b8c --- /dev/null +++ b/wdpk/rclone/env @@ -0,0 +1,6 @@ +#!/bin/bash + +APKG_NAME=rclone +PORT=5572 +RCLONE_USER=mycloud +RCLONE_PW=mycloud diff --git a/wdpk/rclone/init.sh b/wdpk/rclone/init.sh new file mode 100755 index 0000000..33e46fc --- /dev/null +++ b/wdpk/rclone/init.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +[ -f /tmp/debug_apkg ] && echo "APKG_DEBUG: $0 $@" >> /tmp/debug_apkg + +path=$1 +log=/tmp/rclone.log + +echo "INIT linking files from path: $path" >> $log + +# create link to binary +ln -sf $path/rclone-*-linux-*/rclone /usr/bin/rclone + +# create folder for the webpage +WEBPATH="/var/www/rclone/" +mkdir -p $WEBPATH +ln -sf $path/web/* $WEBPATH + diff --git a/wdpk/rclone/install.sh b/wdpk/rclone/install.sh new file mode 100755 index 0000000..7c0c5d6 --- /dev/null +++ b/wdpk/rclone/install.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +[ -f /tmp/debug_apkg] && echo "APKG_DEBUG: $0 $@" >> /tmp/debug_apkg + +path_src=$1 +path_dst=$2 + +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" + +# install all package scripts to the proper location +mv $path_src $path_dst + +# setup secure http +if [ ! -e /etc/ssl/cert.pem ]; then + curl --remote-name --time-cond cacert.pem https://curl.haxx.se/ca/cacert.pem + mv cacert.pem /etc/ssl/cert.pem +fi + +cd $path_dst/rclone + +# download the latest rclone installer +if [ "$(uname -m)" = "x86_64" ]; then + PLF=amd64 +else + PLF=arm +fi + +curl -O https://downloads.rclone.org/rclone-current-linux-${PLF}.zip +unzip rclone-current-linux-${PLF}.zip +chmod +x rclone-*-linux-${PLF}/rclone + +# remove the installer +rm rclone-current-linux-${PLF}.zip + +# restore previous config +if [ -f "${APKG_BACKUP_CONFIG}" ] +then + echo "Addon NZBget (install.sh) restore configs" >> $log + cp ${APKG_BACKUP_CONFIG} ${APKG_CONFIG} + rm -f ${APKG_BACKUP_CONFIG} +fi +echo "Addon rclone (install.sh) done" >> $log + diff --git a/wdpk/rclone/preinst.sh b/wdpk/rclone/preinst.sh new file mode 100755 index 0000000..5d61c92 --- /dev/null +++ b/wdpk/rclone/preinst.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +[ -f /tmp/debug_apkg ] && echo "APKG_DEBUG: $0 $@" >> /tmp/debug_apkg + +APKG_PATH=$1 + +APKG_MODULE="rclone" +APKG_BACKUP_PATH=${APKG_PATH}/../${APKG_MODULE}_backup + + +# backup config files and user settings +if [ ! -d ${APKG_BACKUP_PATH}] ; then + # move config to backup path + mkdir -p ${APKG_BACKUP_PATH} + mv -f $APKG_PATH/config ${APKG_BACKUP_PATH} +fi diff --git a/wdpk/rclone/remove.sh b/wdpk/rclone/remove.sh new file mode 100755 index 0000000..83c7d8d --- /dev/null +++ b/wdpk/rclone/remove.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +[ -f /tmp/debug_apkg ] && echo "APKG_DEBUG: $0 $@" >> /tmp/debug_apkg + +path=$1 + +# create a backup of the config +APKG_CONFIG="${path}/nzbget.conf" +APKG_BACKUP_CONFIG="/mnt/HD/HD_a2/.systemfile/nzbget.conf" +cp ${APKG_CONFIG} ${APKG_BACKUP_CONFIG} + +rm -rf $path + +# remove bin +rm -f /usr/bin/nzbget + +# remove lib + +# remove web +rm -rf /var/www/nzbget diff --git a/wdpk/rclone/start.sh b/wdpk/rclone/start.sh new file mode 100755 index 0000000..44cab65 --- /dev/null +++ b/wdpk/rclone/start.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +cd $(dirname $0) +source ./env + +[ ! -f /usr/bin/rclone ] echo "rclone not found" >> /tmp/debug_apkg + +[ -f /tmp/debug_apkg ] echo "APKG_DEBUG: starting Rclone" >> /tmp/debug_apkg + + + +ADDRESS=$(sed -n '/ip/ {s/.*\(\S*\)<\/ip>/\1/p;q}' /etc/NAS_CFG/config.xml ) + +# TODO: get user and pw from file +rclone rcd --rc-web-gui --rc-addr ${ADDRESS}:${PORT:-5582} --rc-user ${RCLONE_USER:-mycloud} --rc-pass ${RCLONE_PW:-mycloud} diff --git a/wdpk/rclone/stop.sh b/wdpk/rclone/stop.sh new file mode 100755 index 0000000..5636f11 --- /dev/null +++ b/wdpk/rclone/stop.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +# stop daemon +pkill rclone diff --git a/wdpk/rclone/web/index.html b/wdpk/rclone/web/index.html new file mode 100644 index 0000000..421aac6 --- /dev/null +++ b/wdpk/rclone/web/index.html @@ -0,0 +1,17 @@ + + + + + + + + + + + + diff --git a/wdpk/rclone/web/rclone.png b/wdpk/rclone/web/rclone.png new file mode 100644 index 0000000000000000000000000000000000000000..70332c0925610a631b09a405ee4437f116f34283 GIT binary patch literal 4526 zcmcgw_fr$V5)MeOQX(A$rACmBD2Oy6gxF?y{;^O5G^A6a**6|Pk zV0i@AQa2AN+AT)-m`{fGUmY(z&$9&4PUl)`*jsjyCvmXVZl*fCx>qh&Fmw5cm35_n z>OOckh?Vel3{l)z!RXr`R7g=)?fZ~jR~DfwNUJaEg~9Oi6zQU_F@&kx_oP_0AuU0> z)p+mVr|m98Kt>v}KUm zWd-9TydGOvXT0YGkF+>@(bs+!w?{#=3Q+Va0@gFynLuD3*8I>&JP|bWI=o5qk$*v= zi^@OOuF^JUu(r0HRu@Vf2rjM}iBWvpq#rxk^`?+aYPXf4mpwpVED_H8l*6gitkVhT zII7m@3wL8N!fh6r`+!{MAS>6S)ZVk3JnJ#ZgPgHw`ck^}1HYtNr^U09Jp1%pH`@81xUmo?WhU5V(TGlDJD6DAVZ7{Y>6d0f`kW?!%4bC z*o*P14wM3hg^($RsM|iSbLT5JPs`JBSgK4?d#f#oxLJX|>$vbmPT(E8&qHTJ-xQ4*dWNB(thY*N zAt)@anM|e)AB9Oa$xiKG*Yxg*5U?WFun_Nm%YBNZ!y!%SjfDo!^~E{^=<@Y&BnxM` zUnEu=;;c3-m!(JLYbr|lATTx;VF1X6oLf&z#oo?3Jp|f24hKHL0)H|mz=4e_rS>uX zDnN&_YSj?$qRa1-w@S$sbJpzgRoTscwa_+0LOq3kDc6LqWW)Vua?p;6=-QV6PdgDu zNR#=9UNjV&h_LI$^Euxe4i;9=E?9cT@QO*9Vi%JiGqb!c%qSOh94*TfHz&E zp%i9%4^Tqkt!wQ4#vIXoQ<7UACDdg(xrYr)re&`1N2{%_R_Cz$a5Huf6*pG0x*QDIgJCcu+GVWglnu=#wV0a5+d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h0_T}Pf4z<+ z8@CoB)4tt{fK1>qzB2qDX+xU2%C=T|NDuEB2EJ=#q_dgCc&upb%von}ys>S-qx3mCGBKA{!2=n)>klo>NVeJvUtLB*vuZ+}@Q|xeERJh8-}-t6IlHu3!)>;sW%h zHiZconGJ*re55_emY{u8iHFTF##5DL2Pr<+6bxXX7*W1125b1EV9QJ*1nj_q6v`4c z<;~{tt8_E{#E?kYw5alz!F${6Q3}FBijCTyxXjwVn`X7Qr9a{Q52#Ci8ENg8T`!1q zE64fF0|~pej)>jVN~qV7eBNkmG>;5$(uuCm1vn}%U2G{+Otq3smmv05i(C&=@W!?U zS!VimMAI_P)STe=Jt|Z!otOBzbWNH%FSnc58p`DF16Tgu^?v~lt_I|z&UVr$u%r(c N09e~lt6IZ8`ae8Cs$>8F literal 0 HcmV?d00001 From e310c922cae41bd7a209ad57466edc4c07df6505 Mon Sep 17 00:00:00 2001 From: Stefaan Ghysels Date: Sat, 28 Nov 2020 15:02:57 +0100 Subject: [PATCH 2/4] Improve config --- wdpk/rclone/preinst.sh | 2 +- wdpk/rclone/start.sh | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/wdpk/rclone/preinst.sh b/wdpk/rclone/preinst.sh index 5d61c92..fd565b0 100755 --- a/wdpk/rclone/preinst.sh +++ b/wdpk/rclone/preinst.sh @@ -12,5 +12,5 @@ APKG_BACKUP_PATH=${APKG_PATH}/../${APKG_MODULE}_backup if [ ! -d ${APKG_BACKUP_PATH}] ; then # move config to backup path mkdir -p ${APKG_BACKUP_PATH} - mv -f $APKG_PATH/config ${APKG_BACKUP_PATH} + mv -f ${APKG_PATH}/rclone.config ${APKG_BACKUP_PATH} fi diff --git a/wdpk/rclone/start.sh b/wdpk/rclone/start.sh index 44cab65..d216db6 100755 --- a/wdpk/rclone/start.sh +++ b/wdpk/rclone/start.sh @@ -3,6 +3,8 @@ cd $(dirname $0) source ./env +CONFIG=$(pwd)/rclone.config + [ ! -f /usr/bin/rclone ] echo "rclone not found" >> /tmp/debug_apkg [ -f /tmp/debug_apkg ] echo "APKG_DEBUG: starting Rclone" >> /tmp/debug_apkg @@ -12,4 +14,4 @@ source ./env ADDRESS=$(sed -n '/ip/ {s/.*\(\S*\)<\/ip>/\1/p;q}' /etc/NAS_CFG/config.xml ) # TODO: get user and pw from file -rclone rcd --rc-web-gui --rc-addr ${ADDRESS}:${PORT:-5582} --rc-user ${RCLONE_USER:-mycloud} --rc-pass ${RCLONE_PW:-mycloud} +rclone rcd --config ${CONFIG} --rc-web-gui --rc-addr ${ADDRESS}:${PORT:-5582} --rc-user ${RCLONE_USER:-mycloud} --rc-pass ${RCLONE_PW:-mycloud} From e0781c9183a0f598de546f89f691f35a47646fe9 Mon Sep 17 00:00:00 2001 From: Stefaan Ghysels Date: Sat, 28 Nov 2020 21:52:27 +0100 Subject: [PATCH 3/4] Use actions matrix --- .github/workflows/wdpk.yml | 62 +++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 27 deletions(-) diff --git a/.github/workflows/wdpk.yml b/.github/workflows/wdpk.yml index d3f3b8f..0a2431f 100644 --- a/.github/workflows/wdpk.yml +++ b/.github/workflows/wdpk.yml @@ -24,36 +24,46 @@ jobs: container: image: wdpk/wdpk options: -v ${{github.workspace}}/packages:/github/workspace/packages - # Steps represent a sequence of tasks that will be executed as part of the job + + # define all the OS5 supporting platforms and a prettier name + strategy: + matrix: + include: + - model: EX4100 + platform: WDMyCloudEX4100 + - model: DL4100 + platform: WDMyCloudDL4100 + - model: EX2100 + platform: WDMyCloudEX2100 + - model: DL2100 + platform: WDMyCloudDL2100 + - model: MirrorG2 + platform: WDMyCloudMirror + - model: EX2Ultra + platform: MyCloudEX2Ultra + - model: PR4100 + platform: MyCloudPR4100 + - model: PR2100 + platform: MyCloudPR2100 + + # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v2 - name: Get package that was changed in the last commit id: diff - env: - use_act: ${{ secrets.USE_ACT }}" run: | - #if [ -z "${use_act}" ]; then - echo "not using act ${use_act}" - wget ${{ github.event.pull_request.diff_url }} -O pr.diff - pkg=$(grep "^\+\+\+ b/wdpk/" pr.diff | cut -d/ -f3 | uniq) - #else - # echo "$(git show)" - # pkg=$(git diff-tree --name-only --no-commit-id -r HEAD~1 | grep ^wdpk | cut -d/ -f2 | uniq || error=true) - #fi + wget ${{ github.event.pull_request.diff_url }} -O pr.diff + pkg=$(grep "^\+\+\+ b/wdpk/" pr.diff | cut -d/ -f3 | uniq) + + # concat packages into single line pkgs="" for p in $pkg; do pkgs="${pkgs}${p} " done echo "Packages: ${pkgs}" - if [ -z "${use_act}" ]; then - echo "not using act ${use_act}" - echo ::set-output name=pkg::"${pkgs}" - else - echo "using act ${use_act}" - echo "PACKAGE=${pkgs}" >> $GITHUB_ENV - fi + echo "PACKAGE=${pkgs}" >> $GITHUB_ENV # TODO: use matrix instead - name: Get platforms @@ -65,6 +75,9 @@ jobs: - name: Make APKG packages for selected platforms id: make_apkg + env: + PLATFORM: ${{ matrix.platform }} + MODEL: ${{ matrix.model }} run: | pkg=$(echo ${PACKAGE} | cut -d' ' -f1) echo ::set-output name=pkg::"$pkg" @@ -81,15 +94,10 @@ jobs: RELEASE_DIR="../../packages/${pkg}/OS5" mkdir -p "${RELEASE_DIR}" - echo PLF $PLATFORMS - $arr - $PACKAGE - for fullmodel in $PLATFORMS - do - model=${fullmodel%-*} - name=${fullmodel#*-} - echo "Build ${pkg} for ${platform}" - ../../mksapkg-OS5 -E -s -m $model > /dev/null - mv ../${platform}*.bin\(* ../${pkg}_${VERSION}_${name}.bin - done + echo "PLF ${PLATFORM} - $arr - ${PACKAGE}" + echo "Build ${pkg} for $MODEL" + ../../mksapkg-OS5 -E -s -m ${PLATFORM} > /dev/null + mv ../${PLATFORM}*.bin\(* ../${pkg}_${VERSION}_${MODEL}.bin echo "$(ls -l ..)" - name: Upload artifacts From 293d881dac3a5afe06464f00b4dfcc2166843294 Mon Sep 17 00:00:00 2001 From: Stefaan Ghysels Date: Sat, 28 Nov 2020 22:35:03 +0100 Subject: [PATCH 4/4] 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 @@