chiark / gitweb /
adt-run: Fix typo to make "build-needed" work (Closes #637353)
[autopkgtest.git] / xen / fixups
index 3ab114c0d1d2481665a8c458c6d28709c7a9350c..c09a5403955db390290bfd17f22f0aaa60e67632 100755 (executable)
@@ -1,5 +1,5 @@
-#!/bin/sh
-set -ex
+#!/bin/bash
+set -e
 . ${ADT_XENLVM_SHARE:=/usr/share/autopkgtest/xenlvm}/readconfig
 
 dest=$adt_play/base
@@ -8,11 +8,15 @@ echo '---fixups:'
 
 cp ${ADT_XENLVM_SHARE}/fixups-inside $dest/root/
 
-mkdir -p $dest/lib/modules
-cp -a "${adt_modules}" $dest/lib/modules/.
+if test -d "${adt_modules}"; then
+       mkdir -p $dest/lib/modules
+       cp -a "${adt_modules}" $dest/lib/modules/.
+fi
+
+echo xennet >>$dest/etc/modules
 
 if ! test -f "${adt_ssh_pubkey}"; then
-       if [ "x${adt_ssh_pubkey}" != "x${adt_ssh_privkey}.priv" ]; then
+       if [ "x${adt_ssh_pubkey}" != "x${adt_ssh_privkey}.pub" ]; then
                fail "cannot generate keypair automatically because adt_ssh_privkey \`$adt_ssh_privkey' and adt_ssh_pubkey \`$adt_ssh_pubkey' do not match up in the way required by ssh-keygen (<pubkey> must be <privkey>.pub>"
        fi
        if test -f "${adt_ssh_privkey}"; then
@@ -25,6 +29,9 @@ fi
 
 mkdir -m 02700 -p $dest/root/.ssh
 cp -- "${adt_ssh_pubkey}" $dest/root/.ssh/authorized_keys
+if [ "x$adt_sshauthkeys_hook" != x ]; then
+       cat -- "$adt_sshauthkeys_hook" >>$dest/root/.ssh/authorized_keys
+fi
 
 cat <<END >$dest/etc/init.d/xenethtoolk
 #!/bin/sh
@@ -42,7 +49,8 @@ ln -s ../init.d/xenethtoolk $dest/etc/rc2.d/S21xenethtoolk
 chroot $dest root/fixups-inside \
        "$adt_host_hostname" "$adt_guest_hostname" \
        "$adt_host_ipaddr" "$adt_guest_ipaddr" \
-       "$adt_fs_type"
+       "$adt_fs_type" "$adt_normaluser" \
+       "$provideswap"
 
 kh=/etc/ssh/ssh_known_hosts
 test ! -f $kh || cp $kh $kh.new
@@ -55,6 +63,14 @@ done
 exec 3>&-
 mv $kh.new $kh
 
+if test -f $dest/etc/udev/rules.d/*-persistent-net-generator.rules; then
+       rules_file="`grep '^RULES_FILE=' $dest/lib/udev/write_net_rules`"
+       rules_file=${rules_file#RULES_FILE=}
+       rules_file=${rules_file#[\'\"]}
+       rules_file=${rules_file%[\'\"]}
+       echo 'SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="'$adt_guest_macaddr'", NAME="eth0"' >"$dest/$rules_file"
+fi
+
 echo '
 === adt xen fixups done.
 '