Revision 9c76962d snf-image-host/create
b/snf-image-host/create | ||
---|---|---|
22 | 22 |
|
23 | 23 |
. common.sh |
24 | 24 |
|
25 |
ganeti_os_main |
|
25 |
# Save stderr to a file |
|
26 |
stderr=$(mktemp) |
|
27 |
add_cleanup rm "$stderr" |
|
28 |
exec 2> >(tee -a "$stderr" >&2) |
|
26 | 29 |
|
30 |
monitor_pipe=$(mktemp -u) |
|
31 |
mkfifo -m 600 "$monitor_pipe" |
|
32 |
add_cleanup rm -f "$monitor_pipe" |
|
33 |
|
|
34 |
if [ -n "$PROGRESS_MONITOR" ]; then |
|
35 |
{ cat "$monitor_pipe" | tee >( $PROGRESS_MONITOR ) ; } & |
|
36 |
else |
|
37 |
cat "$monitor_pipe" & |
|
38 |
fi |
|
39 |
|
|
40 |
# Create file descriptor to monitor_pipe |
|
41 |
eval "exec ${MONITOR_FD}>${monitor_pipe}" |
|
42 |
add_cleanup close_fd ${MONITOR_FD} |
|
43 |
|
|
44 |
trap "cleanup $(printf "%q" "$stderr")" EXIT |
|
45 |
|
|
46 |
ganeti_os_main |
|
27 | 47 |
|
28 | 48 |
case $BACKEND_TYPE in |
29 | 49 |
local) |
... | ... | |
47 | 67 |
;; |
48 | 68 |
esac |
49 | 69 |
|
50 |
monitor_pipe=$(mktemp -u) |
|
51 |
mkfifo -m 600 "$monitor_pipe" |
|
52 |
add_cleanup rm -f "$monitor_pipe" |
|
53 |
|
|
54 |
if [ -z "$PROGRESS_MONITOR" ]; then |
|
55 |
PROGRESS_MONITOR="cat" |
|
56 |
fi |
|
57 |
|
|
58 |
"$PROGRESS_MONITOR" "$monitor_pipe" & |
|
59 |
|
|
60 |
# Create file descriptor to monitor_pipe |
|
61 |
eval "exec ${MONITOR_FD}>${monitor_pipe}" |
|
62 |
add_cleanup close_fd ${MONITOR_FD} |
|
63 |
|
|
64 | 70 |
# If the target device is not a real block device we'll first losetup it. |
65 | 71 |
# This is needed for file disks. |
66 | 72 |
if [ ! -b "$blockdev" ]; then |
Also available in: Unified diff