Message ID | 20180418145143.17364-1-aconole@redhat.com |
---|---|
State | Superseded |
Headers | show |
Series | [ovs-dev,v2] rhel: user/group openvswitch does not exist | expand |
Hi Aaron, On 18/04/18 15:51, Aaron Conole wrote: > v2: > * Removed the requires(post) lines > * Removed 'exit 0' I realize that I was the one suggested to drop 'exit 0', but right at the bottom of https://fedoraproject.org/wiki/Packaging:UsersAndGroups#Dynamic_allocation it seems that 'exit 0' may do more good than bad. Having said that, this could make it easy to miss useradd/usermod/etc failure so I am not too sure if we want to do that :)
Markos Chandras <mchandras@suse.de> writes: > Hi Aaron, > > On 18/04/18 15:51, Aaron Conole wrote: >> v2: >> * Removed the requires(post) lines >> * Removed 'exit 0' > > I realize that I was the one suggested to drop 'exit 0', but right at > the bottom of > https://fedoraproject.org/wiki/Packaging:UsersAndGroups#Dynamic_allocation > > it seems that 'exit 0' may do more good than bad. Having said that, this > could make it easy to miss useradd/usermod/etc failure so I am not too > sure if we want to do that :) I can certainly re-add it. The rationale section calls adding the 'exit 0' "...suboptimal but has less potential for system wide breakage..." I can go either way. Maybe Alan or Timothy have opinions?
On Wed, Apr 18, 2018 at 5:54 PM, Aaron Conole <aconole@redhat.com> wrote: > I can certainly re-add it. The rationale section calls adding the 'exit > 0' "...suboptimal but has less potential for system wide breakage..." > > I can go either way. Maybe Alan or Timothy have opinions? I'd stick to Fedora guideline. Alan
diff --git a/rhel/openvswitch-fedora.spec.in b/rhel/openvswitch-fedora.spec.in index 658eb206c..817e65baf 100644 --- a/rhel/openvswitch-fedora.spec.in +++ b/rhel/openvswitch-fedora.spec.in @@ -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): /usr/bin/sed %if %{with dpdk} Requires(post): /usr/sbin/usermod @@ -384,17 +383,22 @@ 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 + %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