From: Christian Heller <c.heller@plomlompom.de>
Date: Fri, 24 Apr 2020 20:48:07 +0000 (+0200)
Subject: Fix.
X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/%7B%7Bprefix%7D%7D/%7B%7Bdb.prefix%7D%7D/foo.html?a=commitdiff_plain;h=c3108592928149ebe3ef4ee76d979b8dd96a3c54;p=config

Fix.
---

diff --git a/buster/setup_scripts/setup_dumpsite.sh b/buster/setup_scripts/setup_dumpsite.sh
index 000045b..0e6cdc6 100755
--- a/buster/setup_scripts/setup_dumpsite.sh
+++ b/buster/setup_scripts/setup_dumpsite.sh
@@ -1,13 +1,18 @@
 #!/bin/sh
 set -e
 
-if [ "$#" -ne 3 ]; then
-    echo 'Need domain name (choose wisely!) and mail and old server.'
+if [ "$#" -ne 4 ]; then
+    echo 'Need domain name (choose wisely!) and mail and old server and repos source ("local" or "remote"?).'
+    false
+fi
+if [ ! "$4" = "local" ] && [ ! "$4" = "remote" ]; then
+    echo "Need legal repo source name."
     false
 fi
 domain="$1"
 mail="$2"
 old_server="$3"
+repos_source="$4"
 
 # Install configs, set up firewall.
 echo "postfix postfix/main_mailer_type string 'Internet Site'" | debconf-set-selections
@@ -60,7 +65,11 @@ su -lc "git clone --mirror ${old_server}:blog.git" plom
 cp "${config_tree_prefix}/other_files/blog_hook_post-receive" /home/plom/blog.git/hooks/post-receive
 su -lc "git clone ~/blog.git" plom
 # TODO: set up like plomlombot repo (with post-recieve hook)?
-su -lc "git clone https://plomlompom.com/repos/clone/redo-blog" plom
+if [ "$repo_source" = "local"]; then
+  su -lc "git clone /var/repos/redo-blog" plom
+else
+  su -lc "git clone https://plomlompom.com/repos/clone/redo-blog" plom
+fi
 su -lc "cd redo-blog && ./add_dir.sh ~/blog" plom
 su -lc "cd blog && redo" plom
 su -lc "ln -s /home/plom/blog/public /var/www-dump/blog" plom
@@ -68,7 +77,11 @@ su -lc "ln -s /home/plom/blog/public /var/www-dump/blog" plom
 
 # Set up url catcher.
 # TODO: set up like plomlombot repo (with post-recieve hook)?
-su -lc "git clone https://plomlompom.com/repos/clone/url-catcher" plom
+if [ "$repo_source" = "local"]; then
+  su -lc "git clone /var/repos/url-catcher" plom
+else
+  su -lc "git clone https://plomlompom.com/repos/clone/url-catcher" plom
+fi
 su -lc "cd url-catcher && ln -s ../blog/captchas/linkable/ captchas" plom
 cp "${config_tree_prefix}/other_files/url-catcher_customizations.json" /home/plom/url-catcher/customizations.json
 systemctl enable url_catcher.service