4 if [ "$#" -ne 4 ]; then
5 echo 'Need domain name and mail and old server IP and key ID as argument.'
13 # Install configs, set up firewall.
14 config_tree_prefix="${HOME}/config/buster"
15 ./install_for_target.sh web website
16 ./copy_dirtree.sh "${config_tree_prefix}/etc_files" "" web website
17 nft -f /etc/nftables.conf
19 # Set up letsencrypt certificate. TODO: Is it auto-renewed?
20 ln -sf /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
21 certbot --nginx --agree-tos --redirect --no-eff-email -m "${mail}" -d "${domain}"
22 rm /etc/nginx/sites-enabled/default
26 chown plom:plom /var/repos
27 # To use this dir, "git clone --mirror" repo source paths into it as user plom.
28 # As user plom, touch git-daemon-export-ok files into it to make the repo
29 # publically available.
31 # Prepare NGINX and GitWeb config.
32 sed -i "s/REPLACE_fqdn_ECALPER/${domain}/g" /etc/gitweb.conf
33 sed -i "s/REPLACE_fqdn_ECALPER/${domain}/g" /etc/nginx/sites-available/website.nginx
34 ln -s /etc/nginx/sites-available/website.nginx /etc/nginx/sites-enabled/website.nginx
36 # Set up website. TODO: use non-/var/www dir for better separation to dump site
39 chown plom:plom /var/www
40 cp "${config_tree_prefix}/setup_scripts/prepare_to_meet_server.sh" /home/plom/
41 chown plom:plom /home/plom/prepare_to_meet_server.sh
42 su -lc "./prepare_to_meet_server.sh ${old_server}" plom
43 read -p'Hit Enter when you are done.' ignore
44 su -lc "cd /var/repos && git clone --mirror ${old_server}:repos/website" plom
45 cp "${config_tree_prefix}/other_files/website_hook_post-receive" /var/repos/website.git/hooks/post-receive
46 su -lc 'cd /var/www && git clone /var/repos/website.git .' plom
47 rm /home/plom/prepare_to_meet_server.sh
50 keyservers='sks-keyservers.net/ keys.gnupg.net'
54 for keyserver in $(echo "${keyservers}"); do
55 su plom -c "gpg --no-tty --keyserver $keyserver --recv-key ${gpg_key}"
56 if [ $? -eq "0" ]; then
60 echo "Attempt with keyserver ${keyserver} unsuccessful, trying other."
62 if [ "${do_break}" -eq "1" ]; then
69 irclogs_dir=/var/www/html/irclogs
70 irclogs_pw_dir=/var/www/irclogs_pw
71 mkdir -p "${irclogs_dir}"
72 chown -R plom:plom "${irclogs_dir}"
73 mkdir -p "${irclogs_pw_dir}"
74 chown -R plom:plom "${irclogs_pw_dir}"
75 su -lc "cd /var/repos && git clone --mirror https://plomlompom.com/repos/clone/plomlombot-irc" plom
76 su -lc "touch /var/repos/plomlombot-irc.git/git-daemon-export-ok" plom
77 cp "${config_tree_prefix}/other_files/plomlombot_hook_post-receive" /var/repos/plomlombot-irc.git/hooks/post-receive
78 su -lc "git clone /var/repos/plomlombot-irc.git" plom
79 cp "${config_tree_prefix}/other_files/plomlombot_daemon.sh" /home/plom/
80 chown plom:plom /home/plom/plomlombot_daemon.sh
81 echo 'bot: plomlombog plomlombog #plomlomtest irc.freenode.net foo bar' >> /home/plom/.plomlombot
82 chown plom:plom /home/plom/.plomlombot
83 systemctl enable plomlombot.service
84 service plomlombot start
87 # - commit git-daemon-export-ok directly into the public repos; rename
88 # /home/plom/public_repos to /home/plom/repos