summarylogtreecommitdiffstats
path: root/scionlab.install
blob: d950ef5c9b3153ab0e445f9381a8e52bf503d794 (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
46
47
48
49
50
51
52
53
54
post_install() {
    id scion >/dev/null 2>&1 || useradd --no-create-home --system scion
    getent group scion >/dev/null 2>&1 || groupadd scion >/dev/null 2>&1
    usermod -g scion scion >/dev/null 2>&1

    
    # Same for gen-cache folder
    mkdir -p /var/lib/scion/
    chown -R scion:scion /var/lib/scion/

    # Same for gen folder
    mkdir -p /etc/scion/
    chown -R scion:scion /etc/scion/

    systemctl daemon-reload
    
    echo "In order for SCIONLab to work, it still needs a configuration:"
    echo "- Follow https://docs.scionlab.org/content/config/create_as.html"
    echo "- To install your config, run"
    echo "   $ sudo scionlab-config --host-id=<host_id> --host-secret=<secret>"
    echo "      (fill in <host_id> and <secret> with the correct data)"
    echo "- Consider starting scionlab at boot-time"
    echo "   $ sudo systemctl enable scionlab"
    echo "If you have trouble, consult"
    echo "https://docs.scionlab.org/content/install/pkg.html#configuration"
    echo 
    echo "Note that a custom openvpn systemd service has been installed."
    echo "Usage:"
    echo "   $ sudo systemctl restart scionlab-openvpn@client-scionlab-<attachment point ISD-AS>"
    echo "  (scionlab-config has been patched to use this service automatically)"
}

pre_upgrade() {
    # is this sufficient? what about the other daemons?
    systemctl stop scionlab.target
}

post_upgrade() {
    systemctl daemon-reload
}

pre_remove() {
    systemctl stop scionlab.target
    getent group scion >/dev/null 2>&1 && groupdel scion >/dev/null 2>&1
    id scion >/dev/null 2>&1 && userdel scion
    rmdir -v /var/lib/scion
    rmdir -v /etc/scion
    rm -vf /dev/shm/sciond
    rm -vf /dev/shm/dispatcher
}

post_remove() {
    systemctl daemon-reload
}