init
This commit is contained in:
20
rsync-local/CHANGELOG.md
Normal file
20
rsync-local/CHANGELOG.md
Normal file
@@ -0,0 +1,20 @@
|
||||
## 1.3.0 - 2021-04-02
|
||||
|
||||
* 🔨 Use ghcr.io/home-assistant for base images
|
||||
|
||||
|
||||
## 1.2.0 - 2021-02-27
|
||||
|
||||
* 🔼 Update rsync to `3.2.3-r1`
|
||||
* 🔼 Update alpine to `3.13`
|
||||
* 🔼 Update coreutils to `8.32-r2`
|
||||
|
||||
|
||||
## 1.0.1 - 2021-02-09
|
||||
|
||||
* 🔨 Migrate to new `devices` option format. Thanks @LiJu09
|
||||
|
||||
|
||||
## 1.0.0 - 2019-10-28
|
||||
|
||||
* ➕ Introduced local rsync addon
|
||||
45
rsync-local/DOCS.md
Normal file
45
rsync-local/DOCS.md
Normal file
@@ -0,0 +1,45 @@
|
||||
## Security
|
||||
|
||||
In order to mount your external device the integrated AppArmor feature is disabled.
|
||||
This addon has access to the devices with the path from the available `external_device` config option!
|
||||
|
||||
## Config
|
||||
|
||||
Example config:
|
||||
|
||||
```yaml
|
||||
folders:
|
||||
- /config
|
||||
external_folder: backup
|
||||
external_device: ''
|
||||
```
|
||||
|
||||
### `folders`
|
||||
|
||||
The list of folders you want to sync with the remote machine. Those locations are getting synced recursively.
|
||||
|
||||
When a folder is specified with a slash at the end the content are directly copied inside the remote_folder.
|
||||
Without it a folder with the content is created.
|
||||
|
||||
For example:
|
||||
|
||||
* `- /config` would result into `/home/user/config`
|
||||
* `- /config/` would put the content of config into `/home/user`
|
||||
|
||||
### `external_folder`
|
||||
|
||||
The base folder on the external usb drive or usb stick for syncing the folders. Sub-folders with the folders from above will be created there.
|
||||
This path should not start with `/`.
|
||||
|
||||
### `external_device`
|
||||
|
||||
If you need to pin down a specific device to make your backup too, here is the option. Per default the device is `/dev/sda1`.
|
||||
Make sure to adjust it when for example running Home Assistant from a external drive. The `sda1` will be a partition of the Home Assistant drive.
|
||||
|
||||
If no device is specified all available devices will be displayed in the log. No sync takes place without device.
|
||||
|
||||
Available options: `/dev/sda1`, `/dev/sda2`, `/dev/sdb1`, `/dev/sdb2`
|
||||
|
||||
### `options` (optional)
|
||||
|
||||
Use your own options for rsync. This string is replacing the default one and get directly to rsync. The default is `-archive --recursive --compress --delete --prune-empty-dirs`.
|
||||
12
rsync-local/Dockerfile
Normal file
12
rsync-local/Dockerfile
Normal file
@@ -0,0 +1,12 @@
|
||||
ARG BUILD_FROM
|
||||
FROM $BUILD_FROM AS RUNNING
|
||||
|
||||
RUN apk update && \
|
||||
apk add --no-cache \
|
||||
'rsync=3.2.3-r1' \
|
||||
'coreutils=8.32-r2'
|
||||
|
||||
COPY run.sh /
|
||||
RUN chmod a+x /run.sh
|
||||
ENTRYPOINT [ "/run.sh" ]
|
||||
|
||||
25
rsync-local/README.md
Normal file
25
rsync-local/README.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# rsync local (Home Assistant Addon)
|
||||
|
||||
Sync folders to a external usb drive with rsync.
|
||||
|
||||
![Addon Stage][stage-badge]
|
||||
![Supports aarch64 Architecture][aarch64-badge]
|
||||
![Supports amd64 Architecture][amd64-badge]
|
||||
![Supports armhf Architecture][armhf-badge]
|
||||
![Supports armv7 Architecture][armv7-badge]
|
||||
![Supports i386 Architecture][i386-badge]
|
||||
|
||||
[![Install on my Home Assistant][install-badge]][install-url]
|
||||
[![Donate][donation-badge]][donation-url]
|
||||
|
||||
[aarch64-badge]: https://img.shields.io/badge/aarch64-yes-green.svg?style=for-the-badge
|
||||
[amd64-badge]: https://img.shields.io/badge/amd64-yes-green.svg?style=for-the-badge
|
||||
[armhf-badge]: https://img.shields.io/badge/armhf-yes-green.svg?style=for-the-badge
|
||||
[armv7-badge]: https://img.shields.io/badge/armv7-yes-green.svg?style=for-the-badge
|
||||
[i386-badge]: https://img.shields.io/badge/i386-yes-green.svg?style=for-the-badge
|
||||
[install-url]: https://my.home-assistant.io/redirect/supervisor_addon?addon=243ffc37_rsync-local
|
||||
[stage-badge]: https://img.shields.io/badge/Addon%20stage-stable-green.svg?style=for-the-badge
|
||||
|
||||
[install-badge]: https://img.shields.io/badge/Install%20on%20my-Home%20Assistant-41BDF5?logo=home-assistant&style=for-the-badge
|
||||
[donation-badge]: https://img.shields.io/badge/Buy%20me%20a%20coffee-%23d32f2f?logo=buy-me-a-coffee&style=for-the-badge&logoColor=white
|
||||
[donation-url]: https://www.buymeacoffee.com/Poeschl
|
||||
9
rsync-local/build.json
Normal file
9
rsync-local/build.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"build_from": {
|
||||
"armhf": "ghcr.io/home-assistant/armhf-base:3.13",
|
||||
"armv7": "ghcr.io/home-assistant/armv7-base:3.13",
|
||||
"aarch64": "ghcr.io/home-assistant/aarch64-base:3.13",
|
||||
"amd64": "ghcr.io/home-assistant/amd64-base:3.13",
|
||||
"i386": "ghcr.io/home-assistant/i386-base:3.13"
|
||||
}
|
||||
}
|
||||
48
rsync-local/config.json
Normal file
48
rsync-local/config.json
Normal file
@@ -0,0 +1,48 @@
|
||||
|
||||
{
|
||||
"name": "rsync local",
|
||||
"version": "1.3.0",
|
||||
"slug": "rsync-local",
|
||||
"description": "Sync folders to a external usb drive with rsync.",
|
||||
"url": "https://github.com/Poeschl/Hassio-Addons/tree/master/rsync-local",
|
||||
"arch": [
|
||||
"armhf",
|
||||
"armv7",
|
||||
"aarch64",
|
||||
"amd64",
|
||||
"i386"
|
||||
],
|
||||
"homeassistant": "0.115.0",
|
||||
"startup": "application",
|
||||
"boot": "manual",
|
||||
"init":false,
|
||||
"image": "ghcr.io/poeschl/ha-rsync-local-{arch}",
|
||||
"ports": {},
|
||||
"map": [
|
||||
"share:rw",
|
||||
"config:rw",
|
||||
"backup:rw",
|
||||
"addons:rw",
|
||||
"ssl:rw",
|
||||
"media:rw"
|
||||
],
|
||||
"devices":[
|
||||
"/dev/sda1",
|
||||
"/dev/sda2",
|
||||
"/dev/sdb1",
|
||||
"/dev/sdb2"
|
||||
],
|
||||
"privileged":["SYS_ADMIN"],
|
||||
"apparmor": false,
|
||||
"schema": {
|
||||
"folders":["str"],
|
||||
"external_folder":"match(^[^/].+)",
|
||||
"external_device":"match(^(/dev/sd[a|b][1|2])?)",
|
||||
"options":"str?"
|
||||
},
|
||||
"options": {
|
||||
"folders":["/config"],
|
||||
"external_folder":"backup",
|
||||
"external_device":""
|
||||
}
|
||||
}
|
||||
BIN
rsync-local/icon.png
Normal file
BIN
rsync-local/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
BIN
rsync-local/logo.png
Normal file
BIN
rsync-local/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
41
rsync-local/run.sh
Normal file
41
rsync-local/run.sh
Normal file
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env bashio
|
||||
# shellcheck shell=bash
|
||||
set -e
|
||||
|
||||
FOLDERS=$(bashio::config 'folders')
|
||||
EXTERNAL_FOLDER=$(bashio::config 'external_folder')
|
||||
|
||||
if ! bashio::config.has_value 'external_device'; then
|
||||
bashio::log.info "Detected devices..."
|
||||
ls -h1 /dev/sd*
|
||||
|
||||
bashio::log.info "Select your device and insert it in the 'external_device' addon option."
|
||||
bashio::log.info "For example: \"External_device: /dev/sda1\""
|
||||
bashio::log.info "Then restart the addon for the first sync."
|
||||
|
||||
else
|
||||
bashio::log.info "Starting sync..."
|
||||
EXTERNAL_DEVICE=$(bashio::config 'external_device')
|
||||
|
||||
if bashio::config.has_value 'options'; then
|
||||
OPTIONS=$(bashio::config 'options')
|
||||
bashio::log.info "Use options $OPTIONS"
|
||||
else
|
||||
OPTIONS='-archive --recursive --compress --delete --prune-empty-dirs'
|
||||
fi
|
||||
|
||||
bashio::log.info "Mounting device ${EXTERNAL_DEVICE}"
|
||||
mkdir -p /external
|
||||
mount "${EXTERNAL_DEVICE}" /external
|
||||
|
||||
for folder in $FOLDERS; do
|
||||
|
||||
bashio::log.info "Sync $folder -> ${EXTERNAL_DEVICE}/${EXTERNAL_FOLDER}"
|
||||
# shellcheck disable=SC2086
|
||||
rsync ${OPTIONS} \
|
||||
"$folder" "/external/${EXTERNAL_FOLDER}"
|
||||
done
|
||||
|
||||
umount /external
|
||||
bashio::log.info "Synced all folders"
|
||||
fi
|
||||
Reference in New Issue
Block a user