]> gitweb.fluxo.info Git - hydra.git/commitdiff
Feat: hydractl: sync-media: enhanced rsync support with multiple methods
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 30 Sep 2023 22:31:06 +0000 (19:31 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 30 Sep 2023 22:31:06 +0000 (19:31 -0300)
share/hydractl/sync-media

index d463e443fbe311de2017445b10509a7fddfc2915..1ce9516ba31d59081763f1d8e6a884f4814f81d0 100755 (executable)
@@ -274,7 +274,13 @@ if [ ! -z "$DRIVE" ] && [ -d "$VOLUME/$MEDIA" ]; then
 
         if [ "$method" == "unison" ];
           unison $CACHE/$folder $VOLUME/$MEDIA/$folder -auto -logfile /dev/null
-        elif [ "$method" == "rsync" ]; then
+        elif [ "$method" == "rsync-to-media-volume" ]; then
+          echo "Syncing $CACHE/$folder into $VOLUME/$MEDIA/$folder..."
+          rsync -av --delete --exclude=.sync-media $CACHE/$folder/ $VOLUME/$MEDIA/$folder/
+        elif [ "$method" == "rsync-from-media-volume" ]; then
+          echo "Syncing $VOLUME/$MEDIA/$folder into $CACHE/$folder..."
+          rsync -av --delete --exclude=.sync-media $VOLUME/$MEDIA/$folder/ $CACHE/$folder/
+        elif [ "$method" == "rsync-if-empty-dest" ]; then
           # Ensure both endpoint folders exist
           mkdir -p $CACHE/folder
           mkdir -p $VOLUME/$MEDIA/$folder