diff --git a/.cvsignore b/.cvsignore index e69de29..3502069 100644 --- a/.cvsignore +++ b/.cvsignore @@ -0,0 +1 @@ +setroubleshoot-0.6.tar.gz diff --git a/setroubleshoot.init b/setroubleshoot.init new file mode 100755 index 0000000..d9a6ad2 --- /dev/null +++ b/setroubleshoot.init @@ -0,0 +1,102 @@ +#!/bin/bash +# +# setroubleshoot This starts and stops setroubleshoot daemon +# +# chkconfig: - 12 87 +# description: This starts the SELinux Troubleshooting Daemon +# +# processname: /usr/sbin/setroubleshootd +# config: /etc/setroubleshoot/setroubleshoot.cfg +# pidfile: /var/run/setroubleshoot.pid +# +# Return values according to LSB for all commands but status: +# 0 - success +# 1 - generic or unspecified error +# 2 - invalid or excess argument(s) +# 3 - unimplemented feature (e.g. "reload") +# 4 - insufficient privilege +# 5 - program is not installed +# 6 - program is not configured +# 7 - program is not running + +PATH=/sbin:/bin:/usr/bin:/usr/sbin + +# Source function library. +. /etc/init.d/functions + +# Check that we are root ... so non-root users stop here +test `id -u` = 0 || exit 4 + +# Check config +test -x /usr/sbin/setroubleshootd || exit 5 + +RETVAL=0 + +prog="setroubleshootd" + +start(){ + echo -n $"Starting $prog: " + unset HOME MAIL USER USERNAME + daemon $prog "$EXTRAOPTIONS" + RETVAL=$? + echo + if test $RETVAL = 0 ; then + touch /var/lock/subsys/setroubleshootd + fi + return $RETVAL +} + +stop(){ + echo -n $"Stopping $prog: " + killproc $prog + RETVAL=$? + echo + rm -f /var/lock/subsys/setroubleshootd + return $RETVAL +} + +reload(){ + echo -n $"Reloading configuration: " + killproc $prog -HUP + RETVAL=$? + echo + return $RETVAL +} + +restart(){ + stop + start +} + +condrestart(){ + [ -e /var/lock/subsys/setroubleshoot ] && restart + return 0 +} + + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + status $prog + ;; + restart) + restart + ;; + reload) + reload + ;; + condrestart) + condrestart + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|rotate}" + RETVAL=3 +esac + +exit $RETVAL diff --git a/setroubleshoot.logrotate b/setroubleshoot.logrotate new file mode 100644 index 0000000..4b13ebd --- /dev/null +++ b/setroubleshoot.logrotate @@ -0,0 +1,7 @@ +/var/log/setroubleshoot/setroubleshoot.log { + weekly + rotate 2 + missingok + sharedscripts + endscript +} diff --git a/setroubleshoot.spec b/setroubleshoot.spec new file mode 100644 index 0000000..cac303c --- /dev/null +++ b/setroubleshoot.spec @@ -0,0 +1,97 @@ +Summary: Helps troubleshoot SELinux problems +Name: setroubleshoot +Version: 0.6 +Release: 1 +License: GPL +Group: Applications/System +URL: http://www.redhat.com/ +Source0: %{name}-%{version}.tar.gz +Source1: setroubleshoot.init +Source2: setroubleshoot.logrotate +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildArch: noarch + +%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} + +%define pkgpythondir %{python_sitelib}/%{name} +%define pkgdocdir %{_datadir}/doc/%{name}-%{version} +%define pkgdatadir %{_datadir}/%{name} +%define pkglibexecdir %{_prefix}/libexec/%{name} +%define pkgvardatadir %{_localstatedir}/lib/%{name} +%define pkgrundir %{_localstatedir}/run/%{name} +%define pkgconfigdir %{_sysconfdir}/%{name} +%define pkglogdir %{_localstatedir}/log/%{name} +%define auditlibdir %{_libdir}/audit + +Requires: audit-libs-python +Requires: libselinux >= 1.30.15-1 +Requires: pygtk2 >= 2.9.2 + +Requires(post): /sbin/chkconfig +Requires(preun): /sbin/chkconfig +Requires(preun): /sbin/service + +%description +Provides tools to help diagnose SELinux problems. When AVC messages +are generated an alert can be generated that will give information +about the problem and help track its resolution. Alerts can be configured +to user preference. The same tools can be run on existing log files. + +%prep +%setup -q + +%build +%configure +make + +%install +rm -rf %{buildroot} +make DESTDIR=%{buildroot} install +%{__install} -D -m755 %{SOURCE1} %{buildroot}/etc/rc.d/init.d/%{name} +%{__install} -D -m644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/%{name} + +%post +/usr/bin/update-desktop-database %{_datadir}/applications +/sbin/chkconfig --add %{name} +[ -x /sbin/service ] && /sbin/service %{name} condrestart + +%preun +if [ $1 = 0 ]; then + /sbin/service %{name} stop >/dev/null 2>&1 + /sbin/chkconfig --del %{name} +fi + +%postun +/usr/bin/update-desktop-database %{_datadir}/applications + +%clean +rm -rf %{buildroot} + +%files +%defattr(-,root,root,-) +%doc %{pkgdocdir} +%{_sbindir}/* +%{auditlibdir}/* +%{pkgpythondir} +%{pkgdatadir} +%config(noreplace) %{pkgconfigdir}/%{name}.cfg +%dir %{pkglogdir} +%config(noreplace) %{_sysconfdir}/logrotate.d/%{name} +%dir %{pkgrundir} +%dir %{pkgvardatadir} +/etc/rc.d/init.d/%{name} +%{_sysconfdir}/xdg/autostart/* +%{_datadir}/applications/*.desktop +%{_datadir}/pixmaps/*png + +%changelog +* Mon Jun 26 2006 John Dennis - 0.3-1 +- add missing /var/log directory %files section in spec file, and add + logrotate script + +* Mon Jun 26 2006 John Dennis - 0.2-1 +- clean up spec file, reduce rpmlint complaints + +* Fri May 19 2006 John Dennis - 0.1-1 +- Initial build. + diff --git a/sources b/sources index e69de29..cc197fa 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +933fe223d0f7c9d52040796e3a8a5b95 setroubleshoot-0.6.tar.gz