diff --git a/bootstrap.sh b/bootstrap.sh index 040a2e0..0638fea 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -77,7 +77,6 @@ function main() { local traps=() local -A colors=() errColors=() defineColors - id -Gn | grep admin >&! /dev/null || { printError 'This script requires root access. Please run as an admin user.'; return 10 } configureTerminal local tmpdir="`mktemp -d -t 'macos-system'`" @@ -94,7 +93,7 @@ function main() { local -A colors=() errColors=() [ -t 1 ] && tput cnorm isDebug && export MACOS_SYSTEM_DEBUG=true - sudo --preserve-env=HOMEBREW_BREW_GIT_REMOTE,HOMEBREW_BREW_CORE_GIT_REMOTE,HOMEBREW_BREW_CASK_GIT_REMOTE,HOMEBREW_BREW_CASK_FONTS_GIT_REMOTE,MACOS_SYSTEM_DEBUG "${tmpdir}/install.sh" "$@" + "${tmpdir}/install.sh" "$@" [ -t 1 ] && tput civis popd -q } diff --git a/install.sh b/install.sh index 42926e1..12029dc 100755 --- a/install.sh +++ b/install.sh @@ -78,7 +78,6 @@ function isPlistBuddyInstalled() { function checkPrerequisites() { isMacOS || { lop -- -e 'This setup is only for macOS 10.13 and up.'; return 10 } isPlistBuddyInstalled || { lop -- -e '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 -- -e 'This module requires root access. Please run as root.'; return 11 } } function configureTerminal() { @@ -101,11 +100,11 @@ function main() { checkPrerequisites || return eval "`docopts -f -V - -h - : "$@" <<- USAGE Usage: $0 [options] [-m PATH]... [...] - + Install all modules in module search path. If any arg is given, install only modules that either match any given or whose path ends like any of the given . - + Options: -i, --inverse Exclude the given instead. -m PATH, --modpath PATH Include PATH in the module search path. @@ -135,6 +134,7 @@ function main() { askNecessaryQuestions [ -z "${config_only}" ] || return 0 + requireRootPrivileges installModules }