From efbedb222df3b213d8e3106ee211830602ce5720 Mon Sep 17 00:00:00 2001 From: Devaev Maxim Date: Fri, 19 Jul 2019 04:10:30 +0300 Subject: using sysusers.d --- kvmd.install | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) (limited to 'kvmd.install') 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" -} -- cgit v1.2.3