home · contact · privacy
Add Bullseye play server setup basics.
[config] / bullseye / setup_scripts / setup_play.sh
1 #!/bin/sh
2 set -e
3 set -x
4
5 if [ "$#" -lt 1 ]; then
6   echo "Need public key ID and optionally old server IP."
7   false
8 fi
9 gpg_key="$1"
10 old_server="$2"
11
12 config_tree_prefix="${HOME}/config/bullseye"
13 ./install_for_target.sh play
14 ./copy_dirtree.sh "${config_tree_prefix}/etc_files" "" play
15 cp "${config_tree_prefix}/other_files/weechatrc" /home/plom/.weechatrc
16 cp "${config_tree_prefix}/other_files/weechat-wrapper.sh" /home/plom/
17 cp "${config_tree_prefix}/other_files/weechatlogs_encrypter.sh" /home/plom/
18 chown plom:plom /home/plom/*weechat*
19 chown plom:plom /home/plom/.weechatrc
20 echo "${gpg_key}" > /home/plom/.encrypt_target
21 chown plom:plom /home/plom/.encrypt_target
22
23 # TODO refactor with setup_website.sh
24 # Add encryption key.
25 keyservers='sks-keyservers.net/ keys.gnupg.net'
26 set +e
27 while true; do
28     do_break=0
29     for keyserver in $(echo "${keyservers}"); do
30         su plom -c "gpg --no-tty --keyserver $keyserver --recv-key ${gpg_key}"
31         if [ $? -eq "0" ]; then
32             do_break=1
33             break
34         fi
35         echo "Attempt with keyserver ${keyserver} unsuccessful, trying other."
36     done
37     if [ "${do_break}" -eq "1" ]; then
38         break
39     fi
40 done
41 set -e
42
43 if [ "${old_server}" != "" ]; then
44   cp "${config_tree_prefix}/setup_scripts/prepare_to_meet_server.sh" /home/plom/
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
48   su -lc "scp plom@${old_server}:.ssh/authorized_keys .ssh/authorized_keys" plom
49   su -lc "scp plom@${old_server}:.weechatrc ~" plom
50   cp "${config_tree_prefix}/setup_scripts/mirror_dir.sh" /home/plom/
51   su -lc "./mirror_dir.sh ${old_server} /home/plom/weechatlogs" plom
52   rm /home/plom/mirror_dir.sh
53 fi
54
55 systemctl enable --now encrypt_chatlogs.timer