File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,9 @@ MIN_PKGS=${MIN_PKGS:-"apt-utils gpgv openssh-server"}
1414TOOLS_DIR=$( cd $( dirname " $0 " ) && pwd)
1515TOP_DIR=` cd $TOOLS_DIR /..; pwd`
1616
17+ # exit on error to stop unexpected errors
18+ set -o errexit
19+
1720usage () {
1821 echo " Usage: $0 - Prepare Ubuntu images"
1922 echo " "
@@ -44,6 +47,14 @@ cleanup() {
4447 trap 2; kill -2 $$
4548}
4649
50+ # apt-get wrapper to just get arguments set correctly
51+ function apt_get() {
52+ local sudo=" sudo"
53+ [ " $( id -u) " = " 0" ] && sudo=" env"
54+ $sudo DEBIAN_FRONTEND=noninteractive apt-get \
55+ --option " Dpkg::Options::=--force-confold" --assume-yes " $@ "
56+ }
57+
4758while getopts f:hmr: c; do
4859 case $c in
4960 f) FORMAT=$OPTARG
@@ -107,7 +118,14 @@ case $DIST_NAME in
107118 ;;
108119esac
109120
110- trap cleanup SIGHUP SIGINT SIGTERM
121+ trap cleanup SIGHUP SIGINT SIGTERM SIGQUIT
122+
123+ # Check for dependencies
124+
125+ if [ ! -x " ` which qemu-img` " -o ! -x " ` which qemu-nbd` " ]; then
126+ # Missing KVM?
127+ apt_get install qemu-kvm
128+ fi
111129
112130# Prepare the base image
113131
You can’t perform that action at this time.
0 commit comments