diff --git a/Dockerfile b/Dockerfile index 86b3b7ebb117c59663dec106739b3507b2c45313..690d3aa9b4dd75b25895282952aa8a1c459df33e 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 28bdd4e4574cfe06cd94063f7b31396f2af3f45c..51fc68ccab74673ef86ee001c02e68d5e7f2c70a 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 1a23cf9515becd2da31c6d245565a5da7db3ea69..0000000000000000000000000000000000000000 --- 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 eba1fb9b4c7fe722a0f3e97ddf809f833cdc6580..0000000000000000000000000000000000000000 --- 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 0000000000000000000000000000000000000000..1df8a19694c82c752d8703a16030a4a8f7a36541 --- /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 0000000000000000000000000000000000000000..dd82fa54077a8931e3509da13f9bbe2eba2a51df --- /dev/null +++ b/rsync-sync.excludes @@ -0,0 +1 @@ +# Placeholder for your own excludes. Just mount your file into conteiner as /rsync-sync.excludes