5 if [ "$#" -ne 3 ]; then
6 echo 'Need domain name and mail and old server.'
13 # Install configs, set up firewall.
14 echo "postfix postfix/main_mailer_type string 'Internet Site'" | debconf-set-selections
15 echo "postfix postfix/mailname string $(hostname -f)" | debconf-set-selections
16 config_tree_prefix="${HOME}/config/buster"
17 ./install_for_target.sh web dumpsite
18 ./copy_dirtree.sh "${config_tree_prefix}/etc_files" "" web dumpsite
19 nft -f /etc/nftables.conf
21 # Set up letsencrypt certificate. TODO: Is it auto-renewed?
22 ln -sf /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
23 certbot --nginx --agree-tos --redirect --no-eff-email -m "${mail}" -d "${domain}"
24 rm /etc/nginx/sites-enabled/default
28 chown plom:plom /var/www-dump
31 su -lc "mkdir ${dump_dir} ${geheim_dir}" plom
32 su -lc "ln -s /home/plom/${dump_dir} /var/www-dump/${dump_dir}" plom
33 su -lc "ln -s /home/plom/${geheim_dir} /var/www-dump/${geheim_dir}" plom
34 password_geheim=$(pwgen -1)
35 echo "foo:{PLAIN}${password_geheim}" > /var/www-dump/password_geheim
36 echo "geheim password is: ${password_geheim}"
39 wget http://news.dieweltistgarnichtso.net/bin/archives/redo-sh.tar.gz
40 tar -moxzf redo-sh.tar.gz -C /usr/local
42 # Set up connection to old dump server.
43 cp "${config_tree_prefix}/setup_scripts/prepare_to_meet_server.sh" /home/plom/
44 chown plom:plom /home/plom/prepare_to_meet_server.sh
45 su -lc "./prepare_to_meet_server.sh ${old_server}" plom
46 read -p'Hit Enter when you are done.' ignore
47 rm /home/plom/prepare_to_meet_server.sh
50 su -lc "git clone --mirror ${old_server}:zettel.git" plom
51 cp "${config_tree_prefix}/other_files/zettel_hook_post-receive" /home/plom/zettel.git/hooks/post-receive
52 su -lc "git clone ~/zettel.git && cd zettel && redo" plom
53 su -lc "ln -s /home/plom/zettel /var/www-dump/zettel" plom
54 # NOTE: Locally, to update content, clone zettel.git, not zettel.
57 su -lc "git clone --mirror ${old_server}:blog.git" plom
58 cp "${config_tree_prefix}/other_files/blog_hook_post-receive" /home/plom/blog.git/hooks/post-receive
59 su -lc "git clone ~/blog.git" plom
60 # TODO: set up like plomlombot repo (with post-recieve hook)?
61 su -lc "git clone https://plomlompom.com/repos/clone/redo-blog" plom
62 su -lc "cd redo-blog && ./add_dir.sh ~/blog" plom
63 su -lc "cd blog && redo" plom
64 su -lc "ln -s /home/plom/blog/public /var/www-dump/blog" plom
65 # NOTE: Locally, to update content, clone blog.git, not blog.
68 # TODO: set up like plomlombot repo (with post-recieve hook)?
69 su -lc "git clone https://plomlompom.com/repos/clone/url-catcher" plom
70 su -lc "cd url-catcher && ln -s ../blog/captchas/linkable/ captchas" plom
71 cp "${config_tree_prefix}/other_files/url-catcher_customizations.json" /home/plom/url-catcher/customizations.json
72 systemctl enable url_catcher.service
73 service url_catcher start
76 cp "${config_tree_prefix}/other_files/dumpsite_index.html" /var/www-dump/index.html
79 sed -i "s/REPLACE_fqdn_ECALPER/${domain}/g" /etc/nginx/sites-available/dumpsite.nginx
80 ln -s /etc/nginx/sites-available/dumpsite.nginx /etc/nginx/sites-enabled/dumpsite.nginx