mirror of
https://github.com/ViViDboarder/hassio-addon-rclone.git
synced 2024-12-22 03:27:44 +00:00
Initial working version
This commit is contained in:
parent
b64b076b53
commit
e03459a288
5
.dockerignore
Normal file
5
.dockerignore
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
*.md
|
||||||
|
icon.png
|
||||||
|
logo.svg
|
||||||
|
|
||||||
|
tags
|
15
DOCS.md
Executable file
15
DOCS.md
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
# rclone
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
|field|description|
|
||||||
|
|---|---|
|
||||||
|
|`cron`|Cron schedule to run the sync job|
|
||||||
|
|`destination`|The rclone destination in the form `<drive>:<path>`|
|
||||||
|
|`sync_command`|Rclone command to execute (`sync`, `copy`, or `move`)|
|
||||||
|
|`credentials.username`|Username to view web UI|
|
||||||
|
|`credentials.password`|Password to view web UI|
|
||||||
|
|`tls.ssl`|Enable TLS. Recommended if not using ingress|
|
||||||
|
|`tls.certfile`|TLS cert file to use|
|
||||||
|
|`tls.keyfile`|TLS key file to use|
|
||||||
|
|
14
Dockerfile
Executable file
14
Dockerfile
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
ARG BUILD_FROM=homeassistant/aarch64-base
|
||||||
|
FROM $BUILD_FROM
|
||||||
|
|
||||||
|
ENV LANG C.UTF-8
|
||||||
|
|
||||||
|
ARG BUILD_ARCH=aarch64
|
||||||
|
ARG VERSION=v1.55.1
|
||||||
|
|
||||||
|
COPY install_rclone.sh /
|
||||||
|
RUN /install_rclone.sh "${VERSION}" "${BUILD_ARCH}"
|
||||||
|
|
||||||
|
ENV XDG_CONFIG_HOME=/data
|
||||||
|
|
||||||
|
COPY rootfs /
|
5
README.md
Executable file
5
README.md
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
# Rclone addon
|
||||||
|
|
||||||
|
Sync backup snapshots to a different device using rclone
|
||||||
|
|
||||||
|
Note: Drive password must be obscured using `rclone obscure mysecretpass`
|
44
config.yml
Executable file
44
config.yml
Executable file
@ -0,0 +1,44 @@
|
|||||||
|
---
|
||||||
|
name: Rclone
|
||||||
|
version: '1.3'
|
||||||
|
slug: rclone
|
||||||
|
description: Clone snapshots to another devices
|
||||||
|
arch:
|
||||||
|
- armhf
|
||||||
|
- armv7
|
||||||
|
- aarch64
|
||||||
|
- amd64
|
||||||
|
startup: application
|
||||||
|
boot: auto
|
||||||
|
ingress: true
|
||||||
|
ingress_port: 5572
|
||||||
|
#webui: http://[HOST]:[PORT:3000]
|
||||||
|
ports:
|
||||||
|
5572/tcp: null
|
||||||
|
ports_description:
|
||||||
|
5572/tcp: Web configuration GUI (not required for ingress)
|
||||||
|
map:
|
||||||
|
- backup:ro
|
||||||
|
- ssl:ro
|
||||||
|
options:
|
||||||
|
cron: "0 * * * *"
|
||||||
|
destination: "<drive>:<path>"
|
||||||
|
sync_command: sync
|
||||||
|
credentials:
|
||||||
|
username: homeassistant
|
||||||
|
password: homeassistant
|
||||||
|
tls:
|
||||||
|
ssl: false
|
||||||
|
certfile: fullchain.pem
|
||||||
|
keyfile: privkey.pem
|
||||||
|
schema:
|
||||||
|
cron: str
|
||||||
|
destination: str
|
||||||
|
sync_command: list(sync|copy|move)
|
||||||
|
credentials:
|
||||||
|
username: str
|
||||||
|
password: str
|
||||||
|
tls:
|
||||||
|
ssl: bool
|
||||||
|
certfile: str
|
||||||
|
keyfile: str
|
31
install_rclone.sh
Executable file
31
install_rclone.sh
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
#! /bin/ash
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
VERSION="$1"
|
||||||
|
ARCH="$2"
|
||||||
|
|
||||||
|
# Transform relevant archs
|
||||||
|
case $ARCH in
|
||||||
|
armhf)
|
||||||
|
ARCH=arm
|
||||||
|
;;
|
||||||
|
armv7)
|
||||||
|
ARCH=arm-v7
|
||||||
|
;;
|
||||||
|
aarch64)
|
||||||
|
ARCH=arm64
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
RCLONE_NAME=rclone-${VERSION}-linux-${ARCH}
|
||||||
|
|
||||||
|
# Download
|
||||||
|
curl -o rclone.zip https://downloads.rclone.org/${VERSION}/${RCLONE_NAME}.zip
|
||||||
|
|
||||||
|
# Install
|
||||||
|
unzip rclone.zip
|
||||||
|
mv ${RCLONE_NAME}/rclone /usr/local/bin/
|
||||||
|
|
||||||
|
# Clean up
|
||||||
|
rm rclone.zip
|
||||||
|
rm -fr ${RCLONE_NAME}
|
43
logo.svg
Executable file
43
logo.svg
Executable file
@ -0,0 +1,43 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
<svg width="100%" height="100%" viewBox="0 0 226 53" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421;">
|
||||||
|
<g transform="matrix(1,0,0,1,-301,-662)">
|
||||||
|
<g id="logo_on_dark__horizontal_color" transform="matrix(0.879377,0,0,0.619048,288.689,304.814)">
|
||||||
|
<rect x="14" y="579" width="257" height="84" style="fill:none;"/>
|
||||||
|
<clipPath id="_clip1">
|
||||||
|
<rect x="14" y="579" width="257" height="84"/>
|
||||||
|
</clipPath>
|
||||||
|
<g clip-path="url(#_clip1)">
|
||||||
|
<g transform="matrix(1.13717,0,0,1.61538,-414.712,-364.725)">
|
||||||
|
<g transform="matrix(0.775519,0,0,0.775519,428.888,631.261)">
|
||||||
|
<path d="M0,-26.524C-2.206,-30.345 -5.416,-33.225 -9.105,-35.023C-9.577,-32.503 -10.47,-30.019 -11.823,-27.675L-13.958,-23.97C-12.536,-23.18 -11.298,-22.017 -10.425,-20.505C-7.86,-16.063 -9.383,-10.381 -13.826,-7.816C-18.268,-5.251 -23.95,-6.773 -26.515,-11.216L-30.823,-18.666L-37.775,-18.666L-41.251,-12.646L-36.94,-5.197C-31.05,5.004 -18.007,8.499 -7.806,2.609C2.394,-3.28 5.889,-16.323 0,-26.524" style="fill:rgb(112,202,242);fill-rule:nonzero;"/>
|
||||||
|
</g>
|
||||||
|
<g transform="matrix(0.775519,0,0,0.775519,412.322,610.24)">
|
||||||
|
<path d="M0,-30.703C-10.201,-36.592 -23.244,-33.097 -29.133,-22.897C-31.34,-19.076 -32.228,-14.856 -31.941,-10.762C-29.523,-11.613 -26.925,-12.082 -24.218,-12.082L-19.943,-12.086C-19.97,-13.712 -19.581,-15.366 -18.709,-16.877C-16.143,-21.32 -10.462,-22.843 -6.019,-20.277C-1.576,-17.712 -0.054,-12.031 -2.619,-7.588L-6.916,-0.132L-3.441,5.889L3.511,5.888L7.806,-1.57C13.696,-11.77 10.201,-24.814 0,-30.703" style="fill:rgb(180,227,249);fill-rule:nonzero;"/>
|
||||||
|
</g>
|
||||||
|
<g transform="matrix(0.775519,0,0,0.775519,398.898,609.91)">
|
||||||
|
<path d="M0,23.335L-2.142,19.634C-3.537,20.471 -5.163,20.961 -6.908,20.961C-12.039,20.961 -16.198,16.802 -16.198,11.671C-16.198,6.541 -12.039,2.382 -6.908,2.382L1.697,2.376L5.174,-3.644L1.697,-9.664L-6.909,-9.656C-18.688,-9.656 -28.236,-0.107 -28.236,11.671C-28.236,23.45 -18.688,32.999 -6.909,32.999C-2.498,32.999 1.599,31.659 5,29.366C3.054,27.697 1.353,25.678 0,23.335" style="fill:rgb(63,121,173);fill-rule:nonzero;"/>
|
||||||
|
</g>
|
||||||
|
<g transform="matrix(0.775519,0,0,0.775519,456.352,608.959)">
|
||||||
|
<path d="M0,1.359C6.116,1.359 10.664,-1.725 10.664,-7.005L10.664,-7.109C10.664,-12.023 6.795,-15.107 0.157,-15.107L-12.337,-15.107L-12.337,1.359L0,1.359ZM-15.055,-17.617L0.314,-17.617C4.809,-17.617 8.416,-16.205 10.612,-14.009C12.337,-12.284 13.382,-9.828 13.382,-7.214L13.382,-7.109C13.382,-0.993 8.835,2.509 2.666,3.346L14.741,18.976L11.291,18.976L-0.366,3.816L-0.471,3.816L-12.337,3.816L-12.337,18.976L-15.055,18.976L-15.055,-17.617Z" style="fill:white;fill-rule:nonzero;"/>
|
||||||
|
</g>
|
||||||
|
<g transform="matrix(0.775519,0,0,0.775519,469.485,609.405)">
|
||||||
|
<path d="M0,0.209L0,0.105C0,-10.298 7.841,-18.819 19.08,-18.819C25.98,-18.819 30.11,-16.519 33.508,-13.173L28.385,-7.266C25.562,-9.828 22.687,-11.396 19.028,-11.396C12.859,-11.396 8.416,-6.273 8.416,0L8.416,0.105C8.416,6.378 12.755,11.605 19.028,11.605C23.21,11.605 25.771,9.932 28.646,7.318L33.77,12.493C30.005,16.519 25.823,19.028 18.766,19.028C7.998,19.028 0,10.716 0,0.209" style="fill:white;fill-rule:nonzero;"/>
|
||||||
|
</g>
|
||||||
|
<g transform="matrix(0.775519,0,0,0.775519,498.225,623.675)">
|
||||||
|
<path d="M0,-36.592L8.05,-36.592L8.05,-7.318L26.294,-7.318L26.294,0L0,0L0,-36.592Z" style="fill:white;fill-rule:nonzero;"/>
|
||||||
|
</g>
|
||||||
|
<g transform="matrix(0.775519,0,0,0.775519,541.639,609.405)">
|
||||||
|
<path d="M0,0.209L0,0.105C0,-6.168 -4.599,-11.396 -11.082,-11.396C-17.563,-11.396 -22.06,-6.273 -22.06,0L-22.06,0.105C-22.06,6.378 -17.459,11.605 -10.977,11.605C-4.495,11.605 0,6.482 0,0.209M-30.475,0.209L-30.475,0.105C-30.475,-10.298 -22.268,-18.819 -10.977,-18.819C0.314,-18.819 8.416,-10.403 8.416,0L8.416,0.105C8.416,10.507 0.21,19.028 -11.082,19.028C-22.373,19.028 -30.475,10.612 -30.475,0.209" style="fill:white;fill-rule:nonzero;"/>
|
||||||
|
</g>
|
||||||
|
<g transform="matrix(0.775519,0,0,0.775519,551.284,623.675)">
|
||||||
|
<path d="M0,-36.592L7.424,-36.592L24.57,-14.062L24.57,-36.592L32.515,-36.592L32.515,0L25.667,0L7.947,-23.262L7.947,0L0,0L0,-36.592Z" style="fill:white;fill-rule:nonzero;"/>
|
||||||
|
</g>
|
||||||
|
<g transform="matrix(0.775519,0,0,0.775519,580.876,623.675)">
|
||||||
|
<path d="M0,-36.592L27.601,-36.592L27.601,-29.43L7.997,-29.43L7.997,-22.008L25.248,-22.008L25.248,-14.846L7.997,-14.846L7.997,-7.162L27.862,-7.162L27.862,0L0,0L0,-36.592Z" style="fill:white;fill-rule:nonzero;"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 5.2 KiB |
14
rootfs/etc/cont-init.d/rclone.sh
Executable file
14
rootfs/etc/cont-init.d/rclone.sh
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#! /usr/bin/with-contenv bashio
|
||||||
|
|
||||||
|
bashio::log.info "Configuring rclone..."
|
||||||
|
|
||||||
|
sync_command=$(bashio::config 'sync_command')
|
||||||
|
destination=$(bashio::config 'destination')
|
||||||
|
|
||||||
|
username=$(bashio::config 'credentials.username')
|
||||||
|
password=$(bashio::config 'credentials.password')
|
||||||
|
|
||||||
|
command="rclone rc --user \"$username\" --pass \"$password\" sync/$sync_command srcFs=/backup dstFs=$destination _async=true"
|
||||||
|
|
||||||
|
echo "$(bashio::config 'cron') $command" > /etc/crontabs/root
|
||||||
|
crontab -l
|
5
rootfs/etc/services.d/cron/finish
Executable file
5
rootfs/etc/services.d/cron/finish
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/execlineb -S0
|
||||||
|
if { s6-test ${1} -ne 0 }
|
||||||
|
if { s6-test ${1} -ne 256 }
|
||||||
|
|
||||||
|
s6-svscanctl -t /var/run/s6/services
|
5
rootfs/etc/services.d/cron/run
Executable file
5
rootfs/etc/services.d/cron/run
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#! /usr/bin/with-contenv bashio
|
||||||
|
|
||||||
|
bashio::log.info "Starting cron..."
|
||||||
|
|
||||||
|
exec crond -f -l 8
|
5
rootfs/etc/services.d/web/finish
Executable file
5
rootfs/etc/services.d/web/finish
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/execlineb -S0
|
||||||
|
if { s6-test ${1} -ne 0 }
|
||||||
|
if { s6-test ${1} -ne 256 }
|
||||||
|
|
||||||
|
s6-svscanctl -t /var/run/s6/services
|
19
rootfs/etc/services.d/web/run
Executable file
19
rootfs/etc/services.d/web/run
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
#! /usr/bin/with-contenv bashio
|
||||||
|
|
||||||
|
bashio::log.info "Starting rclone web..."
|
||||||
|
|
||||||
|
# TODO: Something with UN and PASS
|
||||||
|
# Maybe switch to --rc-no-auth and use proxy
|
||||||
|
username=$(bashio::config 'credentials.username')
|
||||||
|
password=$(bashio::config 'credentials.password')
|
||||||
|
|
||||||
|
# TODO: Add cert paths here if ssl is true
|
||||||
|
|
||||||
|
exec rclone rcd \
|
||||||
|
--rc-web-gui \
|
||||||
|
--rc-serve \
|
||||||
|
--rc-addr :5572 \
|
||||||
|
--rc-user "$username" \
|
||||||
|
--rc-pass "$password" \
|
||||||
|
--rc-web-gui-update \
|
||||||
|
--rc-web-gui-no-open-browser
|
Loading…
Reference in New Issue
Block a user