Fix script-files-permissions-set

This commit is contained in:
2021-10-22 16:22:54 -04:00
parent 4bace617ef
commit 7a797f30da

View File

@@ -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