Split prerequisites check into three stages

This commit is contained in:
Rezart Qelibari
2022-04-06 16:43:04 +02:00
parent 7f55fb66f8
commit 77c0ac8cdf
5 changed files with 75 additions and 30 deletions

View File

@@ -1,9 +1,15 @@
#!/usr/bin/env zsh
# vi: ft=zsh
function checkPrerequisites() {
local -A cmds=(
[docopts]='(with -f option supported)'
function getQuestionsPrerequisites() {
cmds=(
[systemsetup]=''
)
requireRootPrivileges
}
function getExecPrerequisites() {
cmds=(
[osascript]=''
[scutil]=''
[systemsetup]=''
@@ -12,8 +18,6 @@ function checkPrerequisites() {
[defaults]=''
[launchctl]=''
)
test "`id -u`" -eq 0 || { lop -- -e 'This module requires root access. Please run as root.'; return 11 }
checkCommands
}
function getQuestions() {