From 223e417ff163f26d60f039ab118fbe2a5b4a69c2 Mon Sep 17 00:00:00 2001 From: xu_lei_123 Date: Mon, 20 Mar 2023 23:30:37 +0800 Subject: [PATCH] =?UTF-8?q?enhance=20some=20behavior:=201=E3=80=81add=20co?= =?UTF-8?q?ntrol=20group=20system-ovs.slice=202=E3=80=81OVS=5FUSER=5FID=20?= =?UTF-8?q?change=20to=20root:root=202=E3=80=81OVS=5FUSER=5FID=20change=20?= =?UTF-8?q?to=20root:root?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- openvswitch.spec | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/openvswitch.spec b/openvswitch.spec index 0716dac..b6e0e07 100644 --- a/openvswitch.spec +++ b/openvswitch.spec @@ -1,4 +1,4 @@ -%bcond_with dpdk +%bcond_without dpdk %ifarch x86_64 %bcond_without check @@ -13,7 +13,7 @@ Name: openvswitch Summary: Open vSwitch daemon/database/utilities URL: https://www.openvswitch.org/ Version: 2.17.5 -Release: 1 +Release: 2 License: ASL 2.0 and LGPLv2+ and SISSL Source0: https://www.openvswitch.org/releases/%{name}-%{version}.tar.gz @@ -48,9 +48,6 @@ BuildRequires: dpdk-devel libpcap-devel numactl-devel Requires: openssl iproute module-init-tools -%{?systemd_requires} -%{?sysusers_requires_compat} - Requires(post): /bin/sed Requires(post): %{_sbindir}/update-alternatives Requires(postun): %{_sbindir}/update-alternatives @@ -307,6 +304,13 @@ done %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 \ @@ -315,10 +319,11 @@ 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="openvswitch:hugetlbfs"@'\ + '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 @@ -448,6 +453,12 @@ fi %{_sysusersdir}/openvswitch.conf %changelog +* Mon Mar 20 2023 xulei - 2.17.5-2 +- enhance some behavior: + 1、add control group system-ovs.slice + 2、OVS_USER_ID change to root:root + 3、add user group openvswith and user openvswith + * Tue Jan 03 2023 wanglimin - 2.17.5-1 - upgrade to 2.17.5-1 -- Gitee