[Pkg-libvirt-commits] [libvirt] 03/09: Bug#844339: [PATCH v3 3/4] libvirt-daemon-system.postinst: use allocated uid/gid if possible
Guido Guenther
agx at moszumanska.debian.org
Thu Dec 22 14:07:45 UTC 2016
This is an automated email from the git hooks/post-receive script.
agx pushed a commit to annotated tag debian/2.5.0-2
in repository libvirt.
commit f4b33d072bfac8d2a905559ef58704758f6cd9c0
Author: Mauricio Faria de Oliveira <mauricfo at linux.vnet.ibm.com>
Date: Fri Nov 18 15:07:09 2016 -0200
Bug#844339: [PATCH v3 3/4] libvirt-daemon-system.postinst: use allocated uid/gid if possible
Use the allocated uid/gid for libvirt-qemu
when creating the user/group, if not taken.
In case it's taken, the user has been asked
to continue or abort the installation, thus
if we are here, it is OK to proceed and not
use the allocated uid/gid.
Signed-off-by: Mauricio Faria de Oliveira <mauricfo at linux.vnet.ibm.com>
Signed-off-by: Guido Günther <agx at sigxcpu.org>
---
debian/libvirt-daemon-system.postinst | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/debian/libvirt-daemon-system.postinst b/debian/libvirt-daemon-system.postinst
index f36b806..3730783 100644
--- a/debian/libvirt-daemon-system.postinst
+++ b/debian/libvirt-daemon-system.postinst
@@ -20,6 +20,10 @@ set -e
# Source debconf library.
. /usr/share/debconf/confmodule
+# Allocated UID and GID for libvirt-qemu
+LIBVIRT_QEMU_UID=64055
+LIBVIRT_QEMU_GID=64055
+
add_users_groups()
{
if ! getent group libvirt >/dev/null; then
@@ -31,6 +35,13 @@ add_users_groups()
fi
# user and group libvirt runs qemu/kvm instances with
if ! getent passwd libvirt-qemu >/dev/null; then
+
+ # set uid if available (expected); don't fail otherwise.
+ PARAMETER_UID=''
+ if ! getent passwd $LIBVIRT_QEMU_UID >/dev/null; then
+ PARAMETER_UID="--uid $LIBVIRT_QEMU_UID"
+ fi
+
adduser --quiet \
--system \
--ingroup kvm \
@@ -40,10 +51,18 @@ add_users_groups()
--home /var/lib/libvirt \
--no-create-home \
--gecos "Libvirt Qemu" \
+ $PARAMETER_UID \
libvirt-qemu
fi
if ! getent group libvirt-qemu >/dev/null; then
- addgroup --quiet --system libvirt-qemu
+
+ # set gid if available (expected); don't fail otherwise.
+ PARAMETER_GID=''
+ if ! getent group $LIBVIRT_QEMU_GID >/dev/null; then
+ PARAMETER_GID="--gid $LIBVIRT_QEMU_GID"
+ fi
+
+ addgroup --quiet --system $PARAMETER_GID libvirt-qemu
adduser --quiet libvirt-qemu libvirt-qemu
fi
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libvirt.git
More information about the Pkg-libvirt-commits
mailing list