Wrap option parsing and main into functions

This commit is contained in:
Alexandre Aubin 2018-02-12 23:41:34 +01:00
parent 370a12e544
commit a3f589d9bb

View file

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