diff --git a/bootstrap.sh b/bootstrap.sh index 7ffd502..2008d47 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -18,12 +18,13 @@ function isDebug() { } function main() { + id -Gn | grep admin >&! /dev/null || { echo 'This script requires root access. Please run as an admin user.' >&2; return 10 } local tmpdir="`mktemp -d -t 'macos-system'`" isDebug || trap "rm -fr -- '${tmpdir}'; return" INT TERM EXIT pushd -q "${tmpdir}" cloneMacOSSystemRepo cloneZSHLibRepo - ./install.sh + sudo ./install.sh popd -q } diff --git a/install.sh b/install.sh index 3306f99..52425bb 100755 --- a/install.sh +++ b/install.sh @@ -256,6 +256,7 @@ function isPlistBuddyInstalled() { function checkPrerequisites() { isMacOS || { lop error 'This setup is only for macOS 10.13 and up.'; return 10 } isPlistBuddyInstalled || { lop error 'This setup requires PlistBuddy to be either at /usr/libexec or in any of the PATH directories.'; return 11 } + test "`id -u`" -eq 0 || { lop error 'This module requires root access. Please run as root.'; return 11 } } function main() {