diff options
author | Devaev Maxim <[email protected]> | 2019-07-19 04:10:30 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2019-07-19 04:10:30 +0300 |
commit | efbedb222df3b213d8e3106ee211830602ce5720 (patch) | |
tree | b1e67cef60ac7b46e8c6507671dff31bb2045357 /kvmd.install | |
parent | ad83678eb3f735806f87ad9a43c32bdd6ffb92aa (diff) |
using sysusers.d
Diffstat (limited to 'kvmd.install')
-rw-r--r-- | kvmd.install | 32 |
1 files changed, 2 insertions, 30 deletions
diff --git a/kvmd.install b/kvmd.install index 42e9645d..2c4bc7e8 100644 --- a/kvmd.install +++ b/kvmd.install @@ -6,38 +6,10 @@ post_install() { } 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 + echo "==> Ensuring KVMD users and groups ..." + systemd-sysusers /usr/lib/sysusers.d/kvmd.conf 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" -} |