50
50
eval set -- "${getopt_out}" ||
53
56
while [ $# -ne 0 ]; do
54
57
cur=${1}; next=${2};
56
59
-h|--help) Usage; exit 0;;
57
60
--serial) serial=$2; shift;;
58
61
--skip-finish) SKIP_FINISH=1;;
62
--image) skip_gen_image=$1;;
63
--preserve) preserve_image=1;;
127
133
# seems more reliable
128
134
execscript="${TEMP_D}/execscript"
131
printf "#!/bin/bash\n"
132
for v in serial build_name root_fs_label; do
133
printf "%s='%s'\n" "$v" "${!v}"
136
cat "${base_d}/vmbuilder-uec-ec2-fixes"
137
printf "#!/bin/bash\n"
138
for v in serial build_name root_fs_label; do
139
printf "%s='%s'\n" "$v" "${!v}"
142
cat "${base_d}/vmbuilder-uec-ec2-fixes"
137
143
} > "${execscript}"
138
144
chmod 755 "${execscript}"
140
146
kinfo="${img_base}-kernel-info.txt"
141
147
image="${img_base}.img"
143
${VMBUILDER} xen ubuntu
148
"--ec2-version=${description}"
149
--components main,restricted,universe,multiverse
151
--ec2-landscape --lock-user
152
"--manifest=${tmpdest}/${img_base}.manifest"
153
"--tmp=${TMPDIR:-/tmp}"
154
--execscript "${execscript}"
155
--debug "${vmb_addargs[@]}" )
150
# Use old scripts for Natty and older, and new for Oneiric and later
151
if [ "${suite}" \< "oneiric" ]
154
${VMBUILDER} xen ubuntu
159
"--ec2-version=${description}"
160
--components main,restricted,universe,multiverse
162
--ec2-landscape --lock-user
163
"--manifest=${tmpdest}/${img_base}.manifest"
164
"--tmp=${TMPDIR:-/tmp}"
165
--execscript "${execscript}"
166
--debug "${vmb_addargs[@]}" )
175
"--rootlabel=${root_fs_label}"
176
"--rootsize=${root_fs_size}"
179
"--manifest=${tmpdest}/${img_base}.manifest"
157
183
debug "invoking ${cmdline[*]}"
158
sudo env "PATH=$PATH" "${cmdline[@]}" ||
159
fail "vmbuilder failed: ${cmdline[*]}";
185
if [ -z ${skip_gen_image} ]; then
186
sudo env "PATH=$PATH" "${cmdline[@]}" ||
187
fail "image generation command failed: ${cmdline[*]}";
189
sudo cp ${skip_gen_image} ${tmpdest} ||
190
fail "unable to copy ${skip_gen_image} to ${tmpdest}";
161
193
if [ ${copy_out_kernels} -ne 0 ]; then
162
194
debug "${img_base}: copying out kernels"
163
195
mp=$(mktemp -d "${tmpdest}/mnt.XXXXXX")
164
sudo mount -o loop,ro "${tmpdest}/root.img" "${mp}" ||
196
sudo mount --read-only -o loop "${tmpdest}/root.img" "${mp}" ||
165
197
fail "failed to mount image for copy out kernels"
167
199
sudo env "PATH=$PATH" copy-out-kernels \