summarylogtreecommitdiffstats
path: root/hawck-git.install
blob: dd160b3440ffd0695af7a90ca4226852ac964854 (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
post_install() {
    useradd hawck-input
    usermod -aG input hawck-input
    usermod --home "/var/lib/hawck-input" hawck-input
    groupadd hawck-input-share
    usermod -aG hawck-input-share hawck-input
    groupadd uinput
    usermod -aG uinput hawck-input
    chsh -s /bin/nologin hawck-input

    ## Set up hawck-input home directory
    mkdir -p "/var/lib/hawck-input/keys"
    mkdir -p "/var/lib/hawck-input/tmp"
    chmod 770 "/var/lib/hawck-input/tmp"
    chown hawck-input:hawck-input-share "/var/lib/hawck-input/tmp"

    chown hawck-input:hawck-input-share "/var/lib/hawck-input"
    chmod 770 /var/lib/hawck-input

    ## Make sure the keys are locked down with correct permissions.
    chown hawck-input:hawck-input-share "/var/lib/hawck-input/keys"
    chmod 750 /var/lib/hawck-input/keys

    ## Make sure that hawck-input can create virtual input devices.
    ## After a reboot this will be done by the 99-hawck-input.rules file.
    chown root:uinput /dev/uinput
    chmod 660 /dev/uinput

    echo "Installed, now run /usr/share/hawck/bin/hawck-user-setup"
}

pre_remove() {
    echo "Stopping running instances ..."
    systemctl disable --now hawck-inputd
    killall hawck-macrod
}

post_remove() {
    userdel hawck-input
    groupdel hawck-input-share
    chmod 600 /dev/uinput
}