summarylogtreecommitdiffstats
path: root/ditana-koboldcpp.install
blob: f34a3be2f5a0dac67548b2264eb0540fc577a1f5 (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
pre_install() {
    if ! getent group koboldcpp >/dev/null; then
        groupadd -r koboldcpp
    fi
    if ! getent passwd koboldcpp >/dev/null; then
        useradd -r -g koboldcpp -d /usr/share/koboldcpp -s /usr/bin/nologin koboldcpp
    fi
}

post_install() {
    chown -R koboldcpp:koboldcpp /usr/share/koboldcpp

    systemctl daemon-reload
    systemctl enable koboldcpp.service

    if [ -d /run/systemd/system ]; then
        systemctl start koboldcpp.service
    fi
}

post_upgrade() {
    chown -R koboldcpp:koboldcpp /usr/share/koboldcpp

    if [ -d /run/systemd/system ]; then
        systemctl daemon-reload
        systemctl restart koboldcpp.service
    fi
}

pre_remove() {
    systemctl stop koboldcpp.service
    systemctl disable koboldcpp.service
}

post_remove() {
    userdel koboldcpp
    groupdel koboldcpp
}