From f5bcfe508950c7abb68f3e4fef7a37db880540cc Mon Sep 17 00:00:00 2001 From: jash Date: Sun, 4 Nov 2018 17:51:45 +0100 Subject: [PATCH] modify permissions now uses sudo when required --- dist/setup.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dist/setup.sh b/dist/setup.sh index 041f605..9b67f32 100755 --- a/dist/setup.sh +++ b/dist/setup.sh @@ -121,7 +121,15 @@ modify_permissions() { do if [[ -e $d ]]; then step " modify permissions: $d" - try chmod -R og-rwx $d + if [[ $SUDO_REQUIRED ]]; then + if [[ $(id -u) == 0 ]]; then + try chmod -R og-rwx $d + else + try sudo chmod -R og-rwx $d + fi + else + try chmod -R og-rwx $d + fi next fi done