]> git.proxmox.com Git - mirror_ovs.git/blobdiff - rhel/openvswitch-fedora.spec.in
rhel: user/group openvswitch does not exist
[mirror_ovs.git] / rhel / openvswitch-fedora.spec.in
index d9b9f5874f41d17448d804aa6fa07833d3ad1ef5..3e5cf21e0a5a9e6bf26732148cf06b1ca7b8ca42 100644 (file)
@@ -92,8 +92,7 @@ Requires: openssl hostname iproute module-init-tools
 #Upstream kernel commit 4f647e0a3c37b8d5086214128614a136064110c3
 #Requires: kernel >= 3.15.0-0
 
-Requires(post): /usr/bin/getent
-Requires(post): /usr/sbin/useradd
+Requires(pre): shadow-utils
 Requires(post): /bin/sed
 %if %{with dpdk}
 Requires(post): /usr/sbin/usermod
@@ -384,17 +383,23 @@ rm -rf $RPM_BUILD_ROOT
     fi
 %endif
 
+%pre
+getent group openvswitch >/dev/null || groupadd -r openvswitch
+getent passwd openvswitch >/dev/null || \
+    useradd -r -g openvswitch -d / -s /sbin/nologin \
+    -c "Open vSwitch Daemons" openvswitch
+
+%if %{with dpdk}
+    getent group hugetlbfs >/dev/null || groupadd hugetlbfs
+    usermod -a -G hugetlbfs openvswitch
+%endif
+exit 0
+
 %post
 if [ $1 -eq 1 ]; then
-    getent passwd openvswitch >/dev/null || \
-        useradd -r -d / -s /sbin/nologin -c "Open vSwitch Daemons" openvswitch
-
     sed -i 's:^#OVS_USER_ID=:OVS_USER_ID=:' /etc/sysconfig/openvswitch
 
 %if %{with dpdk}
-    getent group hugetlbfs >/dev/null || \
-        groupadd hugetlbfs
-    usermod -a -G hugetlbfs openvswitch
     sed -i \
         's@OVS_USER_ID="openvswitch:openvswitch"@OVS_USER_ID="openvswitch:hugetlbfs"@'\
         /etc/sysconfig/openvswitch