diff --git a/script-files-permissions-set b/script-files-permissions-set index 3df9b7ce..3d51eb21 100755 --- a/script-files-permissions-set +++ b/script-files-permissions-set @@ -7,13 +7,10 @@ is_root if [[ $# -eq 0 ]]; then + echo "No arguments provided, using autodetection" + paths=("$PWD") user=$(stat -c "%U" "$PWD") group=$(stat -c "%G" "$PWD") - echo "No arguments provided, using autodetection" - if [[ "$group" != "smbgrp" ]]; then - echo "This file will not be world-accessible by the smbgrp group" - ask_ok "Change group $group to smbgrp?" && group="smbgrp" - fi elif [[ $# -eq 1 ]]; then user="$1" group="$1" @@ -32,7 +29,15 @@ for path in "${paths[@]}"; do if [[ "$path" == "/" ]]; then echo "You are trying to operate on the root partition!" echo "This seems highly unusual!" - ! ask_ok "Continue?" && exit $? + ask_ok "Continue?" || exit $? + fi + og_user=$(stat -c "%U" "$path") + og_group=$(stat -c "%G" "$path") + echo -e "PATH\tUSER\tGROUP" + echo -e "$path\t$og_user\t$og_group" + if [[ "$group" != "smbgrp" || "$og_group" != "smbgrp" ]]; then + echo "$path is not world-accessible by the smbgrp group" + ask_ok "Change $path group $og_group to smbgrp?" && group="smbgrp" fi done