Projet

Général

Profil

0001-add-test_devinst_in_cowbuilder.patch

Christophe Siraut, 03 octobre 2019 13:45

Télécharger (1,69 ko)

Voir les différences:

Subject: [PATCH] add test_devinst_in_cowbuilder

 test_devinst_in_cowbuilder.sh | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100755 test_devinst_in_cowbuilder.sh
test_devinst_in_cowbuilder.sh
1
#!/bin/sh
2
set -ex
3

  
4
dist=buster
5
repo='deb http://deb.entrouvert.org/ stretch main'
6
fork=/tmp/chroot-${dist}
7

  
8
clean() {
9
    chroot $fork cow-shell /etc/init.d/postgresql stop || true
10
    if [ -e $fork/proc ]; then umount $fork/proc; fi
11
    if [ -e $fork/dev/shm ]; then umount $fork/dev/shm; fi
12
    if [ -d $fork ]; then rm -rf $fork; fi
13
}
14
trap clean EXIT
15

  
16
clean
17
cp -al /var/cache/pbuilder/stretch/base.cow $fork
18
echo $repo >> $fork/etc/apt/sources.list.d/entrouvert.list
19
mount -t proc proc $fork/proc  # need by postgresql
20
mount --bind /dev/shm $fork/dev/shm  # needed by ansible for multiprocessing
21

  
22
alias shell="COWDANCER_REUSE=yes chroot $fork cow-shell"
23
shell apt install -y wget ca-certificates gnupg2 git ansible postgresql sudo
24
shell adduser --disabled-password --gecos "" testuser
25
shell usermod -a -G sudo testuser
26
echo 'testuser ALL=(ALL) NOPASSWD:ALL' >> $fork/etc/sudoers
27
cp -r . $fork/home/testuser
28

  
29
shell /usr/bin/wget https://deb.entrouvert.org/entrouvert.gpg
30
shell apt-key add entrouvert.gpg
31
shell apt update
32
shell /etc/init.d/postgresql start
33
shell su testuser -l -c 'ansible-playbook -i inventory.yml install.yml'
0
-