Added Systemd Functionality to systemtap.spec
This commit is contained in:
parent
f1adbf7f43
commit
5a059f5b18
@ -30,10 +30,11 @@
|
||||
%else
|
||||
%global with_dyninst 0
|
||||
%endif
|
||||
%{!?with_systemd: %global with_systemd 0%{?fedora} >= 19}
|
||||
|
||||
Name: systemtap
|
||||
Version: 2.1
|
||||
Release: 0.204.gc43c0f8%{?dist}
|
||||
Release: 0.238%{?dist}
|
||||
# for version, see also configure.ac
|
||||
|
||||
|
||||
@ -382,25 +383,32 @@ mv $RPM_BUILD_ROOT%{_datadir}/doc/systemtap/SystemTap_Beginners_Guide docs.insta
|
||||
%endif
|
||||
%endif
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/stap-server
|
||||
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/stap-server
|
||||
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/stap-server
|
||||
touch $RPM_BUILD_ROOT%{_localstatedir}/log/stap-server/log
|
||||
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/cache/systemtap
|
||||
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/systemtap
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
|
||||
install -m 644 initscript/logrotate.stap-server $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/stap-server
|
||||
%if 0%{?with_systemd}
|
||||
mkdir -p $RPM_BUILD_ROOT%{_unitdir}
|
||||
touch $RPM_BUILD_ROOT%{_unitdir}/stap-server.service
|
||||
install -m 644 stap-server.service $RPM_BUILD_ROOT%{_unitdir}/stap-server.service
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/lib/tmpfiles.d
|
||||
install -m 644 stap-server.conf $RPM_BUILD_ROOT/usr/lib/tmpfiles.d/stap-server.conf
|
||||
%else
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/
|
||||
install -m 755 initscript/systemtap $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/systemtap
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/systemtap/conf.d
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/systemtap/script.d
|
||||
install -m 644 initscript/config.systemtap $RPM_BUILD_ROOT%{_sysconfdir}/systemtap/config
|
||||
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/cache/systemtap
|
||||
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/systemtap
|
||||
|
||||
install -m 755 initscript/stap-server $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/stap-server
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/stap-server/conf.d
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
|
||||
install -m 644 initscript/config.stap-server $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/stap-server
|
||||
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/stap-server
|
||||
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/stap-server
|
||||
touch $RPM_BUILD_ROOT%{_localstatedir}/log/stap-server/log
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
|
||||
install -m 644 initscript/logrotate.stap-server $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/stap-server
|
||||
%endif
|
||||
|
||||
%clean
|
||||
rm -rf ${RPM_BUILD_ROOT}
|
||||
@ -418,12 +426,15 @@ getent passwd stap-server >/dev/null || \
|
||||
useradd -c "Systemtap Compile Server" -g stap-server -d %{_localstatedir}/lib/stap-server -m -r -s /sbin/nologin stap-server
|
||||
test -e ~stap-server && chmod 755 ~stap-server
|
||||
|
||||
%if 0%{?with_systemd}
|
||||
%else
|
||||
if [ ! -f ~stap-server/.systemtap/rc ]; then
|
||||
mkdir -p ~stap-server/.systemtap
|
||||
chown stap-server:stap-server ~stap-server/.systemtap
|
||||
echo "--rlimit-as=614400000 --rlimit-cpu=60 --rlimit-nproc=20 --rlimit-stack=1024000 --rlimit-fsize=51200000" > ~stap-server/.systemtap/rc
|
||||
chown stap-server:stap-server ~stap-server/.systemtap/rc
|
||||
fi
|
||||
%endif
|
||||
exit 0
|
||||
|
||||
%post server
|
||||
@ -438,7 +449,12 @@ if test ! -e ~stap-server/.systemtap/ssl/server/stap.cert; then
|
||||
runuser -s /bin/sh - stap-server -c %{_libexecdir}/%{name}/stap-gen-cert >/dev/null
|
||||
fi
|
||||
# Activate the service
|
||||
/sbin/chkconfig --add stap-server
|
||||
%if 0%{?with_systemd}
|
||||
/bin/systemctl enable stap-server.service >/dev/null 2>&1 || :
|
||||
/bin/systemd-tmpfiles --create >/dev/null 2>&1 || :
|
||||
%else
|
||||
/sbin/chkconfig --add stap-server
|
||||
%endif
|
||||
exit 0
|
||||
|
||||
%triggerin client -- systemtap-server
|
||||
@ -454,8 +470,13 @@ exit 0
|
||||
# Check that this is the actual deinstallation of the package, as opposed to
|
||||
# just removing the old package on upgrade.
|
||||
if [ $1 = 0 ] ; then
|
||||
/sbin/service stap-server stop >/dev/null 2>&1
|
||||
/sbin/chkconfig --del stap-server
|
||||
%if 0%{?with_systemd}
|
||||
/bin/systemctl --no-reload disable stap-server.service >/dev/null 2>&1 || :
|
||||
/bin/systemctl stop stap-server.service >/dev/null 2>&1 || :
|
||||
%else
|
||||
/sbin/service stap-server stop >/dev/null 2>&1
|
||||
/sbin/chkconfig --del stap-server
|
||||
%endif
|
||||
fi
|
||||
exit 0
|
||||
|
||||
@ -463,20 +484,34 @@ exit 0
|
||||
# Check whether this is an upgrade of the package.
|
||||
# If so, restart the service if it's running
|
||||
if [ "$1" -ge "1" ] ; then
|
||||
/sbin/service stap-server condrestart >/dev/null 2>&1 || :
|
||||
%if 0%{?with_systemd}
|
||||
/bin/systemctl restart stap-server.service >/dev/null 2>&1 || :
|
||||
%else
|
||||
/sbin/service stap-server condrestart >/dev/null 2>&1 || :
|
||||
%endif
|
||||
fi
|
||||
exit 0
|
||||
|
||||
%post initscript
|
||||
/sbin/chkconfig --add systemtap
|
||||
%if 0%{?with_systemd}
|
||||
/bin/systemctl enable stap-server.service >/dev/null 2>&1 || :
|
||||
/bin/systemd-tmpfiles --create >/dev/null 2>&1 || :
|
||||
%else
|
||||
/sbin/chkconfig --add systemtap
|
||||
%endif
|
||||
exit 0
|
||||
|
||||
%preun initscript
|
||||
# Check that this is the actual deinstallation of the package, as opposed to
|
||||
# just removing the old package on upgrade.
|
||||
if [ $1 = 0 ] ; then
|
||||
/sbin/service systemtap stop >/dev/null 2>&1
|
||||
/sbin/chkconfig --del systemtap
|
||||
%if 0%{?with_systemd}
|
||||
/bin/systemctl --no-reload disable stap-server.service >/dev/null 2>&1 || :
|
||||
/bin/systemctl stop stap-server.service >/dev/null 2>&1 || :
|
||||
%else
|
||||
/sbin/service systemtap stop >/dev/null 2>&1
|
||||
/sbin/chkconfig --del systemtap
|
||||
%endif
|
||||
fi
|
||||
exit 0
|
||||
|
||||
@ -484,7 +519,11 @@ exit 0
|
||||
# Check whether this is an upgrade of the package.
|
||||
# If so, restart the service if it's running
|
||||
if [ "$1" -ge "1" ] ; then
|
||||
/sbin/service systemtap condrestart >/dev/null 2>&1 || :
|
||||
%if 0%{?with_systemd}
|
||||
/bin/systemctl restart stap-server.service >/dev/null 2>&1 || :
|
||||
%else
|
||||
/sbin/service systemtap condrestart >/dev/null 2>&1 || :
|
||||
%endif
|
||||
fi
|
||||
exit 0
|
||||
|
||||
@ -518,11 +557,16 @@ exit 0
|
||||
%{_mandir}/man7/stappaths.7*
|
||||
%{_mandir}/man7/warning*
|
||||
%{_mandir}/man8/stap-server.8*
|
||||
%if 0%{with_systemd}
|
||||
%{_unitdir}/stap-server.service
|
||||
/usr/lib/tmpfiles.d/stap-server.conf
|
||||
%else
|
||||
%{_sysconfdir}/rc.d/init.d/stap-server
|
||||
%config(noreplace) %{_sysconfdir}/logrotate.d/stap-server
|
||||
%dir %{_sysconfdir}/stap-server
|
||||
%dir %{_sysconfdir}/stap-server/conf.d
|
||||
%config(noreplace) %{_sysconfdir}/logrotate.d/stap-server
|
||||
%endif
|
||||
%config(noreplace) %{_sysconfdir}/sysconfig/stap-server
|
||||
%dir %{_sysconfdir}/stap-server
|
||||
%dir %attr(0750,stap-server,stap-server) %{_localstatedir}/lib/stap-server
|
||||
%dir %attr(0755,stap-server,stap-server) %{_localstatedir}/log/stap-server
|
||||
%ghost %config(noreplace) %attr(0644,stap-server,stap-server) %{_localstatedir}/log/stap-server/log
|
||||
@ -598,11 +642,14 @@ exit 0
|
||||
|
||||
%files initscript
|
||||
%defattr(-,root,root)
|
||||
%if 0%{?with_systemd}
|
||||
%else
|
||||
%{_sysconfdir}/rc.d/init.d/systemtap
|
||||
%dir %{_sysconfdir}/systemtap
|
||||
%dir %{_sysconfdir}/systemtap/conf.d
|
||||
%dir %{_sysconfdir}/systemtap/script.d
|
||||
%config(noreplace) %{_sysconfdir}/systemtap/config
|
||||
%endif
|
||||
%dir %{_localstatedir}/cache/systemtap
|
||||
%ghost %{_localstatedir}/run/systemtap
|
||||
%doc initscript/README.systemtap
|
||||
@ -626,6 +673,9 @@ exit 0
|
||||
# ------------------------------------------------------------------------
|
||||
|
||||
%changelog
|
||||
* Mon Jan 21 2013 Lukas Berk <lberk@redhat.com> - 2.1-0.238
|
||||
- Added systemd functionality based on 'with_systemd' macro
|
||||
|
||||
* Mon Jan 14 2013 Lukas Berk <lberk@redhat.com> - 2.1-0.204.gc43c0f8
|
||||
- Automated weekly rawhide release
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user