clean up openswitch group and user

(cherry picked from commit 802ccbaf9d96c438d36a6ac2f8bcb0c4ad8cf063)
This commit is contained in:
zhouwenpei 2023-08-28 15:19:52 +08:00 committed by openeuler-sync-bot
parent 44f0cb4504
commit 8f975f41d4
2 changed files with 5 additions and 34 deletions

View File

@ -13,11 +13,10 @@ Name: openvswitch
Summary: Open vSwitch daemon/database/utilities
URL: https://www.openvswitch.org/
Version: 2.17.5
Release: 4
Release: 5
License: ASL 2.0 and LGPLv2+ and SISSL
Source0: https://www.openvswitch.org/releases/%{name}-%{version}.tar.gz
Source1: openvswitch.sysusers
Patch0000: 0000-openvswitch-add-stack-protector-strong.patch
Patch0002: 0002-Remove-unsupported-permission-names.patch
@ -188,8 +187,6 @@ install -d -m 0755 $RPM_BUILD_ROOT/run/openvswitch
install -d -m 0750 $RPM_BUILD_ROOT%{_localstatedir}/log/openvswitch
install -d -m 0755 $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch
install -p -D -m 0644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysusersdir}/openvswitch.conf
install -p -D -m 0644 rhel/usr_lib_udev_rules.d_91-vfio.rules \
$RPM_BUILD_ROOT%{_udevrulesdir}/91-vfio.rules
@ -305,28 +302,7 @@ done
fi
%endif
%pre
if ! getent group openvswith > /dev/null; then
groupadd --system openvswith
fi
if ! getent passwd openvswith > /dev/null; then
useradd --system -g openvswith openvswith
fi
%post
%{_sbindir}/update-alternatives --install %{_sbindir}/ovs-vswitchd \
ovs-vswitchd %{_sbindir}/ovs-vswitchd.nodpdk 10
if [ $1 -eq 1 ]; then
sed -i 's:^#OVS_USER_ID=:OVS_USER_ID=:' /etc/sysconfig/openvswitch
sed -i \
's@OVS_USER_ID="openvswitch:openvswitch"@OVS_USER_ID="root:root"@'\
/etc/sysconfig/openvswitch
fi
chown -R openvswitch:openvswitch /etc/openvswitch
sed -i '/^\[Service\]/ a\Slice=system-ovs.slice' /usr/lib/systemd/system/ovs-vswitchd.service
%if 0%{?systemd_post:1}
%systemd_post %{name}.service
%else
@ -337,9 +313,6 @@ sed -i '/^\[Service\]/ a\Slice=system-ovs.slice' /usr/lib/systemd/system/ovs-vsw
%endif
%postun
if [ $1 -eq 0 ] ; then
%{_sbindir}/update-alternatives --remove ovs-vswitchd %{_sbindir}/ovs-vswitchd.nodpdk
fi
%if 0%{?systemd_postun:1}
%systemd_postun %{name}.service
%else
@ -409,7 +382,6 @@ fi
%endif
%files
%defattr(-,openvswitch,openvswitch)
%dir %{_sysconfdir}/openvswitch
%{_sysconfdir}/openvswitch/default.conf
%config %ghost %verify(not owner group md5 size mtime) %{_sysconfdir}/openvswitch/conf.db
@ -448,13 +420,15 @@ fi
%{_udevrulesdir}/91-vfio.rules
%doc LICENSE NOTICE README.rst NEWS rhel/README.RHEL.rst
/var/lib/openvswitch
%attr(750,openvswitch,openvswitch) %verify(not owner group) /var/log/openvswitch
/var/log/openvswitch
%ghost %attr(755,root,root) %verify(not owner group) /run/openvswitch
%{_sysconfdir}/sysconfig/network-scripts/ifup-ovs
%{_sysconfdir}/sysconfig/network-scripts/ifdown-ovs
%{_sysusersdir}/openvswitch.conf
%changelog
* Mon Aug 28 2023 zhouwenpei <zhouwenpei1@h-partners.com> - 2.17.5-5
- sync pulls/150: clean up openswitch group and user
* Thu Aug 10 2023 zhangpan <zhangpan103@h-partners.com> - 2.17.5-4
- fix build fail

View File

@ -1,3 +0,0 @@
#Type Name ID GECOS Home directory Shell
u openvswitch - "Open vSwitch Daemons" / /sbin/nologin
m openvswitch hugetlbfs