Ajout : vm_hosted : lhc-remorque .
[lhc/ateliers.git] / etc / nginx / site.d / lhc-remorque / configure.sh
1 local hint="run vm_remote nginx_configure before"
2 assert "sudo getent passwd wiki-\"$site\" >/dev/null" hint
3 assert "sudo test -f ~wiki-$site/etc/ssh/id_rsa" hint
4
5 rule apt_get_install ikiwiki \
6 libsearch-xapian-perl
7
8 rule adduser fcgi-"$site" \
9 --disabled-login \
10 --disabled-password \
11 --group \
12 --home /home/www/pub/"$site" \
13 --shell /bin/false \
14 --system
15 rule adduser www-"$site" \
16 --disabled-login \
17 --disabled-password \
18 --group \
19 --home /home/www/pub/"$site" \
20 --shell /bin/false \
21 --system
22 sudo adduser fcgi-"$site" www-"$site"
23 sudo adduser fcgi-"$site" wiki-"$site"
24 #sudo adduser www-"$site"-tls www-"$site"
25 sudo install -d -m 2770 -o wiki-"$site" -g wiki-"$site" \
26 /home/lhc/var/ikiwiki/remorque
27
28 sudo install -d -m 2770 -o wiki-"$site" -g wiki-"$site" \
29 /home/lhc/var/ikiwiki/remorque
30 sudo install -d -m 2750 -o wiki-"$site" -g git \
31 /home/git/hooks/remorque
32 sudo install -m 3771 -o git -g git /dev/stdin \
33 /home/git/pub/remorqueatelier.git/hooks/post-update <<-EOF
34 #!/bin/sh -efux
35
36 # The cd below is why we must use this script.
37 # The current directory may not be accessible
38 # by the user running the ikiwiki.
39 # the execution of the ikiwiki wrapper would fail with :
40 # "E: Failed to change to directory '...': Permission denied"
41 cd /
42
43 exec /home/git/hooks/remorque/post-update.ikiwiki
44 EOF
45
46 if test -d /home/lhc/var/ikiwiki/remorque/.git
47 then sudo -u wiki-"$site" \
48 sh -c 'cd /home/lhc/var/ikiwiki/remorque && git pull -v'
49 else
50 (
51 eval cd ~wiki-"$site"
52 set +f
53 sudo -u wiki-"$site" \
54 git clone \
55 git@localhost:remorqueatelier \
56 /home/lhc/var/ikiwiki/remorque/git
57 sudo mv -i \
58 /home/lhc/var/ikiwiki/remorque/git/.git* \
59 /home/lhc/var/ikiwiki/remorque/git/* \
60 /home/lhc/var/ikiwiki/remorque/
61 )
62 sudo rmdir /home/lhc/var/ikiwiki/remorque/git
63 fi
64
65 sudo install -m 400 -o wiki-"$site" -g wiki-"$site" \
66 "$tool"/etc/nginx/site.d/"$site"/ikiwiki.setup \
67 /home/lhc/var/ikiwiki/remorque/etc/ikiwiki.setup
68 eval cd ~wiki-"$site"
69 sudo adduser wiki-"$site" www-"$site"
70
71 sudo install -d -m 2770 -o wiki-"$site" -g fcgi-"$site" \
72 /home/www/pub/"$site"/cgi
73
74 sudo -u wiki-"$site" ikiwiki \
75 --verbose \
76 --setup /home/lhc/var/ikiwiki/remorque/etc/ikiwiki.setup \
77 --refresh \
78 --wrappers