aboutsummaryrefslogtreecommitdiff
path: root/share/hydractl/sync-tpc
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-06-02 20:56:24 -0300
committerSilvio Rhatto <rhatto@riseup.net>2017-06-02 20:56:24 -0300
commit4d5992e603df88fc4a2d706ef1d0be8de157a2fa (patch)
tree2e35726a9a1630cae207f613ef8fb8df50fdb3a8 /share/hydractl/sync-tpc
parent3bd35bf3be01d87184aa4431f9bdb4892d832f95 (diff)
downloadhydra-4d5992e603df88fc4a2d706ef1d0be8de157a2fa.tar.gz
hydra-4d5992e603df88fc4a2d706ef1d0be8de157a2fa.tar.bz2
Setup media folder with the right ownership at sync-tpc
Diffstat (limited to 'share/hydractl/sync-tpc')
-rwxr-xr-xshare/hydractl/sync-tpc8
1 files 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