From 0873593102357e336b804a71d66c8c8557e5af68 Mon Sep 17 00:00:00 2001 From: Alex Malinovich Date: Mon, 5 Dec 2016 13:27:48 -0800 Subject: [PATCH] Fix .git permissions after autoupdate --- plexupdate.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plexupdate.sh b/plexupdate.sh index 285f071..f02f0ea 100755 --- a/plexupdate.sh +++ b/plexupdate.sh @@ -329,8 +329,8 @@ if [ "${AUTOUPDATE}" = "yes" ]; then if git fetch origin $BRANCHNAME --quiet && ! git diff --quiet FETCH_HEAD; then info "Auto-updating..." - #Use an associative array to store permissions. If you're running bash < 4, the declare will fail and we'll - #just run in "dumb" mode without trying to restore permissions + # Use an associative array to store permissions. If you're running bash < 4, the declare will fail and we'll + # just run in "dumb" mode without trying to restore permissions declare -A FILE_OWNER FILE_PERMS && \ for filename in $PLEXUPDATE_FILES; do FILE_OWNER[$filename]=$(stat -c "%u:%g") @@ -349,6 +349,10 @@ if [ "${AUTOUPDATE}" = "yes" ]; then done fi + # .git permissions don't seem to be affected by running as root even though files inside do, so just reset + # the permissions to match the folder + chown -R --reference=.git .git + info "Update complete" #make sure we're back in the right relative location before testing $0