init
This commit is contained in:
28
rsync/CHANGELOG.md
Normal file
28
rsync/CHANGELOG.md
Normal file
@@ -0,0 +1,28 @@
|
||||
## 1.3.0 - 2021-04-02
|
||||
|
||||
* 🔨 Use ghcr.io/home-assistant for base images
|
||||
* 🔼 Update openssh-client to `8.4_p1-r3`
|
||||
|
||||
|
||||
## 1.2.0 - 2021-02-27
|
||||
|
||||
* 🔼 Update rsync to `3.2.3-r1`
|
||||
* 🔼 Update alpine to `3.13`
|
||||
* 🔼 Update coreutils to `8.32-r2`
|
||||
* 🔼 Update openssh-client to `8.4_p1-r2`
|
||||
|
||||
|
||||
## 1.1.1 - 2020-10-22
|
||||
|
||||
* 🔨 Disable S6-Overlay Init
|
||||
|
||||
|
||||
## 1.1.0 - 2019-10-12
|
||||
|
||||
* ➕ Introduced option for own rsync flags.
|
||||
* 🔨 Updated Docs for folders
|
||||
|
||||
|
||||
## 1.0.0 - 2019-10-10
|
||||
|
||||
* ➕ Introduced rsync addon
|
||||
58
rsync/DOCS.md
Normal file
58
rsync/DOCS.md
Normal file
@@ -0,0 +1,58 @@
|
||||
## Precondition
|
||||
|
||||
Make sure to have `rsync` installed on the remote machine. In case the addon gives you an `bash: rsync: command not found` in the logs `rsync` is missing there.
|
||||
|
||||
## Key files
|
||||
|
||||
The addon generates its own key files when no file is found at the specified location. If you use your own key make sure it is passwordless.
|
||||
|
||||
## Config
|
||||
|
||||
Example config:
|
||||
|
||||
```yaml
|
||||
private_key_file: /ssl/rsync/id_rsa
|
||||
username: user
|
||||
folders:
|
||||
- /config
|
||||
remote_host: ''
|
||||
remote_folder: /home/user
|
||||
|
||||
```
|
||||
|
||||
### `private_key_file`
|
||||
|
||||
The private key for the authentification on the remote machine. It specifies also the location of the generated key-pair if no key file is found.
|
||||
The location of the file is fixed to the `/ssl` volume.
|
||||
|
||||
### `username`
|
||||
|
||||
The username for the user on the remote machine the key is accepted.
|
||||
|
||||
### `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`
|
||||
|
||||
### `remote_host`
|
||||
|
||||
The ip or host of the remote machine you want to connect to.
|
||||
|
||||
### `remote_port` (optional)
|
||||
|
||||
The ssh port on the remote machine. If not set the default `22` is assumed.
|
||||
|
||||
### `remote_folder`
|
||||
|
||||
The base folder on the remote machine for syncing the folders. Sub-folders with the folders from above will be created there
|
||||
|
||||
### `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`.
|
||||
13
rsync/Dockerfile
Normal file
13
rsync/Dockerfile
Normal file
@@ -0,0 +1,13 @@
|
||||
ARG BUILD_FROM
|
||||
FROM $BUILD_FROM AS RUNNING
|
||||
|
||||
RUN apk update && \
|
||||
apk add --no-cache \
|
||||
'rsync=3.2.3-r1' \
|
||||
'openssh-client=8.4_p1-r3' \
|
||||
'coreutils=8.32-r2'
|
||||
|
||||
COPY run.sh /
|
||||
RUN chmod a+x /run.sh
|
||||
ENTRYPOINT [ "/run.sh" ]
|
||||
|
||||
26
rsync/README.md
Normal file
26
rsync/README.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# rsync (Home Assistant Addon)
|
||||
|
||||
Sync folders to a remote machine via ssh and 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
|
||||
[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/build.json
Normal file
9
rsync/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"
|
||||
}
|
||||
}
|
||||
45
rsync/config.json
Normal file
45
rsync/config.json
Normal file
@@ -0,0 +1,45 @@
|
||||
|
||||
{
|
||||
"name": "rsync",
|
||||
"version": "1.3.0",
|
||||
"slug": "rsync",
|
||||
"description": "Sync folders to a remote machine via ssh and rsync.",
|
||||
"url": "https://github.com/Poeschl/Hassio-Addons/tree/master/rsync",
|
||||
"arch": [
|
||||
"armhf",
|
||||
"armv7",
|
||||
"aarch64",
|
||||
"amd64",
|
||||
"i386"
|
||||
],
|
||||
"homeassistant": "0.115.0",
|
||||
"startup": "application",
|
||||
"boot": "manual",
|
||||
"init":false,
|
||||
"image": "ghcr.io/poeschl/ha-rsync-{arch}",
|
||||
"ports": {},
|
||||
"map": [
|
||||
"share:rw",
|
||||
"config:rw",
|
||||
"backup:rw",
|
||||
"addons:rw",
|
||||
"ssl:rw",
|
||||
"media:rw"
|
||||
],
|
||||
"schema": {
|
||||
"private_key_file":"match(^/ssl/.+)",
|
||||
"username":"str",
|
||||
"folders":["str"],
|
||||
"remote_host":"str",
|
||||
"remote_port":"port?",
|
||||
"remote_folder":"str",
|
||||
"options":"str?"
|
||||
},
|
||||
"options": {
|
||||
"private_key_file":"/ssl/rsync/id_rsa",
|
||||
"username":"user",
|
||||
"folders":["/config"],
|
||||
"remote_host":"",
|
||||
"remote_folder":"/home/user"
|
||||
}
|
||||
}
|
||||
BIN
rsync/icon.png
Normal file
BIN
rsync/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
BIN
rsync/logo.png
Normal file
BIN
rsync/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
46
rsync/run.sh
Normal file
46
rsync/run.sh
Normal file
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env bashio
|
||||
# shellcheck shell=bash
|
||||
|
||||
set -e
|
||||
|
||||
PRIVATE_KEY_FILE=$(bashio::config 'private_key_file')
|
||||
if [ ! -f "$PRIVATE_KEY_FILE" ]; then
|
||||
bashio::log.info 'Generate keypair'
|
||||
|
||||
mkdir -p "$(dirname "$PRIVATE_KEY_FILE")"
|
||||
ssh-keygen -t rsa -b 4096 -f "$PRIVATE_KEY_FILE" -N ''
|
||||
|
||||
bashio::log.info "Generated key-pair in $PRIVATE_KEY_FILE"
|
||||
else
|
||||
bashio::log.info "Use private key from $PRIVATE_KEY_FILE"
|
||||
fi
|
||||
|
||||
HOST=$(bashio::config 'remote_host')
|
||||
USERNAME=$(bashio::config 'username')
|
||||
FOLDERS=$(bashio::config 'folders')
|
||||
REMOTE_FOLDER=$(bashio::config 'remote_folder')
|
||||
|
||||
if bashio::config.has_value 'remote_port'; then
|
||||
PORT=$(bashio::config 'remote_port')
|
||||
bashio::log.info "Use port $PORT"
|
||||
else
|
||||
PORT=22
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
for folder in $FOLDERS; do
|
||||
|
||||
bashio::log.info "Sync $folder -> ${REMOTE_FOLDER}"
|
||||
# shellcheck disable=SC2086
|
||||
rsync ${OPTIONS} \
|
||||
-e "ssh -p ${PORT} -i ${PRIVATE_KEY_FILE} -oStrictHostKeyChecking=no" \
|
||||
"$folder" "${USERNAME}@${HOST}:${REMOTE_FOLDER}"
|
||||
done
|
||||
|
||||
bashio::log.info "Synced all folders"
|
||||
Reference in New Issue
Block a user