mirror of
https://github.com/YunoHost/install_script.git
synced 2024-09-03 20:06:25 +02:00
Wrap option parsing and main into functions
This commit is contained in:
parent
370a12e544
commit
a3f589d9bb
1 changed files with 71 additions and 60 deletions
|
@ -425,9 +425,12 @@ Options :
|
|||
# to the standard error, and a non-interactive shell will exit.
|
||||
set -u
|
||||
|
||||
function parse_options()
|
||||
{
|
||||
AUTOMODE=0
|
||||
DISTRIB=stable
|
||||
BUILD_IMAGE=0
|
||||
|
||||
while getopts ":aid:h" option; do
|
||||
case $option in
|
||||
a)
|
||||
|
@ -455,6 +458,11 @@ while getopts ":aid:h" option; do
|
|||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
function main()
|
||||
{
|
||||
parse_options
|
||||
|
||||
step ensure_root || die "This script must be run as root"
|
||||
|
||||
|
@ -493,3 +501,6 @@ step post_install || die "Post-installation failed"
|
|||
# Success !
|
||||
success
|
||||
exit 0
|
||||
}
|
||||
|
||||
main
|
||||
|
|
Loading…
Add table
Reference in a new issue