summarylogtreecommitdiffstats
path: root/technitium-dns-server.install
blob: 7921cfe3c10775762c72db0f37bd45ff586cf81b (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
## arg 1:  the new package version
#pre_install() {
    case `ps --no-headers -o comm 1` in
        dinit)
            echo "::: Detected `dinit`; stopping dinit service"
            dinitctl stop technitium-dns-server
            # dinitctl unload technitium-dns-server
        ;;
        init)
            echo "::: Detected `init`; stopping systemd service files"
        ;;
        systemd)
            echo "::: Detected `systemd`; stopping systemd service files"
        ;;
        *)
            echo "::: Unknown init system"
        ;;
    esac
#}

## arg 1:  the new package version
post_install() {
    case `ps --no-headers -o comm 1` in
        dinit)
            echo "::: Detected `dinit` Installing dinit service file"
            echo "::: Installing dinit service description file"
            ln -s /opt/technitium-dns-server/service/technitium-dns-server.dinit /etc/dinit.d/technitium-dns-server
            echo "::: Reloading dinit service description file"
            dinitctl reload technitium-dns-server
            echo "::: Starting dinit service description file"
            dinitctl start technitium-dns-server
        ;;
        init)
            echo "::: Detected `init` Installing systemd service files"
        ;;
        systemd)
            echo "::: Detected `systemd` Installing systemd service files"
            ln -s /opt/technitium-dns-server/service/technitium-dns-server.service /usr/lib/systemd/system/technitium-dns-server.service
            ln -s /opt/technitium-dns-server/service/technitium-dns-server.sysuser /usr/lib/sysusers.d/technitium-dns-server.conf
        ;;
        *)
            echo "::: Unknown init system"
        ;;
    esac
}

#pre_upgrade() {
    case `ps --no-headers -o comm 1` in
        dinit)
            echo "::: Detected `dinit`; stopping dinit service"
            dinitctl stop technitium-dns-server
            # dinitctl unload technitium-dns-server
        ;;
        init)
            echo "::: Detected `init`; stopping systemd service files"
        ;;
        systemd)
            echo "::: Detected `systemd`; stopping systemd service files"
        ;;
        *)
            echo "::: Unknown init system"
        ;;
    esac
#}

post_upgrade() {
    case `ps --no-headers -o comm 1` in
        dinit)
            echo "::: Detected `dinit` Installing dinit service file"
            echo "::: Installing dinit service description file"
            ln -s /opt/technitium-dns-server/service/technitium-dns-server.dinit /etc/dinit.d/technitium-dns-server
            echo "::: Reloading dinit service description file"
            dinitctl reload technitium-dns-server
            echo "::: Starting dinit service description file"
            dinitctl start technitium-dns-server
        ;;
        init)
            echo "::: Detected `init` Installing systemd service files"
        ;;
        systemd)
            echo "::: Detected `systemd` Installing systemd service files"
            ln -s /opt/technitium-dns-server/service/technitium-dns-server.service /usr/lib/systemd/system/technitium-dns-server.service
            ln -s /opt/technitium-dns-server/service/technitium-dns-server.sysuser /usr/lib/sysusers.d/technitium-dns-server.conf
        ;;
        *)
            echo "::: Unknown init system"
        ;;
    esac
}