summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xdebuginfofs-server.init89
-rw-r--r--debuginfofs.spec32
2 files changed, 114 insertions, 7 deletions
diff --git a/debuginfofs-server.init b/debuginfofs-server.init
new file mode 100755
index 0000000..ac294bc
--- /dev/null
+++ b/debuginfofs-server.init
@@ -0,0 +1,89 @@
+#!/bin/bash
+#
+### BEGIN INIT INFO
+# Provides: debuginfofs-server
+# Required-Start: $local_fs $network $named $remote_fs $syslog
+# Required-Stop: $local_fs $network $named $remote_fs $syslog
+# Short-Description: Remote debuginfo filesystem server
+# Description: Export a filesystem with debuginfo for use with debugging tools
+### END INIT INFO
+
+# debuginfofs Starts/stops the debuginfofs WebDAV server
+#
+# chkconfig: - 85 15
+# description: debuginfofs-server starts a WebDAV server which exports the \
+# debuginfo data fetched with debuginfofs-mirror.
+# config: /etc/debuginfofs.conf
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+# Source networking configuration.
+. /etc/sysconfig/network
+
+# Read our configuration
+export DEBUGINFOFS_EXPORTDIR="$(sed -ne 's/ *exportdir *=\(.*\)$/\1/p' /etc/debuginfofs.conf 2>/dev/null)"
+
+RETVAL=0
+prog="debuginfofs-server"
+pidfile="/var/run/$prog.pid"
+
+start() {
+ # Check that networking is up.
+ [ ${NETWORKING} = "no" ] && exit 1
+
+ # Sanity check binary and configuration
+ [ -x /usr/sbin/httpd ] || exit 1
+ [ -d "$DEBUGINFOFS_EXPORTDIR" ] || mkdir -p "$DEBUGINFOFS_EXPORTDIR"
+ [ -r "$DEBUGINFOFS_EXPORTDIR" ] || exit 1
+
+ echo -n $"Starting debuginfofs-server: "
+ /usr/sbin/httpd -f /usr/share/debuginfofs/dav-debuginfo.conf
+ RETVAL=$?
+
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/debuginfofs-server
+ [ $RETVAL -eq 0 ] && success $"$prog startup" || failure $"$prog startup"
+ echo
+ return $RETVAL
+}
+
+stop() {
+ echo -n $"Stopping debuginfofs: "
+ /usr/sbin/httpd -f /usr/share/debuginfofs/dav-debuginfo.conf -k stop
+ RETVAL=$?
+ rm -f /var/lock/subsys/debuginfofs-server
+ [ $RETVAL -eq 0 ] && success $"$prog shutdown" || failure $"$prog shutdown"
+ echo
+ return $RETVAL
+}
+
+# See how we were called.
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart|reload|force-reload)
+ stop
+ start
+ RETVAL=$?
+ ;;
+ condrestart)
+ if [ -f /var/lock/subsys/debuginfofs-server ]; then
+ stop
+ start
+ RETVAL=$?
+ fi
+ ;;
+ status)
+ status $prog
+ RETVAL=$?
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|restart|condrestart|status}"
+ exit 1
+esac
+
+exit $RETVAL
diff --git a/debuginfofs.spec b/debuginfofs.spec
index 64f61ad..1cd6be8 100644
--- a/debuginfofs.spec
+++ b/debuginfofs.spec
@@ -10,7 +10,7 @@ Source0: %{name}-%{version}.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
-Requires: devfs2
+Requires: davfs2
Requires(post): chkconfig
Requires(preun): chkconfig
Requires(preun): initscripts
@@ -23,7 +23,11 @@ symbols needed to generate a fully annotated backtrace.
%package server
Summary: Server setup for debuginfofs
Group: Development/Debuggers
-Requires: rpm cpio httpd
+Requires: rpm cpio httpd
+Requires(post): chkconfig
+Requires(preun): chkconfig
+Requires(preun): initscripts
+Requires(postun): initscripts
%description server
Server tools and config files for running a debuginfofs server
@@ -42,13 +46,13 @@ mkdir -p $RPM_BUILD_ROOT{%{_initrddir},/etc/sysconfig}
install -m 0755 debuginfofs.init $RPM_BUILD_ROOT%{_initrddir}/debuginfofs
install -m 0644 debuginfofs.sysconfig $RPM_BUILD_ROOT/etc/sysconfig/debuginfofs
# server
-mkdir -p $RPM_BUILD_ROOT{/etc/httpd/conf.d,/usr/sbin}
+mkdir -p $RPM_BUILD_ROOT{/usr/share/debuginfofs,/usr/sbin}
mkdir -p $RPM_BUILD_ROOT/var/{www,cache}/debuginfofs
install -m 0755 debuginfofs-mirror $RPM_BUILD_ROOT/usr/sbin
#uncomment when this is ready
#install -m 0755 repofs.py $RPM_BUILD_ROOT/usr/sbin
install -m 0644 debuginfofs.conf $RPM_BUILD_ROOT/etc
-install -m 0644 dav-debuginfo.conf $RPM_BUILD_ROOT/etc/httpd/conf.d
+install -m 0644 dav-debuginfo.conf $RPM_BUILD_ROOT/usr/share/debuginfofs
%clean
@@ -56,18 +60,28 @@ rm -rf $RPM_BUILD_ROOT
%post
/sbin/chkconfig --add debuginfofs
-
%preun
if [ "$1" == "0" ] ; then
/sbin/service debuginfofs stop >/dev/null 2>&1
/sbin/chkconfig --del debuginfofs
fi
-
%postun
if [ "$1" -ge "1" ] ; then
/sbin/service debuginfofs condrestart >/dev/null 2>&1 || :
fi
+%post server
+/sbin/chkconfig --add debuginfofs-server
+%preun server
+if [ "$1" == "0" ] ; then
+ /sbin/service debuginfofs-server stop >/dev/null 2>&1
+ /sbin/chkconfig --del debuginfofs-server
+fi
+%postun server
+if [ "$1" -ge "1" ] ; then
+ /sbin/service debuginfofs-server condrestart >/dev/null 2>&1 || :
+fi
+
%files
%defattr(-,root,root,-)
@@ -80,11 +94,15 @@ fi
%doc README TODO COPYING
%dir /var/www/debuginfofs
%dir /var/cache/debuginfofs
+%{_initrddir}/debuginfofs-server
%config(noreplace) /etc/debuginfofs.conf
-%config /etc/httpd/conf.d/dav-debuginfo.conf
+%config(noreplace) /usr/share/debuginfofs/dav-debuginfo.conf
%{_sbindir}/debuginfofs-mirror
%changelog
+* Wed Mar 04 2009 Will Woods <wwoods@redhat.com> - 0.1-2
+- Switch to davfs2, add debuginfofs-server service
+
* Tue Mar 03 2009 Will Woods <wwoods@redhat.com> - 0.1-1
- Package Review: Add COPYING, fix up initscript, clean up specfile