blob: 42e9645dda39336bb8e3e8629c8f2474ad359bfc (
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() {
post_upgrade
echo "==> Generating KVMD certificate ..."
kvmd-gencert
}
post_upgrade() {
echo "==> Configuring KVMD users and groups ..."
_create_user kvmd "Pi-KVM - The main daemon"
_add_user_to_group kvmd gpio
_add_user_to_group kvmd uucp
_add_user_to_group kvmd systemd-journal
_create_user kvmd-ipmi "Pi-KVM - IPMI to KVMD proxy"
_add_user_to_group kvmd-ipmi kvmd
_create_user kvmd-nginx "Pi-KVM - HTTP entrypoint"
_add_user_to_group kvmd-nginx kvmd
chown kvmd:kvmd /etc/kvmd/htpasswd
chown kvmd-ipmi:kvmd-ipmi /etc/kvmd/ipmipasswd
chmod 600 /etc/kvmd/*passwd
}
post_remove() {
_delete_user kvmd-nginx
_delete_user kvmd-ipmi
_delete_user kvmd
}
_create_user() {
id "$1" &>/dev/null || useradd -r -c "$2" -s /sbin/nologin "$1"
}
_delete_user() {
userdel "$1" &>/dev/null
}
_add_user_to_group() {
(groupmems -l -g "$2" | grep "$1" >/dev/null) || groupmems -g "$2" -a "$1"
}
|