#!/bin/sh set -ex if [ $1 = bullseye ] || [ $1 = bookworm ] then suite=$1 image=publik-devinst-$suite fs=/var/lib/machines/$image test -d $fs || (cd /var/lib/machines && debootstrap --include=systemd-container $suite $image http://deb.debian.org/debian/) rsync -a --delete . $fs/opt/publik-devinst systemd-nspawn -x -D $fs /opt/publik-devinst/test-nspawn run-tests elif [ $1 = 'run-tests' ] then apt update apt full-upgrade -y apt install -y wget ca-certificates gnupg2 git ansible postgresql sudo python3 id testuser || adduser --disabled-password --gecos "" testuser usermod -a -G sudo testuser grep -q testuser /etc/sudoers || echo 'testuser ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers chown -R testuser /opt/publik-devinst service postgresql start hostname jenkins PORT=`pg_lsclusters | tail -n1 | awk '{ print $3 }'` echo 'cd /opt/publik-devinst; ansible-playbook -i inventory.yml -e "{postgresql_port: '$PORT'}" install.yml' su testuser -l -c 'cd /opt/publik-devinst; ansible-playbook -i inventory.yml -e "{postgresql_port: '$PORT'}" install.yml' su testuser -l -c '/home/testuser/envs/publik-env-py3/bin/pip freeze' fi