21 lines
1.1 KiB
Bash
Executable File
21 lines
1.1 KiB
Bash
Executable File
#!/bin/sh -ex
|
|
# USAGE : ./test-debvm bookworm
|
|
|
|
if [ $1 = bookworm ] || [ $1 = trixie ]
|
|
then
|
|
SUITE=$1
|
|
debvm-create --release=$SUITE --size=10G --sshkey=$HOME/.ssh/id_rsa.pub -- --include=ca-certificates,gnupg2,linux-image-generic,locales-all,postgresql,sudo,git,ansible,make --hook-dir=/usr/share/mmdebstrap/hooks/9pmount --mode=unshare
|
|
debvm-run -g --sshport 2222 -- -daemonize -display none -virtfs "local,path=.,mount_tag=publik-devinst,security_model=none"
|
|
debvm-waitssh 2222
|
|
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 2222 root@localhost "cd /media/publik-devinst;./test-debvm run-tests"
|
|
kill `ps ax | grep "qemu-system-x86_64" | awk 'NR==1{print $1}'`
|
|
rm rootfs.ext4
|
|
elif [ $1 = 'run-tests' ]
|
|
then
|
|
adduser --disabled-password --gecos "" testuser
|
|
usermod -a -G sudo testuser
|
|
echo 'testuser ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
|
|
PORT=`pg_lsclusters | tail -n1 | awk '{ print $3 }'`
|
|
su testuser -l -c 'cd /media/publik-devinst; ansible-playbook -e "postgresql_port=$PORT" -i inventory.yml install.yml'
|
|
fi
|