source: trunk/debathena/scripts/tests/installer/install-test.sh @ 25993

Revision 25993, 3.3 KB checked in by wpreston, 11 years ago (diff)
switch to local copy of syslinux. logging changes. stop vm after test completion.
  • Property svn:executable set to *
Line 
1#!/bin/bash
2
3# install debathena into a blank vm, and run tests confirming the install
4#
5#
6# This was developed and tested using VMWare Workstation 9,
7# and mkisofs(2.01)/genisoimage 1.1.11
8#
9# example usage:
10# -s precise
11# -a i386
12# -h <vmware host>
13# -i (this was tested using a static IP taken from vmnet8)
14# -p http://<your preseed>
15
16BASEDIR=.
17
18SUITE=
19ARCH=
20IP=
21HOSTNAME=
22PRESEED=
23
24LOGDIR=$BASEDIR/log
25NOW=$(date +"%d-%m-%y")
26LOG=$LOGDIR/"install-test-"$NOW".log"
27
28function usage() {
29  cat<< EO
30        Usage:  -s <suite> -a <architecture> -h <hostname> -i <ip> -p <preseed>
31EO
32}
33
34
35while getopts "s:a:h:i:p:" OPTION
36
37do
38  case $OPTION in
39  s)
40    SUITE=$OPTARG
41    ;;
42  a)
43    ARCH=$OPTARG
44    ;;
45  h)
46    HOSTNAME=$OPTARG
47    ;;
48  i)
49    IP=$OPTARG
50    ;;
51  p)
52    PRESEED=$OPTARG
53    ;;
54  ?)
55   usage
56   exit 1
57   ;;
58  esac
59done
60
61if [[ -z $HOSTNAME || -z $ARCH || -z $PRESEED || -z $IP ]] ; then
62  echo "Empty option. HOSTNAME: $HOSTNAME, ARCH: $ARCH, PRESEED: $PRESEED, IP: $IP"  | tee -a $LOG
63  usage
64  exit 1
65fi
66
67if [ -d tmp ] ; then
68  rm -rf tmp
69fi
70
71mkdir $BASEDIR/tmp
72mkdir $BASEDIR/tmp/isolinux
73TMPDIR=$BASEDIR/tmp
74
75
76echo "creating build files..." | tee -a $LOG
77
78ISOLINUXBIN=/usr/lib/syslinux/isolinux.bin
79
80if [ ! -f $ISOLINUXBIN ] ; then
81  echo "isolinux.bin not found at: $ISOLINUXBIN exiting..." | tee -a $LOG
82  exit 1
83fi
84
85cp $ISOLINUXBIN $TMPDIR/isolinux
86
87if [ ! -f $BASEDIR/isolinux/isolinux.cfg ] ; then
88  echo "isolinux.cfg not found. exiting..." | tee -a $LOG
89  exit 1
90fi
91
92cp -R $BASEDIR/isolinux $TMPDIR
93
94ISOLINUXCFG=$TMPDIR/isolinux/isolinux.cfg
95
96echo "seeding isolinux.cfg..." | tee -a $LOG
97
98sed -i "s|%HOSTNAME%|$HOSTNAME|g" $ISOLINUXCFG
99sed -i "s|%IP%|$IP|g" $ISOLINUXCFG
100sed -i "s|%PRESEED%|$PRESEED|g" $ISOLINUXCFG
101
102echo "fetching kernel and initrd..." | tee -a $LOG
103wget -q http://mirrors.mit.edu/ubuntu/dists/$SUITE/main/installer-$ARCH/current/images/netboot/ubuntu-installer/$ARCH/linux -O $TMPDIR/linux
104wget -q http://mirrors.mit.edu/ubuntu/dists/$SUITE/main/installer-$ARCH/current/images/netboot/ubuntu-installer/$ARCH/initrd.gz -O $TMPDIR/initrd.gz
105
106echo "creating iso image..." | tee -a $LOG
107
108IMAGENAME=$SUITE-$ARCH-netboot.iso
109
110mkisofs -r -V "Debathena Boot" \
111        -cache-inodes \
112        -J -l -b isolinux/isolinux.bin \
113        -c isolinux/boot.cat -no-emul-boot \
114        -boot-load-size 4 -boot-info-table \
115        -o $IMAGENAME $TMPDIR 2>&1 | tee -a $LOG
116
117if [ ! -f $BASEDIR/$IMAGENAME ] ; then
118  echo "iso creation failed. exiting..." | tee -a $LOG
119else
120  echo "iso creation success..." | tee -a $LOG
121fi
122
123echo "installing iso into VM image..." | tee -a $LOG
124
125VMWARE_CONFIG=$BASEDIR/vmware_config
126
127#make vmwware boot out virtual disk / iso
128mkdir $TMPDIR/vm
129cp -R $VMWARE_CONFIG/* $TMPDIR/vm
130mv $BASEDIR/$IMAGENAME $TMPDIR/vm
131
132sed -i "s|%ISO%|$IMAGENAME|g" $TMPDIR/vm/default.vmx
133
134vmrun start $TMPDIR/vm/default.vmx 2>&1 | tee -a $LOG
135
136echo "sleeping for 4 hours before launching tests..." | tee -a $LOG
137
138sleep 240m
139
140ATHINFO_VERSION_PASS=`athinfo $HOSTNAME version | grep -c debathena-cluster`
141
142#TODO: get more useful reporting here. The last messages weren't quite working as expected
143if [[ $ATHINFO_VERSION_PASS -ne 1 ]] ; then
144  echo "Test Failed." | tee -a $LOG
145else
146 echo "Test Passed." | tee -a $LOG
147fi
148
149vmrun stop $TMPDIR/vm/default.vmx 2>&1 | tee -a $LOG
150
151echo "done."
152
153exit 0
Note: See TracBrowser for help on using the repository browser.