]> gitweb.fluxo.info Git - hydra.git/commitdiff
Feat: hydractl: sync-media: support for specifying a repository in the command line (2)
authorSilvio Rhatto <rhatto@riseup.net>
Sun, 1 Oct 2023 18:25:08 +0000 (15:25 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sun, 1 Oct 2023 18:25:08 +0000 (15:25 -0300)
share/hydractl/sync-media

index 64861982dddae4dd3e98eb05c65d27e5dcc0b349..defa443dd51c4a05c445e76b54f7d99a513bab43 100755 (executable)
@@ -184,7 +184,7 @@ $sudo chown $WHOAMI. $CACHE/*
 sync_media_incoming_perms
 
 # Check if a specific repository was passed via the command line
-if [ -z "$REPOSITORY" ] && [ -d "$CACHE/$REPOSITORY" ] && ! echo "$REPOSITORY" | grep -q '--'; then
+if [ ! -z "$REPOSITORY" ] && [ -d "$CACHE/$REPOSITORY" ] && ! echo "$REPOSITORY" | grep -q -- '--'; then
   REPOSITORIES="$REPOSITORY"
 else
   REPOSITORIES="`ls $CACHE`"
@@ -246,7 +246,7 @@ done
 # Process removable or remote media
 if [ ! -z "$DRIVE" ] && [ -d "$VOLUME/$MEDIA" ]; then
   # Check if a specific repository was passed via the command line
-  if [ -z "$REPOSITORY" ] && [ -d "$VOLUME/$MEDIA/$REPOSITORY" ] && ! echo "$REPOSITORY" | grep -q '--'; then
+  if [ ! -z "$REPOSITORY" ] && [ -d "$VOLUME/$MEDIA/$REPOSITORY" ] && ! echo "$REPOSITORY" | grep -q -- '--'; then
     REPOSITORIES="$REPOSITORY"
   else
     REPOSITORIES="`ls $VOLUME/$MEDIA`"