chiark / gitweb /
d35a03d677d5050a98cb722298b7469c705e69da
[autopkgtest.git] / xen / fixups-inside
1 #!/bin/bash
2 set -e${ADT_SHELLX}
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 ldconfig
23
24 cat >/etc/fstab <<END
25 proc /proc proc defaults 0 0
26 /dev/hda1 / $adt_fs_type defaults,errors=remount-ro 0 1
27 END
28
29 mkdir -p /etc/network
30 cat >/etc/network/interfaces <<END
31 auto lo
32 iface lo inet loopback
33
34 auto eth0
35 iface eth0 inet static
36         address $adt_guest_ipaddr
37         broadcast $adt_guest_ipaddr
38         netmask 255.255.255.255
39         pointopoint $adt_host_ipaddr
40         gateway $adt_host_ipaddr
41 END
42
43 echo $adt_guest_hostname >/etc/hostname
44
45 essc=/etc/ssh/sshd_config
46 perl -wne '
47     BEGIN {
48         $pep= PermitEmptyPasswords;
49         $want= "$pep no\n";
50         $done= 0;
51     }
52     if (m/^\s*$pep/oi) {
53         $_= $want;
54         $done= 1;
55     }
56     $o .= $_;
57     END {
58         print $want or die $! unless $done;
59         print $o or die $!;
60     }
61 ' $essc >$essc.new
62 mv $essc.new $essc
63
64 if [ x"$adt_normaluser" != x ]; then
65         adduser --gecos 'adtxenlvm testing normal user account' \
66                 --disabled-password ${adt_normaluser}
67 fi
68
69 apt-get update
70 apt-get -y install gdebi-core || apt-get -y install gdebi
71
72 echo '---)'