Add module_main to lib.sh
This commit is contained in:
@@ -92,10 +92,21 @@ function configureLoginWindow() {
|
|||||||
lop success 'done'
|
lop success 'done'
|
||||||
}
|
}
|
||||||
|
|
||||||
function main() {
|
function configure_system() {
|
||||||
autoloadZShLib || return
|
quitSystemPreferences
|
||||||
checkPrerequisites || return
|
configureComputerHostname
|
||||||
eval "`docopts -f -V - -h - : "$@" <<- USAGE
|
configureBasicSystem
|
||||||
|
configurePowerManagement
|
||||||
|
configureLoginWindow
|
||||||
|
|
||||||
|
lop info 'Configuring global umask'
|
||||||
|
launchctl config user umask 027
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ "${ZSH_EVAL_CONTEXT}" == toplevel ]]; then
|
||||||
|
test -f "${ASTZWEIG_MACOS_SYSTEM_LIB}" || { echo 'This module requires macos-system library. Please run again with macos-system library provieded as a path in ASTZWEIG_MACOS_SYSTEM_LIB env variable.'; return 10 }
|
||||||
|
source "${ASTZWEIG_MACOS_SYSTEM_LIB}"
|
||||||
|
module_main "$@" <<- USAGE
|
||||||
Usage:
|
Usage:
|
||||||
$0 show-questions
|
$0 show-questions
|
||||||
$0 [-v] [-d FILE] --hostname NAME --timezone ZONE
|
$0 [-v] [-d FILE] --hostname NAME --timezone ZONE
|
||||||
@@ -111,23 +122,5 @@ function main() {
|
|||||||
$0 0.1.0
|
$0 0.1.0
|
||||||
Copyright (C) 2022 Rezart Qelibari, Astzweig GmbH & Co. KG
|
Copyright (C) 2022 Rezart Qelibari, Astzweig GmbH & Co. KG
|
||||||
License EUPL-1.2. There is NO WARRANTY, to the extent permitted by law.
|
License EUPL-1.2. There is NO WARRANTY, to the extent permitted by law.
|
||||||
USAGE`"
|
USAGE
|
||||||
[ $# -eq 0 ] && return
|
|
||||||
configureLogging
|
|
||||||
[ "${show_questions}" = true ] && { showQuestions; return }
|
|
||||||
|
|
||||||
quitSystemPreferences
|
|
||||||
configureComputerHostname
|
|
||||||
configureBasicSystem
|
|
||||||
configurePowerManagement
|
|
||||||
configureLoginWindow
|
|
||||||
|
|
||||||
lop info 'Configuring global umask'
|
|
||||||
launchctl config user umask 027
|
|
||||||
}
|
|
||||||
|
|
||||||
if [[ "${ZSH_EVAL_CONTEXT}" == toplevel ]]; then
|
|
||||||
test -f "${ASTZWEIG_MACOS_SYSTEM_LIB}" || { echo 'This module requires macos-system library. Please run again with macos-system library provieded as a path in ASTZWEIG_MACOS_SYSTEM_LIB env variable.'; return 10 }
|
|
||||||
source "${ASTZWEIG_MACOS_SYSTEM_LIB}"
|
|
||||||
main "$@"
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -25,3 +25,13 @@ function checkCommands() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function module_main() {
|
||||||
|
autoloadZShLib || return
|
||||||
|
checkPrerequisites || return
|
||||||
|
eval "`docopts -f -V - -h - : "$@"`"
|
||||||
|
[ $# -le 1 ] && return
|
||||||
|
configureLogging
|
||||||
|
[ "${show_questions}" = true ] && { showQuestions; return }
|
||||||
|
configure_system
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user