Revision fcae4e91 snf-image-host/create
b/snf-image-host/create | ||
---|---|---|
141 | 141 |
snf_export_PERSONALITY="$IMG_PERSONALITY" |
142 | 142 |
fi |
143 | 143 |
|
144 |
create_floppy "$floppy" |
|
145 |
|
|
146 |
# Invoke the helper vm to do the dirty job... |
|
147 |
jail=$(mktemp -d --tmpdir tmpfsXXXXXXX) |
|
148 |
add_cleanup rmdir "$jail" |
|
149 |
|
|
150 |
mount tmpfs -t tmpfs "$jail" -o size=1G |
|
151 |
add_cleanup umount -l "$jail" |
|
152 |
|
|
153 |
result_file=$(mktemp --tmpdir="$jail" result.XXXXXX) |
|
154 |
add_cleanup rm "$result_file" |
|
155 |
|
|
156 |
snapshot=$(mktemp --tmpdir="$jail" helperXXXXXX.img) |
|
157 |
add_cleanup rm "$snapshot" |
|
158 |
|
|
159 |
mk_snapshot |
|
160 |
|
|
161 |
echo -n "$(date +%Y:%m:%d-%H:%M:%S.%N) " >&2 |
|
162 |
log_info "Starting customization VM..." |
|
163 |
set +e |
|
144 |
snf_export_DEV=$(get_img_dev) |
|
164 | 145 |
|
165 |
launch_helper |
|
166 |
|
|
167 |
rc=$? |
|
168 |
set -e |
|
169 |
if [ $rc -ne 0 ]; then |
|
170 |
if [ $rc -eq 124 ]; then |
|
171 |
log_error "Image customization was terminated. Did not finish on time." |
|
172 |
elif [ $rc -eq 137 ]; then # (128 + SIGKILL) |
|
173 |
log_error "Image customization was killed. Did not finish on time." |
|
174 |
elif [ $rc -eq 141 ]; then # (128 + SIGPIPE) |
|
175 |
log_error "Image customization was terminated by a SIGPIPE." |
|
176 |
log_error "Maybe progress monitor has died unexpectedly." |
|
177 |
elif [ $rc -eq 125 ]; then |
|
178 |
log_error "Internal Error. Image customization could not start." |
|
179 |
log_error "timeout did not manage to run." |
|
180 |
else |
|
181 |
log_error "Image customization died unexpectedly (return code $rc)." |
|
182 |
fi |
|
183 |
exit 1 |
|
184 |
else |
|
185 |
echo -n "$(date +%Y:%m:%d-%H:%M:%S.%N)" >&2 |
|
186 |
log_info "Customization VM finished." |
|
187 |
fi |
|
188 |
|
|
189 |
get_helper_result |
|
146 |
create_floppy "$floppy" |
|
190 | 147 |
|
191 |
if [ "x$result" != "xHELPER_RESULT_SUCCESS" ]; then |
|
192 |
log_error "Image customization failed." |
|
193 |
exit 1 |
|
194 |
fi |
|
148 |
launch_helper "$blockdev" "$floppy" |
|
195 | 149 |
|
196 | 150 |
log_info "Image customization finished successfully." |
197 | 151 |
|
Also available in: Unified diff