test-nspawn: make run-tests idempotent (#54189)

Without that it's difficult to test it by running it multiple times.
This commit is contained in:
Benjamin Dauvergne 2021-05-21 11:57:42 +02:00
parent 7453036aba
commit e87082983b
1 changed files with 2 additions and 2 deletions

View File

@ -13,9 +13,9 @@ elif [ $1 = 'run-tests' ]
then
apt update
apt install -y wget ca-certificates gnupg2 git ansible postgresql sudo python python3
adduser --disabled-password --gecos "" testuser
id testuser || adduser --disabled-password --gecos "" testuser
usermod -a -G sudo testuser
echo 'testuser ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
grep -q testuser /etc/sudoers || echo 'testuser ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
chown -R testuser /opt/publik-devinst
/usr/bin/wget https://deb.entrouvert.org/entrouvert.gpg
apt-key add entrouvert.gpg