Changeset View
Standalone View
release/scripts/mk-vmimage.sh
Show All 28 Lines | |||||
# | # | ||||
# mk-vmimage.sh: Create virtual machine disk images in various formats. | # mk-vmimage.sh: Create virtual machine disk images in various formats. | ||||
# | # | ||||
# $FreeBSD$ | # $FreeBSD$ | ||||
# | # | ||||
usage() { | usage() { | ||||
echo "${0} usage:" | echo "${0} usage:" | ||||
echo "${@}" | echo "${@}" | ||||
emaste: Incidentally it seems this (`"${@}"`) does not produce a useful usage message | |||||
Done Inline ActionsI think you're right. The release bits generally don't do any error checking either, so if something fails (e.g., I typoed something in the make -C release invocation or forgot a flag or forgot to run the command as root) early on, the error gets lost in the command output and you have to scroll through trying to figure out what went wrong. markj: I think you're right. The release bits generally don't do any error checking either, so if… | |||||
return 1 | return 1 | ||||
} | } | ||||
main() { | main() { | ||||
local arg | local arg | ||||
VMCONFIG="/dev/null" | VMCONFIG="/dev/null" | ||||
while getopts "C:c:d:f:i:o:s:S:" arg; do | while getopts "C:c:d:F:f:i:o:s:S:" arg; do | ||||
case "${arg}" in | case "${arg}" in | ||||
C) | C) | ||||
VMBUILDCONF="${OPTARG}" | VMBUILDCONF="${OPTARG}" | ||||
;; | ;; | ||||
c) | c) | ||||
VMCONFIG="${OPTARG}" | VMCONFIG="${OPTARG}" | ||||
;; | ;; | ||||
d) | d) | ||||
DESTDIR="${OPTARG}" | DESTDIR="${OPTARG}" | ||||
;; | ;; | ||||
F) | |||||
VMFS="${OPTARG}" | |||||
;; | |||||
f) | f) | ||||
VMFORMAT="${OPTARG}" | VMFORMAT="${OPTARG}" | ||||
;; | ;; | ||||
i) | i) | ||||
VMBASE="${OPTARG}" | VMBASE="${OPTARG}" | ||||
;; | ;; | ||||
o) | o) | ||||
VMIMAGE="${OPTARG}" | VMIMAGE="${OPTARG}" | ||||
Show All 9 Lines | while getopts "C:c:d:F:f:i:o:s:S:" arg; do | ||||
esac | esac | ||||
done | done | ||||
shift $(( ${OPTIND} - 1)) | shift $(( ${OPTIND} - 1)) | ||||
if [ -z "${VMBASE}" -o \ | if [ -z "${VMBASE}" -o \ | ||||
-z "${WORLDDIR}" -o \ | -z "${WORLDDIR}" -o \ | ||||
-z "${DESTDIR}" -o \ | -z "${DESTDIR}" -o \ | ||||
-z "${VMSIZE}" -o \ | -z "${VMSIZE}" -o \ | ||||
-z "${VMIMAGE}" ]; | -z "${VMIMAGE}" -o \ | ||||
-z "${VMFS}" ]; | |||||
Not Done Inline ActionsOne (final, I think) nit I noticed, unless I missed it, if ${VMFS} is empty, we should default it to UFS instead of outright falling back to usage(). gjb: One (final, I think) nit I noticed, unless I missed it, if ${VMFS} is empty, we should default… | |||||
Not Done Inline ActionsApologies, I noticed VMFS is set to UFS by default in the Makefile.vm. Sorry for the noise. gjb: Apologies, I noticed VMFS is set to UFS by default in the Makefile.vm. Sorry for the noise. | |||||
Not Done Inline ActionsOh, our Phab updates crossed paths. I wondered about this too and was going to suggest that VMFS default to UFS but then noticed that the other variables (VMFORMAT etc.) all need to be set and don't have defaults so this follows that pattern. I guess mk-vmimage.sh is "no user serviceable parts inside" emaste: Oh, our Phab updates crossed paths.
I wondered about this too and was going to suggest that… | |||||
Not Done Inline ActionsMore or less, correct, mk-vmimage.sh has no user serviceable parts. Theoretically, everything is (or should be) passed to it through Makefile.vm. gjb: More or less, correct, mk-vmimage.sh has no user serviceable parts. Theoretically, everything… | |||||
then | then | ||||
usage || exit 0 | usage || exit 0 | ||||
fi | fi | ||||
if [ -z "${VMBUILDCONF}" ] || [ ! -e "${VMBUILDCONF}" ]; then | if [ -z "${VMBUILDCONF}" ] || [ ! -e "${VMBUILDCONF}" ]; then | ||||
echo "Must provide the path to vmimage.subr." | echo "Must provide the path to vmimage.subr." | ||||
return 1 | return 1 | ||||
fi | fi | ||||
Show All 24 Lines |
Incidentally it seems this ("${@}") does not produce a useful usage message