I would like to use 'chkconfig --del NetworkManager' command in the %install section of a rpm spec file. If I include this command the rpm is building fine but when I install that rpm, it looks that the command does not get executed. After installing I verified using 'chkconfig --list' command and observed the service is till running.
Here is spec file I am using. Please let me know ehre I am going wrong.
%define name disable_network-manager
%define version 1.0
%define release fc
Name: %{name}
Version: %{version}
Release: 1%{?dist}
Summary: Includes the script to disable Network Manager services
Group: Development/Other
License: GPL
URL: www.abcd.com
Source0: %{name}-%{version}.tar.gz
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
%description
sample text.
%prep
%setup -q
#%build
%install
/sbin/chkconfig --del NetworkManager
rm -rf $RPM_BUILD_ROOT
install -m 0755 -d $RPM_BUILD_ROOT/usr/bin
install -m 0755 enablenm.sh $RPM_BUILD_ROOT/usr/bin/enablenm.sh
%clean
rm -rf $RPM_BUILD_ROOT
%files
/usr/bin/enablenm.sh
Ok, Got the answer. I should have issue the chkconfig command from the %post section instead of %install section.
Actually, your answer is wrong I think...
First, you want to do /sbin/chkconfig NetworkManager off
to turn it off cleanly; --del
removes it from chkconfig
control.
Secondly, that just stops it from running next time you reboot. To stop the currently running instance, you need to call /sbin/service NetworkManager stop
.
But yes, the %install
section is not run on the target machine, only on the build machine. %post
is the proper place to put the two commands I have above.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With