home · contact · privacy
6bfc4d6a0a60a9e0cc6b83d85774a89a7e231c9c
[config] / all_new_2018 / setup_plomlombot.sh
1 #!/bin/sh
2 set -e
3
4 # Ensure we have a GPG target to encrypt to.
5 if [ $# -lt 1 ]; then
6     echo "Need public key ID as argument."
7     false
8 fi
9 gpg_key="$1"
10
11 config_tree_prefix="${HOME}/config/all_new_2018/"
12 irclogs_dir=/var/www/html/irclogs
13 cp "${config_tree_prefix}"/user_scripts/plomlombot_daemon.sh /home/plom/
14 chown plom:plom /home/plom/plomlombot_daemon.sh
15 apt -y install screen python3-venv gpg dirmngr
16 su plom -c "gpg --recv-key ${gpg_key}"
17 # TODO: After this, we could in theory remove dirmngr if we only installed it just now.
18 su plom -c "cd && git clone /var/public_repos/plomlombot-irc"
19 systemctl enable /etc/systemd/system/plomlombot.service
20 service plomlombot start
21 mkdir -p "${irclogs_dir}"
22 chown -R plom:plom "${irclogs_dir}"
23 echo "Don't forget to add a file ~/.plomlombot with content such as:"
24 echo "gpg_key ${gpg_key}"
25 echo "bot: SCREEN_SESSION_NAME BOT_NAME #CHANNEL_NAME IRC_SERVER_NAME"
26 echo "# file should end in newline or non-interpreted line such as this"