Skip to content

Commit 7446e96

Browse files
committed
Adds notes about problems with parent folder being a symlink itself.
1 parent b73b242 commit 7446e96

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

set-owner

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ if [ -n "$1" ]; then
3131
ARG_OWNER=$1
3232
else
3333
# This works around the scripts being run elevated via `sudo`.
34-
# Can't use `stat -c|-f '%U %G' ./` because options are not standard across systems.
34+
# Can't use `stat -c'%U %G'|-f '%sU %sG' ./` because options are not standard across systems.
35+
36+
#@TODO: This method doesn't work when $DIR is a symlink with a name that doesn't match the target. Case study: eu.loadsysdev.com, the ~/public_html/ folder is really a symlink to /var/www/sites/eu.loadsysdev.com/html, and the owner of the symlink is root:root.
37+
3538
ARG_OWNER="$( \ls -l "${DIR}/.." | grep -v '^l' | grep " $(basename $( pwd ))\$" | awk '{ print $3 }' )"
3639
fi
3740

0 commit comments

Comments
 (0)