Allow mk-vmimage.sh to accept a configuration file as

an argument to '-c'.

Sponsored by:	The FreeBSD Foundation
This commit is contained in:
gjb 2014-10-09 03:50:38 +00:00
parent c7959ee139
commit 437ed46f88
2 changed files with 38 additions and 0 deletions

View File

@ -188,9 +188,28 @@ vm_create_vmdisk() {
} }
main() { main() {
vm_config=
while getopts "c:" arg; do
case ${arg} in
c)
vm_config="${OPTARG}"
;;
*)
;;
esac
done
shift $(( ${OPTIND} - 1 ))
cmd="${1}" cmd="${1}"
shift 1 shift 1
if [ ! -z "${vm_config}" ]; then
if [ ! -e "${vm_config}" ]; then
panic "Configuration file ${vm_config} not found."
fi
. ${vm_config}
fi
case ${cmd} in case ${cmd} in
vm-base) vm-base)
eval vm_create_baseimage "$@" || return 0 eval vm_create_baseimage "$@" || return 0

View File

@ -188,9 +188,28 @@ vm_create_vmdisk() {
} }
main() { main() {
vm_config=
while getopts "c:" arg; do
case ${arg} in
c)
vm_config="${OPTARG}"
;;
*)
;;
esac
done
shift $(( ${OPTIND} - 1 ))
cmd="${1}" cmd="${1}"
shift 1 shift 1
if [ ! -z "${vm_config}" ]; then
if [ ! -e "${vm_config}" ]; then
panic "Configuration file ${vm_config} not found."
fi
. ${vm_config}
fi
case ${cmd} in case ${cmd} in
vm-base) vm-base)
eval vm_create_baseimage "$@" || return 0 eval vm_create_baseimage "$@" || return 0