|
|
|
@ -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'
|