From 7f2e105491287fa1d628038ad3d1f2679b8a1803 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 16 Dec 2009 23:25:20 +0000 Subject: added debian packaging directory --- debian/changelog | 6 +++ debian/compat | 1 + debian/control | 17 ++++++ debian/copyright | 30 +++++++++++ debian/postinst | 10 ++++ debian/postrm | 9 ++++ debian/prerm | 12 +++++ debian/rhdropbox.default | 5 ++ debian/rhdropbox.init | 138 +++++++++++++++++++++++++++++++++++++++++++++++ debian/rules | 67 +++++++++++++++++++++++ doc/rhdropbox.8.txt | 2 +- 11 files changed, 296 insertions(+), 1 deletion(-) create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100755 debian/postinst create mode 100755 debian/postrm create mode 100755 debian/prerm create mode 100644 debian/rhdropbox.default create mode 100755 debian/rhdropbox.init create mode 100755 debian/rules diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..2aebb52 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,6 @@ +rhdropbox (0.1-1) unstable; urgency=low + + * Initial release + + -- Christian Pointner Mon, 16 Dec 2009 13:22:45 +0100 + diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +5 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..8c601a8 --- /dev/null +++ b/debian/control @@ -0,0 +1,17 @@ +Source: rhdropbox +Section: misc +Priority: extra +Maintainer: Christian Pointner +Build-Depends: debhelper (>= 5), asciidoc, docbook-xsl, xsltproc +Standards-Version: 3.8.3 +Homepage: http://www.helsinki.at/ + +Package: rhdropbox +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, adduser +Description: Radio Helsinki dropbox daemon using inotify + rhdropbox is a small daemon which can be used to watch one or more + directories for new files. When a new file is detected a external program. + Aditional directories can be added to the damons watch list using a simple + unix socket based command interface. + diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..d1d4289 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,30 @@ +This package was debianized by Michael Prokop on +Fri, 29 May 2009 11:23:42 +0200. + +It was downloaded from + +Upstream Author: Christian Pointner + +Copyright: 2007-2009 Christian Pointner + +License: + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL-3'. + +The Debian packaging is © 2009, Michael Prokop and +is licensed under the GPL, see above. diff --git a/debian/postinst b/debian/postinst new file mode 100755 index 0000000..672dae8 --- /dev/null +++ b/debian/postinst @@ -0,0 +1,10 @@ +#!/bin/sh +# postinst script for rhdropbox + +set -e + +if [ -x "/etc/init.d/rhdropbox" ]; then + update-rc.d rhdropbox defaults >/dev/null +fi + + diff --git a/debian/postrm b/debian/postrm new file mode 100755 index 0000000..dc16a9d --- /dev/null +++ b/debian/postrm @@ -0,0 +1,9 @@ +#!/bin/sh +# postrm script for rhdropbox + +set -e + +if [ "$1" = "purge" ] ; then + update-rc.d rhdropbox remove >/dev/null || exit $? +fi + diff --git a/debian/prerm b/debian/prerm new file mode 100755 index 0000000..9ddebb7 --- /dev/null +++ b/debian/prerm @@ -0,0 +1,12 @@ +#!/bin/sh +# prerm script for rhdropbox + +set -e + +if [ -x "/etc/init.d/rhdropbox" ] && [ "$1" = remove ]; then + if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then + invoke-rc.d rhdropbox stop || true + else + /etc/init.d/rhdropbox stop || true + fi +fi diff --git a/debian/rhdropbox.default b/debian/rhdropbox.default new file mode 100644 index 0000000..c32d348 --- /dev/null +++ b/debian/rhdropbox.default @@ -0,0 +1,5 @@ +# Defaults for rhdropbox initscript +# sourced by /etc/init.d/rhdropbox + +# Additional options that are passed to the Daemon. +DAEMONOPTS="" diff --git a/debian/rhdropbox.init b/debian/rhdropbox.init new file mode 100755 index 0000000..79d8c38 --- /dev/null +++ b/debian/rhdropbox.init @@ -0,0 +1,138 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: rhdropbox +# Required-Start: $syslog +# Required-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start radio helsinki dropbox daemon at boot time +# Description: Enables dropboxes +### END INIT INFO +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=/usr/bin/rhdropbox +CONFIG_DIR=/etc/rhdropbox +NAME=rhdropbox +DESC=rhdropbox +VARRUN_DIR=/var/run/$NAME + +test -x $DAEMON || exit 0 + +# Include rhdropbox defaults if available +if [ -f /etc/default/rhdropbox ] ; then + . /etc/default/rhdropbox +fi + +start_db () { + STATUS="OK" + if [ -f $CONFIG_DIR/$DBNAME/config ] ; then + NEWFILE='' + test -f $CONFIG_DIR/$DBNAME/newfile.sh && NEWFILE="-x $CONFIG_DIR/$DBNAME/newfile.sh" + CHROOTDIR=`grep '^chroot' < $CONFIG_DIR/$DBNAME/config | sed 's/chroot\s*//'` + if [ -n "$CHROOTDIR" ] ; then + test -d $CHROOTDIR || mkdir -p $CHROOTDIR + fi + test -d $VARRUN_DIR || mkdir -p $VARRUN_DIR + DAEMONARG=`sed 's/#.*//' < $CONFIG_DIR/$DBNAME/config | grep -e '\w' | sed 's/^/--/' | tr '\n' ' '` + $DAEMON --write-pid $VARRUN_DIR/$DBNAME.pid $NEWFILE $DAEMONOPTS $DAEMONARG || STATUS="FAILED" + else + STATUS="no config found" + fi + echo -n "($STATUS)" +} + +stop_db () { + kill `cat $PIDFILE` || true + rm $PIDFILE +} + +set -e +case "$1" in + start) + echo -n "Starting $DESC:" + if test -z "$2" ; then + if [ -f $CONFIG_DIR/autostart ] ; then + for DBNAME in `sed 's/#.*//' < $CONFIG_DIR/autostart | grep -e '\w'`; do + echo -n " $DBNAME" + start_db + done + else + echo " no config found" + exit 1; + fi + else + while shift ; do + [ -z "$1" ] && break + DBNAME=$1 + echo -n " $DBNAME" + start_db + done + fi + echo "." + ;; + stop) + echo -n "Stoping $DESC:" + if test -z "$2" ; then + for PIDFILE in `ls $VARRUN_DIR/*.pid 2> /dev/null`; do + DBNAME=`echo $PIDFILE | cut -c20-` + DBNAME=${DBNAME%%.pid} + echo -n " $DBNAME" + stop_db + done + else + while shift ; do + [ -z "$1" ] && break + if test -e $VARRUN_DIR/$1.pid ; then + PIDFILE=`ls $VARRUN_DIR/$1.pid 2> /dev/null` + DBNAME=`echo $PIDFILE | cut -c20-` + DBNAME=${DBNAME%%.pid} + echo -n " $DBNAME" + stop_db + else + echo -n " (failure: No such tunnel is running: $1)" + fi + done + fi + echo "." + ;; + reload) + echo -n "Reloading $DESC:" + if test -z "$2" ; then + for PIDFILE in `ls $VARRUN_DIR/*.pid 2> /dev/null`; do + DBNAME=`echo $PIDFILE | cut -c20-` + DBNAME=${DBNAME%%.pid} + echo -n " $DBNAME" + stop_db + start_db + done + else + while shift ; do + [ -z "$1" ] && break + if test -e $VARRUN_DIR/$1.pid ; then + PIDFILE=`ls $VARRUN_DIR/$1.pid 2> /dev/null` + DBNAME=`echo $PIDFILE | cut -c20-` + DBNAME=${DBNAME%%.pid} + echo -n " $DBNAME" + stop_db + start_db + else + echo -n " (failure: No such tunnel is running: $1)" + fi + done + fi + echo "." + ;; + restart) + SCRIPT=$0 + shift + $SCRIPT stop $* + sleep 1 + $SCRIPT start $* + ;; + *) + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop|restart|reload}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..e3a8bf1 --- /dev/null +++ b/debian/rules @@ -0,0 +1,67 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +configure: configure-stamp +configure-stamp: + dh_testdir + ./configure --prefix=/usr --sysconfdir=/etc + touch configure-stamp + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + + $(MAKE) + $(MAKE) manpage + + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + $(MAKE) --directory=$(CURDIR) distclean + dh_clean + +install: build + dh_testdir + dh_testroot + dh_installdirs + + # Add here commands to install the package into debian/rhdropbox. + $(MAKE) DESTDIR=$(CURDIR)/debian/rhdropbox install + +# Build architecture-independent files here. +binary-indep: install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: install + dh_testdir + dh_testroot + dh_installdocs + dh_installinit + dh_installman doc/rhdropbox.8 + dh_link + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/doc/rhdropbox.8.txt b/doc/rhdropbox.8.txt index 207f177..843ab2a 100644 --- a/doc/rhdropbox.8.txt +++ b/doc/rhdropbox.8.txt @@ -65,7 +65,7 @@ The following options can be passed to the *rhdropbox* daemon: disabling log and 5 means debug messages are enabled. + The file target can be used more the once with different levels. If no target is provided at the command line a single target with the - config *syslog:3,uanytun,daemon* is added. + + config *syslog:3,rhdropbox,daemon* is added. + The following targets are supported: *syslog*;; log to syslog daemon, parameters [,[,]] -- cgit v1.2.3