From de7dd11d970249d5ef92f7dc9850a963a63cb665 Mon Sep 17 00:00:00 2001 From: Dmitriy Safronov <zimniy@cyberbrain.pw> Date: Tue, 25 Jan 2022 12:12:10 +0300 Subject: [PATCH] rsync-sync --- Dockerfile | 12 ++++++++---- README.md | 2 +- ha-rsync | 10 ---------- ha-rsync.excludes | 15 --------------- rsync-sync | 8 ++++++++ rsync-sync.excludes | 1 + 6 files changed, 18 insertions(+), 30 deletions(-) delete mode 100644 ha-rsync delete mode 100644 ha-rsync.excludes create mode 100644 rsync-sync create mode 100644 rsync-sync.excludes diff --git a/Dockerfile b/Dockerfile index 86b3b7e..690d3aa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,10 @@ FROM registry.cyberbrain.pw/docker/git-sync:latest -ENV GIT_SYNC_HTTP_METRICS=false GIT_SYNC_ROOT='/tmp/git' GIT_SYNC_DEST='config' GIT_SYNC_EXECHOOK_COMMAND='/ha-rsync' GIT_SYNC_ADD_USER='true' +ENV GIT_SYNC_HTTP_METRICS=false \ + GIT_SYNC_ROOT='/tmp/git' \ + GIT_SYNC_DEST='sync' \ + GIT_SYNC_EXECHOOK_COMMAND='/rsync-sync' \ + GIT_SYNC_ADD_USER='true' USER root:root @@ -11,11 +15,11 @@ RUN set -ex \ && rm -rf /var/lib/apt/lists/* \ && chmod -Rv 0777 "${GIT_SYNC_ROOT:-/tmp/git}/" -COPY ha-rsync* / +COPY rsync-sync* / RUN set -ex \ - && chmod a+x /ha-rsync + && chmod a+x /rsync-sync -VOLUME ["/config"] +VOLUME ["/sync"] USER 65533:65533 diff --git a/README.md b/README.md index 28bdd4e..51fc68c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ -# Git Sync - Home Assistant +# Git Sync - Rsync Sync Warning! Default excludes could change suddenly and with no reason) diff --git a/ha-rsync b/ha-rsync deleted file mode 100644 index 1a23cf9..0000000 --- a/ha-rsync +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env sh - -rsync -a \ - --exclude-from='/ha-rsync.excludes' \ - --exclude='/.git' \ - --exclude='/.HA_VERSION' \ - --exclude='/secrets.yaml' \ - --delete-after \ - "${GIT_SYNC_ROOT:-/tmp/git}/${GIT_SYNC_DEST:-config}/" \ - /config diff --git a/ha-rsync.excludes b/ha-rsync.excludes deleted file mode 100644 index eba1fb9..0000000 --- a/ha-rsync.excludes +++ /dev/null @@ -1,15 +0,0 @@ -# Don't overwrite files created from UI -/automations.yaml -/scenes.yaml -/scripts.yaml - -# Don't overwrite cloud connection settings -/.cloud/* - -# Don't overwrite local settings -/.storage/* - -# Don't overwrite local dirs -/deps -/image -/tts diff --git a/rsync-sync b/rsync-sync new file mode 100644 index 0000000..1df8a19 --- /dev/null +++ b/rsync-sync @@ -0,0 +1,8 @@ +#!/usr/bin/env sh + +rsync -a \ + --exclude-from='/rsync-sync.excludes' \ + --exclude='/.git' \ + --delete-after \ + "${GIT_SYNC_ROOT:-/tmp/git}/${GIT_SYNC_DEST:-sync}/" \ + /sync diff --git a/rsync-sync.excludes b/rsync-sync.excludes new file mode 100644 index 0000000..dd82fa5 --- /dev/null +++ b/rsync-sync.excludes @@ -0,0 +1 @@ +# Placeholder for your own excludes. Just mount your file into conteiner as /rsync-sync.excludes -- GitLab