chiark / gitweb /
working on config and docs
[autopkgtest.git] / xen / tail-config
1 case "$adt_lvm_vg" in
2 '')
3         echo "searching for default volume group ..."
4         vgdisplay_out=`vgdisplay -c`
5         case "$vgdisplay_out" in
6         "")     fail 'no volume groups found';;
7         *"
8 "*)             fail 'several volume groups, config must specify which';;
9         esac
10         $adt_lvm_vg=${vgdisplay_out%%:*}
11         echo "system has one volume group, $adt_vg, using that."
12         ;;
13 esac
14
15 case "$adt_kernel" in
16 '')
17         echo "searching for kernel ..."
18         for f in /boot/xen*"`uname -r`"; do
19                 test -f "$f" || continue
20                 test "x$adt_kernel" = x || \
21                         fail 'several kernels, config must specify which'
22                 adt_kernel="$f"
23         done
24         echo "... using currently booted kernel $adt_kernel"
25         ;;
26 esac
27
28 case "$adt_ramdisk" in
29 none)   echo "ramdisk \`none' specified, using static kernel"
30         adt_ramdisk='' ;;
31 '')     adt_ramdisk="$adt_kernel.initrd.img"
32         echo "using default ramdisk <kernel>.initrd.img, $adt_ramdisk" ;;
33 *)      ;;
34 esac
35
36 case "$adt_distro" in
37 '')
38         echo "considering which distro to use ..."
39         test -f /etc/lsb-release || \
40                 fail 'no /etc/lsb-version, config must specify adt_distro'
41         . /etc/lsb-release
42         $adt_distro=$DISTRIB_CODENAME
43         ;;
44 esac
45
46 hostname_from_ipaddr () {
47  eval '
48   if [ x"$adt_'$1'_hostname" = x ] && \
49      [ x"$adt_'$1'_ipaddr" != x ]; then
50    echo "finding '$1' hostname from IP address $adt_'$1'_ipaddr"
51    adt_'$1'_hostname=`adnshost -t ptr +Do +Dt +Dc -i $adt_'$1'_ipaddr`
52   fi
53  '
54 }
55
56 hostname_from_ipaddr guest
57 hostname_from_ipaddr host
58
59 if [ x"$adt_host_hostname" = x ]; then
60         echo "finding host hostname, supposely our own FQDN ..."
61         adt_host_hostname=`hostname -f`
62 fi
63
64 if [ x"$adt_guest_hostname" = x ]; then
65         case "$adt_guests_domain" in
66         '')     echo "guessing guest hostname from host hostname ..."
67  adt_guest_hostname=$adt_distro.$adt_nominum.${adt_host_hostname#*.} ;;
68         .*)     echo "setting guest hostname using distro and nominum ..."
69  adt_guest_hostname=$adt_distro.$adt_nominum$adt_guests_domain ;;
70         *)      echo "setting guest hostname using distro and domain ..."
71  adt_guest_hostname=$adt_distro.$adt_guests_domain ;;
72         esac
73 fi
74
75 ipaddr_from_hostname () {
76  eval '
77   if [ x"$adt_'$1'_ipaddr" = x ] && \
78      [ x"$adt_'$1'_hostname" != x ]; then
79    echo "finding '$1' IP address from hostname $adt_'$1'_hostname"
80    adt_'$1'_ipaddr=`adnshost -t a +Do +Dt +Dc -i - "$adt_'$1'_hostname"`
81   fi
82  '
83 }
84
85 ipaddr_from_hostname guest
86 ipaddr_from_hostname host
87
88 # SSH
89 : ${adt_sshkey:=/root/.ssh/id_dsa_${adt_nominum}}
90
91 # Xen
92 : ${adt_xmname:=${adt_nominum}_${adt_distro}}
93
94 # In-host-file-system playground
95 : ${adt_play:=${adt_playbase}/${adt_distro}}
96 : ${adt_xmconfig:=${adt_play}/xmconfig}
97
98 # LVM
99 : ${adt_nbase:=${adt_nominum}_${adt_distro}_base}
100 : ${adt_lvbaserhs:=${adt_vg}/${adt_nbase}}
101 : ${adt_lvbase:=/dev/${adt_lvbaserhs}}
102
103 : ${adt_nsnap:=${adt_nominum}_${adt_distro}_snap}
104 : ${adt_lvsnap:=/dev/mapper/${adt_nsnap}}
105
106 : ${adt_ncowdata:=${adt_nominum}_${adt_distro}_cowdata}
107 : ${adt_lvcowdatarhs:=${adt_vg}/${adt_ncowdata}}
108 : ${adt_lvcowdata:=/dev/${adt_lvcowdatarhs}}
109
110 : ${adt_lvfsptrrhs:=${adt_nominum}_fs/${adt_distro}}
111 : ${adt_lvfsptr:=/dev/${adt_lvfsptrrhs}}