summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2008-07-10 19:43:44 +1000
committerAndrew Tridgell <tridge@samba.org>2008-07-10 19:43:44 +1000
commitf2d511bfc8e9bb16f8d7efbabd40b28b34f1c04f (patch)
tree6429b82aa59991e9d72feed85a6e3c681bf0f8b6
parent00c8e1d8d5c9aab12b4095b703eb0a596e4fc81f (diff)
auto-wait for install to finish
-rwxr-xr-xcreate_base.sh30
1 files changed, 29 insertions, 1 deletions
diff --git a/create_base.sh b/create_base.sh
index d07d140..834eaf2 100755
--- a/create_base.sh
+++ b/create_base.sh
@@ -42,7 +42,35 @@ UUID=`uuidgen`
substitute_vars templates/install.xml tmp/$NAME.xml
+rm -f install.ttyS0
+
# boot the install CD
virsh create tmp/$NAME.xml || exit 1
-tail -f install.ttyS0
+echo "Waiting for install to start"
+sleep 2
+
+# wait for the install to finish
+cat <<EOF > tmp/wait.exp
+spawn tail -f install.ttyS0
+expect -timeout 3600 "you may safely reboot your system"
+EOF
+
+expect tmp/wait.exp
+virsh destroy $NAME
+
+if ! grep "you may safely reboot your system" install.ttyS0 > /dev/null; then
+ echo "Failed to create base image $DISK"
+ exit 1
+fi
+
+ls -l $DISK
+cat <<EOF
+
+Install finished, base image $DISK created
+
+You may wish to run
+ chattr +i $DISK
+To ensure that this image does not change
+
+EOF