4 if [ "$#" -ne 4 ]; then
5 echo 'Need domain name and mail and old server and repos source ("local" or "remote"?).'
8 if [ ! "$4" = "local" ] && [ ! "$4" = "remote" ]; then
9 echo "Need legal repo source name."
17 read -p"Only continue if hostname is not domain of url_catcher's target mail address, else abort!" ignore
19 # Install configs, set up firewall.
20 echo "postfix postfix/main_mailer_type string 'Internet Site'" | debconf-set-selections
21 echo "postfix postfix/mailname string $(hostname -f)" | debconf-set-selections
22 config_tree_prefix="${HOME}/config/bullseye"
23 ./install_for_target.sh web dumpsite
24 ./copy_dirtree.sh "${config_tree_prefix}/etc_files" "" web dumpsite
25 nft -f /etc/nftables.conf
27 # Set up letsencrypt certificate. TODO: Is it auto-renewed?
28 ln -sf /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
29 certbot --nginx --agree-tos --redirect --no-eff-email -m "${mail}" -d "${domain}"
30 rm /etc/nginx/sites-enabled/default
32 # Set up connection to old dump server.
33 cp "${config_tree_prefix}/setup_scripts/prepare_to_meet_server.sh" /home/plom/
34 chown plom:plom /home/plom/prepare_to_meet_server.sh
35 su -lc "./prepare_to_meet_server.sh ${old_server}" plom
36 read -p'Hit Enter when you are done.' ignore
37 rm /home/plom/prepare_to_meet_server.sh
41 chown plom:plom /var/www-dump
44 su -lc "ln -s /home/plom/${dump_dir} /var/www-dump/${dump_dir}" plom
45 su -lc "ln -s /home/plom/${geheim_dir} /var/www-dump/${geheim_dir}" plom
46 cp "${config_tree_prefix}/setup_scripts/mirror_dir.sh" /home/plom/
47 su -lc "./mirror_dir.sh ${old_server} /home/plom/${dump_dir}" plom
48 su -lc "./mirror_dir.sh ${old_server} /home/plom/${geheim_dir}" plom
49 su -lc "scp plom@${old_server}:/var/www-dump/password_geheim ~" plom
50 mv /home/plom/password_geheim /var/www-dump/password_geheim
51 rm /home/plom/mirror_dir.sh
54 wget http://news.dieweltistgarnichtso.net/bin/archives/redo-sh.tar.gz
55 tar -moxzf redo-sh.tar.gz -C /usr/local
58 su -lc "git clone --mirror ${old_server}:zettel.git" plom
59 cp "${config_tree_prefix}/other_files/zettel_hook_post-receive" /home/plom/zettel.git/hooks/post-receive
60 su -lc "git clone ~/zettel.git && cd zettel && redo" plom
61 su -lc "ln -s /home/plom/zettel /var/www-dump/zettel" plom
62 # NOTE: Locally, to update content, clone zettel.git, not zettel.
65 su -lc "git clone --mirror ${old_server}:blog.git" plom
66 cp "${config_tree_prefix}/other_files/blog_hook_post-receive" /home/plom/blog.git/hooks/post-receive
67 su -lc "git clone ~/blog.git" plom
68 # TODO: set up like plomlombot repo (with post-recieve hook)?
69 if [ "$repos_source" = "local"]; then
70 su -lc "git clone /var/repos/redo-blog" plom
72 su -lc "git clone https://plomlompom.com/repos/clone/redo-blog" plom
74 su -lc "cd redo-blog && ./add_dir.sh ~/blog" plom
75 su -lc "cd blog && redo" plom
76 su -lc "ln -s /home/plom/blog/public /var/www-dump/blog" plom
77 # NOTE: Locally, to update content, clone blog.git, not blog.
80 # TODO: set up like plomlombot repo (with post-recieve hook)?
81 if [ "$repos_source" = "local"]; then
82 su -lc "git clone /var/repos/url-catcher" plom
84 su -lc "git clone https://plomlompom.com/repos/clone/url-catcher" plom
86 su -lc "cd url-catcher && ln -s ../blog/captchas/linkable/ captchas" plom
87 cp "${config_tree_prefix}/other_files/url-catcher_customizations.json" /home/plom/url-catcher/customizations.json
88 systemctl enable url_catcher.service
89 service url_catcher start
90 cp "${config_tree_prefix}/setup_scripts/mirror_dir.sh" /home/plom/
91 su -lc "./mirror_dir.sh ${old_server} /home/plom/url-catcher/ips" plom
92 su -lc "./mirror_dir.sh ${old_server} /home/plom/url-catcher/lists" plom
93 rm /home/plom/mirror_dir.sh
96 cp "${config_tree_prefix}/other_files/dumpsite_index.html" /var/www-dump/index.html
99 sed -i "s/REPLACE_fqdn_ECALPER/${domain}/g" /etc/nginx/sites-available/dumpsite.nginx
100 ln -s /etc/nginx/sites-available/dumpsite.nginx /etc/nginx/sites-enabled/dumpsite.nginx
102 service nginx restart