]> gitweb.fluxo.info Git - hydra.git/commitdiff
Setup media folder with the right ownership at sync-tpc
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 2 Jun 2017 23:56:24 +0000 (20:56 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 2 Jun 2017 23:56:24 +0000 (20:56 -0300)
share/hydractl/sync-tpc

index 31a29aeebc80a9179da0d20f9d6187afe9028538..6c1b5d20518300750040543a7231fdbdcc30c7cc 100755 (executable)
@@ -61,9 +61,11 @@ fi
 if [ ! -d "$MEDIA" ]; then
   $SUDO mkdir -p $MEDIA
 
-  if [ "$USER" != 'root' ]; then
-    $SUDO chown $USER.$USER $MEDIA
-  fi
+  OWNER="$(stat -c %U /var/cache/`hostname -s`/media)"
+  GROUP="$(stat -c %G /var/cache/`hostname -s`/media)"
+
+  # With the right permissions
+  $SUDO chown $OWNER.$GROUP $MEDIA
 fi
 
 # Sync media remotes