Revision e777f9d5
b/snf-image-helper/common.sh | ||
---|---|---|
62 | 62 |
read -a cmdline < /proc/cmdline |
63 | 63 |
for item in "${cmdline[@]}"; do |
64 | 64 |
key=$(cut -d= -f1 <<< "$item") |
65 |
val=$(cut -d= -f2 <<< "$item") |
|
65 | 66 |
if [ "$key" = "hypervisor" ]; then |
66 |
val=$(cut -d= -f2 <<< "$item") |
|
67 | 67 |
hypervisor="$val" |
68 | 68 |
fi |
69 |
if [ "$key" = "rules_dev" ]; then |
|
70 |
export RULES_DEV="$val" |
|
71 |
fi |
|
69 | 72 |
done |
70 | 73 |
|
71 | 74 |
case "$hypervisor" in |
72 | 75 |
kvm) |
73 |
FLOPPY_DEV=/dev/fd0 |
|
74 | 76 |
exec {RESULT_FD}> /dev/ttyS1 |
75 | 77 |
add_cleanup close_fd ${RESULT_FD} |
76 | 78 |
exec {MONITOR_FD}> /dev/ttyS2 |
... | ... | |
81 | 83 |
iptables -P OUTPUT DROP |
82 | 84 |
ip6tables -P OUTPUT DROP |
83 | 85 |
ip link set eth0 up |
84 |
FLOPPY_DEV=/dev/xvdc |
|
85 | 86 |
domid=$(xenstore-read domid) |
86 | 87 |
exec {RESULT_FD}> >(xargs -l1 xenstore-write /local/domain/0/snf-image-helper/$domid) |
87 | 88 |
add_cleanup close_fd ${RESULT_FD} |
b/snf-image-helper/snf-image-helper.in | ||
---|---|---|
51 | 51 |
|
52 | 52 |
prepare_helper |
53 | 53 |
|
54 |
if [ ! -b "$FLOPPY_DEV" ]; then
|
|
55 |
log_error "Floppy device is not present!"
|
|
54 |
if [ ! -b "$RULES_DEV" ]; then
|
|
55 |
log_error "Device file hosting the rules file: \`$RULES_DEV' does not exist"
|
|
56 | 56 |
fi |
57 | 57 |
|
58 |
floppy=$(mktemp -d --tmpdir floppy.XXXXXX)
|
|
59 |
add_cleanup rmdir "$floppy"
|
|
58 |
rules=$(mktemp -d --tmpdir rules.XXXXXX)
|
|
59 |
add_cleanup rmdir "$rules"
|
|
60 | 60 |
|
61 |
$MOUNT $FLOPPY_DEV $floppy
|
|
62 |
add_cleanup umount "$floppy"
|
|
61 |
$MOUNT $RULES_DEV $rules
|
|
62 |
add_cleanup umount "$rules"
|
|
63 | 63 |
|
64 |
if [ -f "$floppy/rules" ]; then
|
|
65 |
source "$floppy/rules"
|
|
64 |
if [ -f "$rules/rules" ]; then
|
|
65 |
source "$rules/rules"
|
|
66 | 66 |
else |
67 |
log_error "Floppy does not contain \`rules\' file"
|
|
67 |
log_error "$RULES_DEV does not contain \`rules\' file"
|
|
68 | 68 |
fi |
69 | 69 |
|
70 |
if [ -f "$floppy/unattend.xml" ]; then
|
|
71 |
export SNF_IMAGE_UNATTEND="$floppy/unattend.xml"
|
|
70 |
if [ -f "$rules/unattend.xml" ]; then
|
|
71 |
export SNF_IMAGE_UNATTEND="$rules/unattend.xml"
|
|
72 | 72 |
fi |
73 | 73 |
|
74 | 74 |
if [ -n "$SNF_IMAGE_PROPERTIES" ]; then |
Also available in: Unified diff