Modifications: etc/sv/openerp7_burette/local.sh +bretzselle,
[lhc/ateliers.git] / etc / nginx / site.d / cyclo-vie / local.sh
1 hint="run before: remote/runit-configure nginx -- $site"
2 assert "sudo test -f /etc/nginx/x509.d/\"$site\"/key.pem" hint
3 assert "sudo test -f ~wiki-$site/etc/ssh/id_rsa" hint
4
5 sudo install -m 664 -o www -g www \
6 "$tool"/var/pub/x509/vie.cyclocoop.org/crt+ca.pem \
7 /etc/nginx/x509.d/"$site"/crt.pem
8
9 "$tool"/local/apt-get-install ikiwiki \
10 xapian-omega \
11 libsearch-xapian-perl \
12 libdigest-sha-perl \
13 libhtml-scrubber-perl
14
15 "$tool"/local/adduser fcgi-"$site" \
16 --disabled-login \
17 --disabled-password \
18 --group \
19 --home /home/cyclo/var/ikiwiki/'"'$site'"' \
20 --shell /bin/false \
21 --system
22 "$tool"/local/adduser www-"$site" \
23 --disabled-login \
24 --disabled-password \
25 --group \
26 --home /home/www/data/"$site" \
27 --shell /bin/false \
28 --system
29 sudo adduser fcgi-"$site" www-"$site"
30 sudo adduser fcgi-"$site" wiki-"$site"
31 #sudo adduser www-"$site"-tls www-"$site"
32 sudo install -d -m 2770 -o wiki-"$site" -g wiki-"$site" \
33 /home/cyclo/var/ikiwiki/"$site"
34 sudo install -d -m 3771 -o git -g git \
35 /home/git/hooks/cyclo
36 sudo install -d -m 750 -o wiki-"$site" -g git \
37 /home/git/hooks/cyclo/"$site"
38 sudo install -m 771 -o git -g git /dev/stdin \
39 /home/git/data/cyclovie.git/hooks/post-update <<-EOF
40 #!/bin/sh -efux
41
42 # The cd below is why we must use this script.
43 # The current directory may not be accessible
44 # by the user running the ikiwiki.
45 # the execution of the ikiwiki wrapper would fail with :
46 # "E: Failed to change to directory '...': Permission denied"
47 cd /
48
49 exec /home/git/hooks/cyclo/$site/post-update.ikiwiki
50 EOF
51
52 if sudo test -d /home/cyclo/var/ikiwiki/"$site"/src/.git
53 then sudo -u wiki-"$site" sh -$-c ' \
54 cd /home/cyclo/var/ikiwiki/'"'$site'"'/src &&
55 git pull -v &&
56 git submodule update --recursive --init'
57 else
58 sudo -u wiki-"$site" sh -$-c ' \
59 umask 007 &&
60 git clone \
61 git@localhost:cyclovie \
62 /home/cyclo/var/ikiwiki/'"'$site'"'/src &&
63 cd /home/cyclo/var/ikiwiki/'"'$site'"'/src &&
64 git config core.sharedRepository group &&
65 git submodule update --recursive --init
66 '
67 fi
68
69 sudo adduser wiki-"$site" www-"$site"
70 sudo install -d -m 2770 -o wiki-"$site" -g fcgi-"$site" \
71 /home/www/data/"$site"/cgi
72 cd /
73 sudo -u wiki-"$site" ikiwiki \
74 --verbose \
75 --setup /home/cyclo/var/ikiwiki/"$site"/src/ikiwiki.setup \
76 --refresh \
77 --wrappers
78 sudo chown fcgi-"$site":wiki-"$site" \
79 /home/git/hooks/cyclo/"$site"/post-update.ikiwiki
80 sudo chmod 6755 \
81 /home/git/hooks/cyclo/"$site"/post-update.ikiwiki
82 sudo chmod g+w \
83 /home/cyclo/var/ikiwiki/"$site"/src/.ikiwiki \
84 /home/cyclo/var/ikiwiki/"$site"/src/.ikiwiki/xapian/default
85
86 sudo cat /etc/gitweb/gitweb.conf - <<-EOF |
87 \$export_ok = "cyclo-vie-export-ok";
88 \$favicon = "/gitweb/static/git-favicon.png";
89 \$home_link = "/";
90 \$home_link_str = 'vie';
91 \$home_text = "/etc/gitweb/cyclo.home_text.html";
92 \$javascript = "/gitweb/static/gitweb.js";
93 \$logo = "/gitweb/static/git-logo.png";
94 \$my_uri = "/gitweb/";
95 \$my_url = "/gitweb/";
96 \$projects_list = "/etc/gitweb/cyclo-vie.projects.list";
97 \$site_footer = "/etc/gitweb/cyclo.site_footer.html";
98 \$site_header = "/etc/gitweb/cyclo.site_header.html";
99 \$site_name = "vie.cyclocoop.org";
100 @stylesheets = ("/gitweb/static/gitweb.css");#
101 EOF
102 sudo install -m 640 -o root -g fcgi-gitweb /dev/stdin \
103 /etc/gitweb/cyclo-vie.conf
104 sudo install -m 640 -o root -g fcgi-gitweb \
105 "$tool"/etc/gitweb/cyclo.home_text.html \
106 /etc/gitweb/cyclo.home_text.html
107 sudo install -m 640 -o root -g fcgi-gitweb /dev/stdin \
108 /etc/gitweb/cyclo-vie.projects.list <<-EOF
109 cyclovie.git
110 EOF