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

an argument to '-c'.

Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Glen Barber 2014-10-09 03:50:38 +00:00
parent ed79fb4ea9
commit 4ac2ee7f8c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/release-vmimage/; revision=272794
2 changed files with 38 additions and 0 deletions

View file

@ -188,9 +188,28 @@ vm_create_vmdisk() {
}
main() {
vm_config=
while getopts "c:" arg; do
case ${arg} in
c)
vm_config="${OPTARG}"
;;
*)
;;
esac
done
shift $(( ${OPTIND} - 1 ))
cmd="${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
vm-base)
eval vm_create_baseimage "$@" || return 0

View file

@ -188,9 +188,28 @@ vm_create_vmdisk() {
}
main() {
vm_config=
while getopts "c:" arg; do
case ${arg} in
c)
vm_config="${OPTARG}"
;;
*)
;;
esac
done
shift $(( ${OPTIND} - 1 ))
cmd="${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
vm-base)
eval vm_create_baseimage "$@" || return 0