add test_devinst_in_cowbuilder
This commit is contained in:
parent
dfa2f4a17f
commit
8390077b75
|
@ -0,0 +1,33 @@
|
|||
#!/bin/sh
|
||||
set -ex
|
||||
|
||||
dist=buster
|
||||
repo='deb http://deb.entrouvert.org/ stretch main'
|
||||
fork=/tmp/chroot-${dist}
|
||||
|
||||
clean() {
|
||||
chroot $fork cow-shell /etc/init.d/postgresql stop || true
|
||||
if mount | grep $fork/proc >/dev/null; then umount $fork/proc; fi
|
||||
if mount | grep $fork/dev/shm >/dev/null; then umount $fork/dev/shm; fi
|
||||
if [ -d $fork ]; then rm -rf $fork; fi
|
||||
}
|
||||
trap clean EXIT
|
||||
|
||||
clean
|
||||
cp -al /var/cache/pbuilder/$dist/base.cow $fork
|
||||
echo $repo >> $fork/etc/apt/sources.list.d/entrouvert.list
|
||||
mount -t proc proc $fork/proc # need by postgresql
|
||||
mount --bind /dev/shm $fork/dev/shm # needed by ansible for multiprocessing
|
||||
|
||||
alias shell="COWDANCER_REUSE=yes chroot $fork cow-shell"
|
||||
shell apt install -y wget ca-certificates gnupg2 git ansible postgresql sudo python
|
||||
shell adduser --disabled-password --gecos "" testuser
|
||||
shell usermod -a -G sudo testuser
|
||||
echo 'testuser ALL=(ALL) NOPASSWD:ALL' >> $fork/etc/sudoers
|
||||
cp -r . $fork/home/testuser
|
||||
|
||||
shell /usr/bin/wget https://deb.entrouvert.org/entrouvert.gpg
|
||||
shell apt-key add entrouvert.gpg
|
||||
shell apt update
|
||||
shell /etc/init.d/postgresql start
|
||||
shell su testuser -l -c 'ansible-playbook -i inventory.yml install.yml'
|
Loading…
Reference in New Issue