chiark / gitweb /
wip productisation
[autopkgtest.git] / xen / fixups-inside
1 #!/bin/sh
2 set -ex
3
4 adt_host_hostname=$1
5 adt_guest_hostname=$2
6 adt_host_ipaddr=$3
7 adt_guest_ipaddr=$4
8 adt_fs_type=$5
9
10 echo '(---'
11
12 cd /root
13
14 if test -f /etc/lsb-release; then
15         . /etc/lsb-release
16         if [ "x$DISTRIB_ID" = xUbuntu ]; then
17                 perl -i~ -pe 's/ main$/ main universe/ if m/^deb http/' \
18                         /etc/apt/sources.list
19         fi
20 fi
21
22 apt-get update
23 apt-get -y --force-yes install libc6-xen
24
25 ldconfig
26
27 cat >/etc/fstab <<END
28 proc /proc proc defaults 0 0
29 /dev/hda1 / $adt_fs_type defaults,errors=remount-ro 0 1
30 END
31
32 mkdir -p /etc/network
33 cat >/etc/network/interfaces <<END
34 auto lo
35 iface lo inet loopback
36
37 auto eth0
38 iface eth0 inet static
39         address $adt_guest_ipaddr
40         broadcast $adt_guest_ipaddr
41         netmask 255.255.255.255
42         pointopoint $adt_host_ipaddr
43         gateway $adt_host_ipaddr
44 END
45
46 echo $adt_guest_hostname >/etc/hostname
47
48 apt-get -y --force-yes install \
49         openssh-server ed build-essential
50
51 perl -i~ -wne '
52     BEGIN {
53         $pep= PermitEmptyPasswords;
54         $want= "$pep no\n";
55         $done= 0;
56     }
57     if (m/^\s*$pep/oi) {
58         $_= $want;
59         $done= 1;
60     }
61     $o .= $_;
62     END {
63         print $want or die $! unless $done;
64         print $o or die $!;
65     }
66 ' /etc/ssh/sshd_config
67
68 echo '---)'