summarylogtreecommitdiffstats
path: root/telemt-bin.install
blob: 4522e44358cef0c091532f692a4d25b09f4434e7 (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
post_install() {
    if command -v systemctl >/dev/null 2>&1; then
        systemctl daemon-reload >/dev/null 2>&1 || true
    fi

    echo ":: Copy /etc/telemt/telemt.toml.sample to /etc/telemt/telemt.toml before starting telemt.service"
    echo ":: Generate a secret with: openssl rand -hex 16"
    echo ":: Then enable the service with: systemctl enable --now telemt.service"
}

post_upgrade() {
    if command -v systemctl >/dev/null 2>&1; then
        systemctl daemon-reload >/dev/null 2>&1 || true

        if systemctl is-active --quiet telemt.service; then
            systemctl restart telemt.service
        fi
    fi
}

pre_remove() {
    if command -v systemctl >/dev/null 2>&1; then
        if systemctl is-active --quiet telemt.service; then
            systemctl stop telemt.service
        fi

        if systemctl is-enabled --quiet telemt.service 2>/dev/null; then
            systemctl disable telemt.service
        fi
    fi
}