aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2023-10-19 15:16:50 -0300
committerSilvio Rhatto <rhatto@riseup.net>2023-10-19 15:16:50 -0300
commit30458ae1ace879bfc56cc72e3ed024c6f13c9adb (patch)
tree06901ec1cc36d55b7938e380c86164cdd566049c
parentc525286299b64adfef03787eeafc42d2d06e33c5 (diff)
downloadhydra-30458ae1ace879bfc56cc72e3ed024c6f13c9adb.tar.gz
hydra-30458ae1ace879bfc56cc72e3ed024c6f13c9adb.tar.bz2
Fix: hydractl: sync-media: workflow improvements
-rwxr-xr-xshare/hydractl/sync-media27
1 files changed, 25 insertions, 2 deletions
diff --git a/share/hydractl/sync-media b/share/hydractl/sync-media
index 12d9b69..48b03b7 100755
--- a/share/hydractl/sync-media
+++ b/share/hydractl/sync-media
@@ -53,6 +53,10 @@ function sync_media_add {
# Add meta files, making sure they're handled directly by Git
function sync_media_add_metadata {
+ # Playlist files
+ find -name '*.m3u' -type l -exec git annex unlock {} \;
+ find -name '*.m3u' -exec git add {} \;
+
# Koreader metadata files
find -name metadata.pdf.lua -type l -exec git annex unlock {} \;
find -name metadata.pdf.lua -exec git add {} \;
@@ -206,13 +210,32 @@ for folder in $REPOSITORIES; do
cd $CACHE/$folder
echo "Syncing $CACHE/$folder..."
- sync_media_add_metadata
- sync_media_playlist_perms
+ # Ensure the removable volume is in the list of remotes
sync_media_ensure_remote $REMOTE $VOLUME/$MEDIA/$folder
+
+ # Ensure the repository is identified
sync_media_identity
+
+ # Sync before changing anything, to make sure the history does not have
+ # conflicts with other remotes
+ git annex sync
+
+ # Fix any playlist permissions
+ sync_media_playlist_perms
+
+ # Process metadata
+ sync_media_add_metadata
+
+ # Add new content, and catch up changes
sync_media_add
+
+ # Sync everything again
git annex sync
+
+ # Get all that needs to be got
sync_media_getall $CACHE/$folder
+
+ # Repository maintenance
sync_media_fsck
sync_media_dropunused
)