Skip to content

Commit

Permalink
fedora: Ability to auto enable openvswitch service.
Browse files Browse the repository at this point in the history
We currently have rhel/openvswitch.spec.in that automatically
enables openvswitch service when the package is installed using
chkconfig.

But fedora rpm may not enable openvswitch service automatically.
The macro currently being used in fedora rpm (systemd_post) will
look for preset files in /etc/systemd/system-preset/ to figure
out whether openvswitch service needs to be automatically enabled.
But, the fedora package does not provide such a file. The argument
is that people may want to install the package for binaries and
not necessarily to run OVS.

If someone now wants to install the fedora package and automatically
enable openvswitch, he will have to create a new package that OVS
package depends on to install the preset file. This is unwieldy.

This commit, provides a rpm build time option to enable the openvswitch
service automatically. If you now run the below command, openvswitch
service will be automatically enabled during package installation.

make rpm-fedora RPMBUILD_OPT="--with autoenable"

Signed-off-by: Gurucharan Shetty <[email protected]>
Acked-by: Ansis Atteka <[email protected]>
  • Loading branch information
shettyg committed May 14, 2019
1 parent d58b59c commit dcd0f1e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions rhel/openvswitch-fedora.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
# This is enabled by default for versions of the distribution that
# have Python 3 by default (Fedora > 22).
%bcond_with build_python3
# If there is a need to automatically enable the package after installation,
# specify the "--with autoenable"
%bcond_with autoenable

# Enable PIE, bz#955181
%global _hardened_build 1
Expand Down Expand Up @@ -382,6 +385,7 @@ fi
%endif

%if 0%{?systemd_post:1}
# This may not enable openvswitch service or do daemon-reload.
%systemd_post %{name}.service
%else
# Package install, not upgrade
Expand All @@ -390,6 +394,11 @@ fi
fi
%endif

%if %{with autoenable}
systemctl daemon-reload
systemctl enable openvswitch
%endif

%post selinux-policy
%selinux_modules_install -s targeted %{_datadir}/selinux/packages/%{name}/openvswitch-custom.pp

Expand Down

0 comments on commit dcd0f1e

Please sign in to comment.