]> piware.de Git - bin.git/blobdiff - vmdebdev
build-debian-toolbox: Avoid deb.debian.org
[bin.git] / vmdebdev
index 23bbdc703d8e009e8cda538ecbd85e30a5412992..615e88f4280fbd1cade07292bb277afb7639ecc7 100755 (executable)
--- a/vmdebdev
+++ b/vmdebdev
@@ -4,12 +4,14 @@
 set timeout -1
 
 set prompt "(%|#|\\$) $"
-set sshkey [read [open ".ssh/id_rsa.pub"]]
+set sshkey [read [open "~/.ssh/id_rsa.pub"]]
+set timeout 60
 
 # Start the guest VM
 set img [lrange $argv 0 0]
 if { $img == "" } { set img "/srv/vm/autopkgtest-sid.img" }
-spawn vm $img -nographic -snapshot -virtfs local,id=srv,path=/srv,security_model=none,mount_tag=srv,readonly \
+spawn vm $img -nographic -snapshot -cpu host -smp 3 \
+              -virtfs local,id=srv,path=/srv,security_model=none,mount_tag=srv,readonly \
               -virtfs local,id=etcschroot,path=/etc/schroot,security_model=none,mount_tag=etcschroot,readonly
 
 # Login, and get root shell
@@ -30,28 +32,28 @@ expect {
 send "export TERM=xterm; $getroot\r"
 expect -re $prompt
 
-# install wanted packages
-send "apt-get install -o Dpkg::Options::=--force-confnew -y sudo less bash-completion vim openssh-server locales git-buildpackage build-essential fakeroot lintian debhelper manpages-dev git dput pristine-tar schroot sbuild </dev/null\r"
+# install wanted packages; openssh postinst does funny things to the terminal, so only give it pipes
+send "DEBIAN_FRONTEND=noninteractive apt-get install -o Dpkg::Options::=--force-confnew -y git-buildpackage libwww-perl less vim lintian build-essential debhelper manpages-dev git dput pristine-tar bash-completion libnss-myhostname lptools python-keyrings.alt wget gnupg2 ubuntu-dev-tools python3-debian qemu-kvm qemu-utils schroot sbuild locales openssh-server </dev/null 2>&1 | cat\r"
 expect -re $prompt
 
 # set up user
 send "deluser --remove-home test; adduser --disabled-password --gecos 'Martin Pitt' martin; echo 'martin:a' | chpasswd; adduser martin sbuild\r"
 expect -re $prompt
 
-send "echo 'martin ALL=(ALL) NOPASSWD:ALL' | tee /etc/sudoers.d/martin; update-locale LANG=C.UTF-8; touch /var/lib/sudo/lectured/martin\r"
+send "echo 'martin ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/martin; update-locale LANG=C.UTF-8; touch /var/lib/sudo/lectured/martin\r"
 expect -re $prompt
-send "mkdir /home/martin/.ssh; echo '$sshkey' | tee /home/martin/.ssh/authorized_keys; chown -R martin:martin /home/martin/.ssh\r"
+send "mkdir /home/martin/.ssh; echo '$sshkey' > /home/martin/.ssh/authorized_keys; chown -R martin:martin /home/martin/.ssh\r"
 expect -re $prompt
 
 # mount home, /srv, and schroot config from host; TODO: move to NFS?
-send "mkdir /home/martin/h; printf 'home /home/martin/h 9p trans=virtio,access=any,nofail,ro 0 0\nsrv /srv 9p trans=virtio,access=any,nofail,ro 0 0\netcschroot /etc/schroot 9p trans=virtio,access=any,nofail,ro 0 0\n' | tee -a /etc/fstab; mount /home/martin/h; mount /srv; mount /etc/schroot\r"
+send "mkdir /home/martin/h; printf 'home /home/martin/h 9p trans=virtio,access=any,nofail,ro 0 0\nsrv /srv 9p trans=virtio,access=any,nofail,ro 0 0\netcschroot /etc/schroot 9p trans=virtio,access=any,nofail,ro 0 0\n' >> /etc/fstab; mount /home/martin/h; mount /srv; mount /etc/schroot\r"
 expect -re $prompt
 send "(cd /home/martin; ln -s h/.gbp.conf; ln -s h/.vimrc)\r"
+expect -re $prompt
 
-# set up lxd if available (on Ubuntu)
-# FIXME: lxd init invocation aborts expect/qemu
-#send "apt-get install -y lxd </dev/null && adduser martin lxd && yes '' | lxd init || true\r"
-send "apt-get install -y lxd </dev/null && adduser martin lxd || true\r"
+#
+## install lxd if available (on Ubuntu)
+send "(apt-get install -y lxd </dev/null && adduser martin lxd) 2>&1 | cat\r"
 expect -re $prompt
 
 interact