aboutsummaryrefslogtreecommitdiff
path: root/scripts/p7s/bitlbee.py
blob: 4f0acbd49a976cc089c8f022ed80f0ab7814926a (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
import pathlib
import textwrap


def setup_bitlbee():
    home = pathlib.Path.home()
    config = home / ".config" / "containers" / "systemd"
    config.mkdir(parents=True, exist_ok=True)
    (config / "bitlbee.container").write_text(textwrap.dedent("""
        [Unit]
        Description=IM-IRC bridge

        [Container]
        Image=quay.io/alexpdp7/workstation:latest
        Volume=/home/alex/.local/lib/bitlbee:/var/lib/bitlbee/
        # running this on an LXC container, which borks SecurityLabelDisable
        #SecurityLabelDisable=true
        PublishPort=6668:6667

        Exec=bitlbee -Fnv

        [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())

    (home / ".local" / "lib" / "bitlbee").mkdir(parents=True, exist_ok=True)