From 4911dbda678388dc0dd1b88673f994a9682519cbeac037074cf5c07624dd8d8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ismail=20D=C3=B6nmez?= Date: Fri, 4 May 2018 12:45:44 +0000 Subject: [PATCH] Accepting request 603963 from home:markoschandras:network - Move openvswitch user/group creation to %pre scriptlet. The default ownership of the configuration files expects the user and group to be available as early as possible (bsc#1091408) - spec-cleaner fixes. OBS-URL: https://build.opensuse.org/request/show/603963 OBS-URL: https://build.opensuse.org/package/show/network/openvswitch?expand=0&rev=147 --- openvswitch.changes | 8 ++++ openvswitch.spec | 99 ++++++++++++++++++++++++--------------------- 2 files changed, 60 insertions(+), 47 deletions(-) diff --git a/openvswitch.changes b/openvswitch.changes index 124612b..4c9b380 100644 --- a/openvswitch.changes +++ b/openvswitch.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Wed May 2 07:58:27 UTC 2018 - mchandras@suse.de + +- Move openvswitch user/group creation to %pre scriptlet. The default + ownership of the configuration files expects the user and group to + be available as early as possible (bsc#1091408) +- spec-cleaner fixes. + ------------------------------------------------------------------- Mon Apr 23 09:33:02 UTC 2018 - mchandras@suse.de diff --git a/openvswitch.spec b/openvswitch.spec index 1d83c69..fcd3f77 100644 --- a/openvswitch.spec +++ b/openvswitch.spec @@ -44,7 +44,7 @@ Summary: A multilayer virtual network switch # - utilities/bugtool which is LGPL-2.1 License: Apache-2.0 AND LGPL-2.1-only AND SISSL Group: Productivity/Networking/System -Url: http://openvswitch.org/ +URL: http://openvswitch.org/ Source0: http://openvswitch.org/releases/openvswitch-%{version}.tar.gz Source1: preamble Source89: Module.supported.updates @@ -68,6 +68,7 @@ Requires: modutils # ovs-ctl / ovs-pki use /usr/bin/uuidgen: Requires: util-linux Requires(post): %fillup_prereq +Requires(pre): shadow Suggests: logrotate Provides: openvswitch-common = %{version} Obsoletes: openvswitch-common < 2.7.0 @@ -82,9 +83,6 @@ Obsoletes: %{name}-dpdk < 2.7.0 Obsoletes: %{name}-dpdk-switch < 2.7.0 Obsoletes: %{name}-switch < 2.7.0 %{?systemd_requires} -%if %{with dpdk} -Requires(post): shadow -%endif # Needed by the testsuite %if %{with check} BuildRequires: procps @@ -474,14 +472,9 @@ find %{buildroot} -type f -name "*.la" -delete -print %{fillup_only -n openvswitch} if [ $1 -eq 1 ]; then - getent passwd openvswitch >/dev/null || \ - useradd -r -d / -s /sbin/nologin -U -c "Open vSwitch Daemons" openvswitch sed -i 's:^#OVS_USER_ID=:OVS_USER_ID=:' %{_sysconfdir}/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"@'\ %{_sysconfdir}/sysconfig/openvswitch @@ -498,8 +491,8 @@ fi # Save the "enabled" state across the transition of ownership # of openvswitch.service from openvswitch-switch to # openvswitch. -if test -f %eflag; then - rm -f %eflag +if test -f %{eflag}; then + rm -f %{eflag} systemctl enable openvswitch.service fi @@ -526,10 +519,22 @@ export DISABLE_RESTART_ON_UPDATE=yes # openvswitch. if [ "$FIRST_ARG" -ge 1 ]; then \ if [ x$(systemctl is-enabled openvswitch.service 2>/dev/null ||:) = "xenabled" ]; then - touch %eflag + touch %{eflag} fi fi +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 + %preun # This prevents networking breakages on package removals export DISABLE_STOP_ON_REMOVAL=yes @@ -596,7 +601,7 @@ export DISABLE_RESTART_ON_UPDATE=yes %files %defattr(-,openvswitch,openvswitch) %dir %{_sysconfdir}/openvswitch -%{_sysconfdir}/openvswitch/default.conf +%config %{_sysconfdir}/openvswitch/default.conf %config %ghost %{_sysconfdir}/openvswitch/conf.db %ghost %{_sysconfdir}/openvswitch/.conf.db.~lock~ %config %ghost %{_sysconfdir}/openvswitch/system-id.conf @@ -623,21 +628,21 @@ export DISABLE_RESTART_ON_UPDATE=yes %{_datadir}/openvswitch/scripts/ovs-lib %{_datadir}/openvswitch/scripts/ovs-save %{_datadir}/openvswitch/vswitch.ovsschema -%{_mandir}/man1/ovsdb-client.1%{ext_man} -%{_mandir}/man1/ovsdb-server.1%{ext_man} -%{_mandir}/man1/ovsdb-tool.1%{ext_man} -%{_mandir}/man5/ovs-vswitchd.conf.db.5%{ext_man} -%{_mandir}/man7/ovs-fields.7%{ext_man} -%{_mandir}/man8/ovs-appctl.8%{ext_man} -%{_mandir}/man8/ovs-bugtool.8%{ext_man} -%{_mandir}/man8/ovs-ctl.8%{ext_man} -%{_mandir}/man8/ovs-dpctl-top.8%{ext_man} -%{_mandir}/man8/ovs-dpctl.8%{ext_man} -%{_mandir}/man8/ovs-ofctl.8%{ext_man} -%{_mandir}/man8/ovs-vlan-bug-workaround.8%{ext_man} -%{_mandir}/man8/ovs-parse-backtrace.8%{ext_man} -%{_mandir}/man8/ovs-vsctl.8%{ext_man} -%{_mandir}/man8/ovs-vswitchd.8%{ext_man} +%{_mandir}/man1/ovsdb-client.1%{?ext_man} +%{_mandir}/man1/ovsdb-server.1%{?ext_man} +%{_mandir}/man1/ovsdb-tool.1%{?ext_man} +%{_mandir}/man5/ovs-vswitchd.conf.db.5%{?ext_man} +%{_mandir}/man7/ovs-fields.7%{?ext_man} +%{_mandir}/man8/ovs-appctl.8%{?ext_man} +%{_mandir}/man8/ovs-bugtool.8%{?ext_man} +%{_mandir}/man8/ovs-ctl.8%{?ext_man} +%{_mandir}/man8/ovs-dpctl-top.8%{?ext_man} +%{_mandir}/man8/ovs-dpctl.8%{?ext_man} +%{_mandir}/man8/ovs-ofctl.8%{?ext_man} +%{_mandir}/man8/ovs-vlan-bug-workaround.8%{?ext_man} +%{_mandir}/man8/ovs-parse-backtrace.8%{?ext_man} +%{_mandir}/man8/ovs-vsctl.8%{?ext_man} +%{_mandir}/man8/ovs-vswitchd.8%{?ext_man} %{_sysconfdir}/bash_completion.d/ovs-appctl-bashcomp.bash %{_sysconfdir}/bash_completion.d/ovs-vsctl-bashcomp.bash %config(noreplace) %{_sysconfdir}/logrotate.d/openvswitch @@ -672,13 +677,13 @@ export DISABLE_RESTART_ON_UPDATE=yes %{_libdir}/libvtep-2*.so.* %files pki -%{_mandir}/man8/ovs-pki.8%{ext_man} +%{_mandir}/man8/ovs-pki.8%{?ext_man} %{_bindir}/ovs-pki %files vtep %{_bindir}/vtep-ctl -%{_mandir}/man5/vtep.5%{ext_man} -%{_mandir}/man8/vtep-ctl.8%{ext_man} +%{_mandir}/man5/vtep.5%{?ext_man} +%{_mandir}/man8/vtep-ctl.8%{?ext_man} %{_datadir}/openvswitch/scripts/ovs-vtep %{_datadir}/openvswitch/vtep.ovsschema @@ -708,20 +713,20 @@ export DISABLE_RESTART_ON_UPDATE=yes %{_datadir}/openvswitch/scripts/ovn-bugtool-nbctl-show %{_datadir}/openvswitch/scripts/ovn-bugtool-sbctl-lflow-list %{_datadir}/openvswitch/scripts/ovn-bugtool-sbctl-show -%{_mandir}/man5/ovn-nb.5%{ext_man} -%{_mandir}/man5/ovn-sb.5%{ext_man} -%{_mandir}/man1/ovn-detrace.1* -%{_mandir}/man7/ovn-architecture.7%{ext_man} -%{_mandir}/man8/ovn-ctl.8%{ext_man} -%{_mandir}/man8/ovn-nbctl.8%{ext_man} -%{_mandir}/man8/ovn-trace.8%{ext_man} -%{_mandir}/man8/ovn-sbctl.8%{ext_man} +%{_mandir}/man5/ovn-nb.5%{?ext_man} +%{_mandir}/man5/ovn-sb.5%{?ext_man} +%{_mandir}/man1/ovn-detrace.1%{?ext_man} +%{_mandir}/man7/ovn-architecture.7%{?ext_man} +%{_mandir}/man8/ovn-ctl.8%{?ext_man} +%{_mandir}/man8/ovn-nbctl.8%{?ext_man} +%{_mandir}/man8/ovn-trace.8%{?ext_man} +%{_mandir}/man8/ovn-sbctl.8%{?ext_man} %files ovn-central %dir %{_libexecdir}/firewalld %dir %{_libexecdir}/firewalld/services %{_bindir}/ovn-northd -%{_mandir}/man8/ovn-northd.8%{ext_man} +%{_mandir}/man8/ovn-northd.8%{?ext_man} %{_datadir}/openvswitch/ovn-nb.ovsschema %{_datadir}/openvswitch/ovn-sb.ovsschema %{_unitdir}/ovn-northd.service @@ -732,14 +737,14 @@ export DISABLE_RESTART_ON_UPDATE=yes %dir %{_libexecdir}/firewalld %dir %{_libexecdir}/firewalld/services %{_bindir}/ovn-controller -%{_mandir}/man8/ovn-controller.8%{ext_man} +%{_mandir}/man8/ovn-controller.8%{?ext_man} %{_unitdir}/ovn-controller.service %{_sbindir}/rcovn-controller %{_prefix}/lib/firewalld/services/ovn-host-firewall-service.xml %files ovn-vtep %{_bindir}/ovn-controller-vtep -%{_mandir}/man8/ovn-controller-vtep.8%{ext_man} +%{_mandir}/man8/ovn-controller-vtep.8%{?ext_man} %{_unitdir}/ovn-controller-vtep.service %{_sbindir}/rcovn-controller-vtep @@ -751,11 +756,11 @@ export DISABLE_RESTART_ON_UPDATE=yes %{_bindir}/ovs-tcpdump %{_bindir}/ovs-tcpundump %{_bindir}/ovs-vlan-test -%{_mandir}/man1/ovs-pcap.1%{ext_man} -%{_mandir}/man1/ovs-tcpundump.1%{ext_man} -%{_mandir}/man8/ovs-l3ping.8%{ext_man} -%{_mandir}/man8/ovs-tcpdump.8%{ext_man} -%{_mandir}/man8/ovs-testcontroller.8%{ext_man} +%{_mandir}/man1/ovs-pcap.1%{?ext_man} +%{_mandir}/man1/ovs-tcpundump.1%{?ext_man} +%{_mandir}/man8/ovs-l3ping.8%{?ext_man} +%{_mandir}/man8/ovs-tcpdump.8%{?ext_man} +%{_mandir}/man8/ovs-testcontroller.8%{?ext_man} %files devel %{_libdir}/libofproto.so