MacOS default group is not user name.
This commit is contained in:
parent
69419a8f9c
commit
a24298219e
1 changed files with 8 additions and 2 deletions
10
setup.sh
10
setup.sh
|
@ -2,6 +2,12 @@
|
||||||
set -e
|
set -e
|
||||||
PROJECT_PATH=$(dirname $0)
|
PROJECT_PATH=$(dirname $0)
|
||||||
WHOAMI="$(id -un)"
|
WHOAMI="$(id -un)"
|
||||||
|
if [ "$(uname -s)" = "Linux" ]
|
||||||
|
then
|
||||||
|
MYGROUP="${WHOAMI}"
|
||||||
|
else
|
||||||
|
MYGROUP="staff"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $(id -u) -eq 0 ]
|
if [ $(id -u) -eq 0 ]
|
||||||
then
|
then
|
||||||
|
@ -20,10 +26,10 @@ check() {
|
||||||
|
|
||||||
setup_base() {
|
setup_base() {
|
||||||
printf 'Change ownership of "%s" to "%s"? (setup may fail otherwise)\n' "${PROJECT_PATH}" "${WHOAMI}"
|
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] '
|
if check 'Continue? [Y/n] '
|
||||||
then
|
then
|
||||||
sudo chown -R "${WHOAMI}:${WHOAMI}" "${PROJECT_PATH}"
|
sudo chown -R "${WHOAMI}:${MYGROUP}" "${PROJECT_PATH}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue