MacOS default group is not user name.

This commit is contained in:
Kevin Baensch 2023-01-09 10:41:41 +01:00
parent 69419a8f9c
commit a24298219e

View file

@ -2,6 +2,12 @@
set -e
PROJECT_PATH=$(dirname $0)
WHOAMI="$(id -un)"
if [ "$(uname -s)" = "Linux" ]
then
MYGROUP="${WHOAMI}"
else
MYGROUP="staff"
fi
if [ $(id -u) -eq 0 ]
then
@ -20,10 +26,10 @@ check() {
setup_base() {
printf 'Change ownership of "%s" to "%s"? (setup may fail otherwise)\n' "${PROJECT_PATH}" "${WHOAMI}"
printf 'running: "sudo chown -R %s %s"\n' "${WHOAMI}:${WHOAMI}" "${PROJECT_PATH}"
printf 'running: "sudo chown -R %s %s"\n' "${WHOAMI}:${MYGROUP}" "${PROJECT_PATH}"
if check 'Continue? [Y/n] '
then
sudo chown -R "${WHOAMI}:${WHOAMI}" "${PROJECT_PATH}"
sudo chown -R "${WHOAMI}:${MYGROUP}" "${PROJECT_PATH}"
fi