blob: 1b45c70b7d0cc26f7c45ff809447ae23f6adfd92 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
import pathlib
import textwrap
def setup_soju():
home = pathlib.Path.home()
config = home / ".config" / "containers" / "systemd"
config.mkdir(parents=True, exist_ok=True)
(config / "soju.container").write_text(textwrap.dedent("""
[Unit]
Description=IRC Bouncer
[Container]
Image=quay.io/alexpdp7/workstation:latest
Volume=/home/alex/.config/containers/systemd/soju_config:/etc/soju/config
Volume=/home/alex/.local/lib/soju:/var/lib/soju/
SecurityLabelDisable=true
Network=host
Exec=soju
[Service]
# Extend Timeout to allow time to pull the image
TimeoutStartSec=900
[Install]
# Start by default on boot
WantedBy=multi-user.target default.target
""").lstrip())
(config / "soju_config").write_text(textwrap.dedent("""
db sqlite3 /var/lib/soju/main.db
message-store fs /var/lib/soju/logs/
listen irc+insecure://0.0.0.0:6667
""").lstrip())
(home / ".local" / "lib" / "soju").mkdir(parents=True, exist_ok=True)
sojudb_wrapper = (home / ".local" / "bin" / "sojudb")
sojudb_wrapper.write_text(textwrap.dedent("""
#!/bin/sh
podman run -it --rm --security-opt label=disable -v ~/.config/containers/systemd/soju_config:/etc/soju/config -v ~/.local/lib/soju/:/var/lib/soju quay.io/alexpdp7/workstation:latest sojudb "$@"
""").lstrip())
sojudb_wrapper.chmod(0o755)
|