-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from WDCommunity/rclone
Add rclone package
- Loading branch information
Showing
15 changed files
with
267 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
|
||
[ -f /tmp/debug_apkg ] && echo "APKG_DEBUG: $0 $@" >> /tmp/debug_apkg | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 . | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
APKG_NAME=rclone | ||
PORT=5574 | ||
RCLONE_USER=mycloud | ||
RCLONE_PW=mycloud |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/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_DIR="${path_dst}/${APKG_MODULE}_backup/" | ||
|
||
# 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 [ -d "${APKG_BACKUP_DIR}" ] | ||
then | ||
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 ${APKG_MODULE} (install.sh) done" >> $log | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/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 ${APKG_PATH}/rclone.config ${APKG_BACKUP_PATH} | ||
mv ${APKG_PATH}/env ${APKG_BACKUP_PATH} | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/sh | ||
|
||
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 | ||
|
||
|
||
|
||
ADDRESS=$(sed -n '/ip/ {s/.*<ip>\(\S*\)<\/ip>/\1/p;q}' /etc/NAS_CFG/config.xml ) | ||
|
||
# TODO: get user and pw from file | ||
rclone rcd --config ${CONFIG} --rc-web-gui --rc-addr ${ADDRESS}:${PORT:-5582} --rc-user ${RCLONE_USER:-mycloud} --rc-pass ${RCLONE_PW:-mycloud} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
|
||
# stop daemon | ||
pkill rclone |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | ||
<meta http-equiv="Pragma" content="no-cache"> | ||
<meta http-equiv="Cache-Control" content="no-cache"> | ||
<meta http-equiv="Expires" content=""-1> | ||
<script> | ||
function go(){ | ||
var my_url = document.domain; | ||
location.href = "http://" + my_url + ":5574"; | ||
} | ||
</script> | ||
</head> | ||
<body onload="go();"> | ||
</body> | ||
</html> | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.