From: Christian Heller Date: Sun, 22 Mar 2020 22:58:12 +0000 (+0100) Subject: Add website repo setup. X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/static/%7B%7Bdb.prefix%7D%7D/%7B%7Btodo.comment%7D%7D?a=commitdiff_plain;h=999fda5dd0f1a00d284f22644899ff9863a47e69;p=config Add website repo setup. --- diff --git a/buster/other_files/website_hook_post-receive b/buster/other_files/website_hook_post-receive new file mode 100644 index 0000000..26d1cce --- /dev/null +++ b/buster/other_files/website_hook_post-receive @@ -0,0 +1,2 @@ +#!/bin/sh +GIT_WORK_TREE=/var/www git checkout -f diff --git a/buster/setup_scripts/setup_website.sh b/buster/setup_scripts/setup_website.sh index f060f0d..2910eee 100755 --- a/buster/setup_scripts/setup_website.sh +++ b/buster/setup_scripts/setup_website.sh @@ -3,12 +3,13 @@ set -e set -x # Heavily inspired by -if [ "$#" -ne 2 ]; then - echo 'Need domain name and mail as argument.' +if [ "$#" -ne 3 ]; then + echo 'Need domain name and mail and old server IP as argument.' false fi domain="$1" mail="$2" +old_server="$3" # Install configs, set up firewall. config_tree_prefix="${HOME}/config/buster" @@ -33,4 +34,20 @@ sed -i "s/REPLACE_fqdn_ECALPER/${domain}/g" /etc/gitweb.conf sed -i "s/REPLACE_fqdn_ECALPER/${domain}/g" /etc/nginx/sites-available/website.nginx ln -s /etc/nginx/sites-available/website.nginx /etc/nginx/sites-enabled/website.nginx +# Set up website. +rm -rf /var/www +mkdir /var/www +chown plom:plom /var/www +cp "${config_tree_prefix}/setup_scripts/prepare_to_meet_server.sh" /home/plom/ +chown plom:plom /home/plom/prepare_to_meet_server.sh +su -lc plom "./prepare_to_meet_server.sh ${old_server}" +read -p'Hit Enter when you are done.' ignore +su -lc plom "cd /var/repos && git clone --mirror ${old_server}/repos/website" +cp "${config_tree_prefix}/other_files/website_hook_post-receive /var/repos/website.git/hooks/post-receive" +su -lc plom 'cd /var/www && git clone /var/repos/website.git .' + +# TODO: +# - commit git-daemon-export-ok directly into the public repos; rename +# /home/plom/public_repos to /home/plom/repos + service nginx restart