From: Martin Pitt Date: Wed, 25 Jan 2017 10:58:57 +0000 (+0100) Subject: Add vmdebdev: create a Debian/Ubuntu development VM based on a standard autopkgtest VM X-Git-Url: https://piware.de/gitweb/?a=commitdiff_plain;h=62b78b31fc698432e644809c316056060073e17e;p=bin.git Add vmdebdev: create a Debian/Ubuntu development VM based on a standard autopkgtest VM --- diff --git a/vmdebdev b/vmdebdev new file mode 100755 index 0000000..23bbdc7 --- /dev/null +++ b/vmdebdev @@ -0,0 +1,57 @@ +#!/usr/bin/expect -f +# create a Debian/Ubuntu development VM based on a standard autopkgtest VM + +set timeout -1 + +set prompt "(%|#|\\$) $" +set sshkey [read [open ".ssh/id_rsa.pub"]] + +# 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 \ + -virtfs local,id=etcschroot,path=/etc/schroot,security_model=none,mount_tag=etcschroot,readonly + +# Login, and get root shell +expect { + # autopkgtest Debian machine only has a root login + "Debian GNU" { set user "root"; set sudo ""; set getroot "" } + "Ubuntu" { set user "ubuntu"; set password "ubuntu"; set getroot "sudo -n -i" } +} + +expect "login: " +send "$user\r" + +expect { + "Password" { send "$password\r"; exp_continue } + -re $prompt +} + +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