Require root to run install.sh

This commit is contained in:
Rezart Qelibari
2022-02-14 14:01:39 +01:00
parent 713d994ff1
commit 2b87c97692
2 changed files with 3 additions and 1 deletions

View File

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

View File

@@ -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() {