Ajout : garradin.
[lhc/ateliers.git] / etc / nginx / site.d / cyclo-ivry-garradin / local.sh
diff --git a/etc/nginx/site.d/cyclo-ivry-garradin/local.sh b/etc/nginx/site.d/cyclo-ivry-garradin/local.sh
new file mode 100644 (file)
index 0000000..1e79f2d
--- /dev/null
@@ -0,0 +1,32 @@
+site_=$(printf %s "$site" | sed -e 's/-/_/g')
+sudo adduser php_"$site_" www-"$site"
+
+sudo install -m 664 -o www -g www \
+ "$tool"/var/pub/x509/garradin.cyclocoop.org/crt+ca.pem \
+  /etc/nginx/x509.d/"$site"/crt.pem
+
+eval dst=~www-"$site"
+for src in \
+       cron.php \
+       include \
+       plugins \
+       www
+ do
+       sudo test -e "$dst"/"$src" ||
+       sudo ln -s /usr/share/garradin/"$src" "$dst"
+ done
+
+(
+sudo test -e "$dst"/"templates" ||
+sudo -u php_"$site_" cp -r /usr/share/garradin/templates "$dst"
+)
+
+sudo install -m 660 -o php_"$site_" -g php_"$site_" \
+ "$tool"/etc/nginx/site.d/"$site"/config.php \
+ "$dst"/config.php
+
+sudo install -d -m 2770 -o php_"$site_" -g php_"$site_" \
+ "$dst"/data \
+ "$dst"/data/cache \
+ "$dst"/data/www \
+ "$dst"/data/www/squelettes