set -x
# Heavily inspired by <https://docs-develop.pleroma.social/backend/installation/debian_based_en/>
-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"
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