From: Christian Heller Date: Mon, 13 Dec 2021 19:09:20 +0000 (+0100) Subject: Bullseye website setup fixes. X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/add_task?a=commitdiff_plain;h=9a648d159af2e3a914ea9c335f3e3bedd867fc71;p=config Bullseye website setup fixes. --- diff --git a/bullseye/other_files/plomlombot_daemon.sh b/bullseye/other_files/plomlombot_daemon.sh new file mode 100755 index 0000000..c4627af --- /dev/null +++ b/bullseye/other_files/plomlombot_daemon.sh @@ -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 index 0000000..26d1cce --- /dev/null +++ b/bullseye/other_files/website_hook_post-receive @@ -0,0 +1,2 @@ +#!/bin/sh +GIT_WORK_TREE=/var/www git checkout -f diff --git a/bullseye/setup_scripts/setup_website.sh b/bullseye/setup_scripts/setup_website.sh index 45a52b5..97e6c94 100755 --- a/bullseye/setup_scripts/setup_website.sh +++ b/bullseye/setup_scripts/setup_website.sh @@ -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.