home · contact · privacy
Bullseye website setup fixes.
authorChristian Heller <c.heller@plomlompom.de>
Mon, 13 Dec 2021 19:09:20 +0000 (20:09 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Mon, 13 Dec 2021 19:09:20 +0000 (20:09 +0100)
bullseye/other_files/plomlombot_daemon.sh [new file with mode: 0755]
bullseye/other_files/website_hook_post-receive [new file with mode: 0755]
bullseye/setup_scripts/setup_website.sh

diff --git a/bullseye/other_files/plomlombot_daemon.sh b/bullseye/other_files/plomlombot_daemon.sh
new file mode 100755 (executable)
index 0000000..c4627af
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+GIT_WORK_TREE=/home/plom/plomlombot-irc git checkout -f
diff --git a/bullseye/other_files/website_hook_post-receive b/bullseye/other_files/website_hook_post-receive
new file mode 100755 (executable)
index 0000000..26d1cce
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+GIT_WORK_TREE=/var/www git checkout -f
index 45a52b5a2225fc5feee77028d10f883666948c51..97e6c948378ce9de4e8be97d33915f3554d38ee6 100755 (executable)
@@ -5,8 +5,8 @@ if [ "$#" -ne 4 ] && [ "$#" -ne 5 ]; then
     echo 'Need domain name and mail and key ID and init state and possibly old server IP as argument.'
     false
 fi
-if [ ! "$4" = "copy" ] && [ ! "$4" = "new" ] && [ ! "$4" = "upgrade" ]; then
-    echo "Need init state to be either 'copy' or 'new' or 'upgrade'"
+if [ ! "$4" = "copy" ] && [ ! "$4" = "new" ]; then
+    echo "Need init state to be either 'copy' or 'new'."
     false
 fi
 if [ ! "$4" = "new" ] && [ "$#" -ne 5 ]; then
@@ -19,8 +19,6 @@ gpg_key="$3"
 init_state="$4"
 old_server="$5"
 
-# NOTE: init_state=upgrade is for migration from older stretch server setup
-
 # Install configs, set up firewall.
 config_tree_prefix="${HOME}/config/bullseye"
 ./install_for_target.sh web website
@@ -69,10 +67,7 @@ ln -s /etc/nginx/sites-available/website.nginx /etc/nginx/sites-enabled/website.
 rm -rf /var/www
 mkdir /var/www
 chown plom:plom /var/www
-if [ "${init_state}" = "upgrade" ]; then
-  # This assumes the old core.plomlompom.com filesystem hierarchy.
-  su -lc "cd /var/repos && git clone --mirror plom@core.plomlompom.com:repos/website" plom
-elif [ "${init_state}" = "new" ]; then
+if [ "${init_state}" = "new" ]; then
   su -lc "cd /var/repos && git init --bare website.git" plom
 fi
 cp "${config_tree_prefix}/other_files/website_hook_post-receive" /var/repos/website.git/hooks/post-receive
@@ -105,8 +100,9 @@ chown -R plom:plom "${irclogs_dir}"
 mkdir -p "${irclogs_pw_dir}"
 chown -R plom:plom "${irclogs_pw_dir}"
 if [ "${init_state}" = "new" ]; then
-    # Handle the case that the repo is in the old pre-buster server setup –
-    # even then, the URL should be the same.
+  # TODO investigate whether we can get rid of anything here
+  # Handle the case that the repo is in the old pre-buster server setup –
+  # even then, the URL should be the same.
   su -lc "cd /var/repos && git clone --mirror https://plomlompom.com/repos/clone/plomlombot-irc" plom
   su -lc "touch /var/repos/plomlombot-irc.git/git-daemon-export-ok" plom
   cp "${config_tree_prefix}/other_files/plomlombot_hook_post-receive" /var/repos/plomlombot-irc.git/hooks/post-receive
@@ -122,10 +118,10 @@ else
   su -lc "./mirror_dir.sh ${old_server} /home/plom/plomlombot_db" plom
   rm /home/plom/mirror_dir.sh
   su -lc "scp plom@${old_server}:.plomlombot ~" plom
-  su -lc "ssh plom@${old_server} \"su -lc 'service plomlombot stop'\"" plom
+  # TODO  su -lc "ssh plom@${old_server} \"su -lc 'service plomlombot stop'\"" plom
 fi
-systemctl enable plomlombot.service
-service plomlombot start
+# TODO systemctl enable plomlombot.service
+# TODO service plomlombot start
 
 # In the above step, we might have created a root-owned /var/www/html –
 # fix this here.