--- /dev/null
+local hint="run before: ./vm_remote runit_configure nginx -- $site"
+assert "sudo getent passwd wiki-\"$site\" >/dev/null" hint
+assert "sudo test -f ~wiki-$site/etc/ssh/id_rsa" hint
+
+"$tool"/local/apt-get-install ikiwiki \
+ libsearch-xapian-perl
+
+"$tool"/local/adduser fcgi-"$site" \
+ --disabled-login \
+ --disabled-password \
+ --group \
+ --home /home/www/pub/"$site" \
+ --shell /bin/false \
+ --system
+"$tool"/local/adduser www-"$site" \
+ --disabled-login \
+ --disabled-password \
+ --group \
+ --home /home/www/pub/"$site" \
+ --shell /bin/false \
+ --system
+sudo adduser fcgi-"$site" www-"$site"
+sudo adduser fcgi-"$site" wiki-"$site"
+#sudo adduser www-"$site"-tls www-"$site"
+sudo install -d -m 2770 -o wiki-"$site" -g wiki-"$site" \
+ /home/lhc/var/ikiwiki/remorque
+
+sudo install -d -m 2770 -o wiki-"$site" -g wiki-"$site" \
+ /home/lhc/var/ikiwiki/remorque
+sudo install -d -m 2750 -o wiki-"$site" -g git \
+ /home/git/hooks/lhc \
+ /home/git/hooks/lhc/remorque
+sudo install -m 771 -o git -g git /dev/stdin \
+ /home/git/pub/lhc/remorque.git/hooks/post-update <<-EOF
+ #!/bin/sh -efux
+
+ # The cd below is why we must use this script.
+ # The current directory may not be accessible
+ # by the user running the ikiwiki.
+ # the execution of the ikiwiki wrapper would fail with :
+ # "E: Failed to change to directory '...': Permission denied"
+ cd /
+
+ exec /home/git/hooks/lhc/remorque/post-update.ikiwiki
+ EOF
+
+if sudo test -d /home/lhc/var/ikiwiki/remorque/.git
+ then sudo -u wiki-"$site" \
+ sh -c 'cd /home/lhc/var/ikiwiki/remorque && git pull -v'
+ else
+ sudo -u wiki-"$site" \
+ git clone \
+ git@localhost:lhc/remorque \
+ /home/lhc/var/ikiwiki/remorque/git
+ set +f
+ sudo mv -i \
+ /home/lhc/var/ikiwiki/remorque/git/.git* \
+ /home/lhc/var/ikiwiki/remorque/git/* \
+ /home/lhc/var/ikiwiki/remorque/
+ sudo rmdir /home/lhc/var/ikiwiki/remorque/git
+ fi
+
+sudo install -m 400 -o wiki-"$site" -g wiki-"$site" \
+ "$tool"/etc/nginx/site.d/"$site"/ikiwiki.setup \
+ /home/lhc/var/ikiwiki/remorque/etc/ikiwiki.setup
+sudo adduser wiki-"$site" www-"$site"
+sudo install -d -m 2770 -o wiki-"$site" -g fcgi-"$site" \
+ /home/www/pub/"$site"/cgi
+cd /
+sudo -u wiki-"$site" ikiwiki \
+ --verbose \
+ --setup /home/lhc/var/ikiwiki/remorque/etc/ikiwiki.setup \
+ --refresh \
+ --wrappers