chiark / gitweb /
Fix filename pattern bug which can prevent automatic keypair generation (false claim...
[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 adt_normaluser=$6
10
11 echo '(---'
12
13 cd /root
14
15 if test -f /etc/lsb-release; then
16         . /etc/lsb-release
17         if [ "x$DISTRIB_ID" = xUbuntu ]; then
18                 perl -i~ -pe 's/ main$/ main universe/ if m/^deb http/' \
19                         /etc/apt/sources.list
20         fi
21 fi
22
23 ldconfig
24
25 cat >/etc/fstab <<END
26 proc /proc proc defaults 0 0
27 /dev/hda1 / $adt_fs_type defaults,errors=remount-ro 0 1
28 END
29
30 mkdir -p /etc/network
31 cat >/etc/network/interfaces <<END
32 auto lo
33 iface lo inet loopback
34
35 auto eth0
36 iface eth0 inet static
37         address $adt_guest_ipaddr
38         broadcast $adt_guest_ipaddr
39         netmask 255.255.255.255
40         pointopoint $adt_host_ipaddr
41         gateway $adt_host_ipaddr
42 END
43
44 echo $adt_guest_hostname >/etc/hostname
45
46 essc=/etc/ssh/sshd_config
47 perl -wne '
48     BEGIN {
49         $pep= PermitEmptyPasswords;
50         $want= "$pep no\n";
51         $done= 0;
52     }
53     if (m/^\s*$pep/oi) {
54         $_= $want;
55         $done= 1;
56     }
57     $o .= $_;
58     END {
59         print $want or die $! unless $done;
60         print $o or die $!;
61     }
62 ' $essc >$essc.new
63 mv $essc.new $essc
64
65 if [ x"$adt_normaluser" != x ]; then
66         adduser --gecos 'adtxenlvm testing normal user account' \
67                 --disabled-password ${adt_normaluser}
68 fi
69
70 apt-get update
71 apt-get -y install gdebi-core || apt-get -y install gdebi
72
73 echo '---)'