From 4d5992e603df88fc4a2d706ef1d0be8de157a2fa Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 2 Jun 2017 20:56:24 -0300 Subject: Setup media folder with the right ownership at sync-tpc --- share/hydractl/sync-tpc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/share/hydractl/sync-tpc b/share/hydractl/sync-tpc index 31a29ae..6c1b5d2 100755 --- a/share/hydractl/sync-tpc +++ b/share/hydractl/sync-tpc @@ -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 -- cgit v1.2.3