diff options
-rw-r--r-- | debian/changelog | 6 | ||||
-rw-r--r-- | debian/compat | 1 | ||||
-rw-r--r-- | debian/control | 13 | ||||
-rw-r--r-- | debian/copyright | 28 | ||||
-rw-r--r-- | debian/postinst | 12 | ||||
-rw-r--r-- | debian/postrm | 15 | ||||
-rw-r--r-- | debian/prerm | 12 | ||||
-rw-r--r-- | debian/rharchive.default | 5 | ||||
-rw-r--r-- | debian/rharchive.init | 131 | ||||
-rwxr-xr-x | debian/rules | 68 | ||||
-rw-r--r-- | src/Makefile | 19 | ||||
-rwxr-xr-x | src/configure | 6 |
12 files changed, 295 insertions, 21 deletions
diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..e057a6b --- /dev/null +++ b/debian/changelog @@ -0,0 +1,6 @@ +rharchive (0.1-1) unstable; urgency=low + + * Initial release + + -- Christian Pointner <equinox@helsinki.at> Tue, 19 Apr 2011 16:08:13 +0200 + 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..a6a5c50 --- /dev/null +++ b/debian/control @@ -0,0 +1,13 @@ +Source: rharchive +Section: misc +Priority: extra +Maintainer: Christian Pointner <equinox@helsinki.at> +Build-Depends: debhelper (>= 5), libgstreamer0.10-dev, libgstreamer-plugins-base0.10-dev, pkg-config +Standards-Version: 3.8.4 +Homepage: http://www.helsinki.at/ + +Package: rharchive +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, libgstreamer0.10, libgstreamer-plugins-base0.10 +Description: Radio Helsinki Archive daemon + A small gstreamer-based daemon which creates archive files diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..501a0ee --- /dev/null +++ b/debian/copyright @@ -0,0 +1,28 @@ +This package was debianized by Christian Poitnenr <equinox@helsinki.at> on +Fri, 29 May 2009 11:23:42 +0200. + +Upstream Author: Christian Pointner <equinox@helsinki.at> + +Copyright: 2011 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, Christian Pointner <equinox@helsinki.at> and +is licensed under the GPL, see above. diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 0000000..702b771 --- /dev/null +++ b/debian/postinst @@ -0,0 +1,12 @@ +#!/bin/sh +# postinst script for rharchive + +set -e + +if [ -x "/etc/init.d/rharchive" ]; then + update-rc.d rharchive defaults >/dev/null +fi + +if [ "$1" = "configure" ]; then + adduser --quiet --system --group --no-create-home --home /var/run/rharchive rharchive +fi diff --git a/debian/postrm b/debian/postrm new file mode 100644 index 0000000..29437f4 --- /dev/null +++ b/debian/postrm @@ -0,0 +1,15 @@ +#!/bin/sh +# postrm script for rharchive + +set -e + +if [ "$1" = "purge" ] ; then + update-rc.d rharchive remove >/dev/null || exit $? + + if [ -x "$(command -v deluser)" -a -x "$(command -v delgroup)" ]; then + deluser --quiet --system rharchive || true + delgroup --quiet --system rharchive || true + else + echo "Not removing rharchive user and group: adduser package not found." >&2 + fi +fi diff --git a/debian/prerm b/debian/prerm new file mode 100644 index 0000000..dcbe4bd --- /dev/null +++ b/debian/prerm @@ -0,0 +1,12 @@ +#!/bin/sh +# prerm script for rharchive + +set -e + +if [ -x "/etc/init.d/rharchive" ] && [ "$1" = remove ]; then + if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then + invoke-rc.d rharchive stop || true + else + /etc/init.d/rharchive stop || true + fi +fi diff --git a/debian/rharchive.default b/debian/rharchive.default new file mode 100644 index 0000000..952cf1b --- /dev/null +++ b/debian/rharchive.default @@ -0,0 +1,5 @@ +# Defaults for uanytun initscript +# sourced by /etc/init.d/uanytun + +# Additional options that are passed to the Daemon. +DAEMONOPTS="--username rharchive" diff --git a/debian/rharchive.init b/debian/rharchive.init new file mode 100644 index 0000000..fa07b6c --- /dev/null +++ b/debian/rharchive.init @@ -0,0 +1,131 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: rharchive +# Required-Start: $remote_fs $network $named $syslog +# Required-Stop: $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start Radio Helsinki Archive Daemon +# Description: Enables Radio Helsinki Archive Daemon +### END INIT INFO +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=/usr/bin/rharchive +CONFIG_DIR=/etc/rharchive +NAME=rharchive +DESC=rharchive +VARRUN_DIR=/var/run/$NAME + +test -x $DAEMON || exit 0 + +# Include rharchive defaults if available +if [ -f /etc/default/rharchive ] ; then + . /etc/default/rharchive +fi + +start_inst () { + STATUS="OK" + if [ -f $CONFIG_DIR/$INSTNAME/config ] ; then + CHROOTDIR=`grep '^chroot' < $CONFIG_DIR/$INSTNAME/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/$INSTNAME/config | grep -e '\w' | sed 's/^/--/' | tr '\n' ' '` + $DAEMON --write-pid $VARRUN_DIR/$INSTNAME.pid $DAEMONOPTS $DAEMONARG || STATUS="FAILED" + else + STATUS="no config found" + fi + echo -n "($STATUS)" +} +stop_inst () { + 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 INSTNAME in `sed 's/#.*//' < $CONFIG_DIR/autostart | grep -e '\w'`; do + echo -n " $INSTNAME" + start_inst + done + else + echo " no config found" + exit 1; + fi + else + while shift ; do + [ -z "$1" ] && break + INSTNAME=$1 + echo -n " $INSTNAME" + start_inst + done + fi + echo "." + ;; + stop) + echo -n "Stoping $DESC:" + if test -z "$2" ; then + for PIDFILE in `ls $VARRUN_DIR/*.pid 2> /dev/null`; do + INSTNAME=`basename $PIDFILE .pid` + echo -n " $INSTNAME" + stop_inst + 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` + INSTNAME=`basename $PIDFILE .pid` + echo -n " $INSTNAME" + stop_inst + 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 + INSTNAME=`basename $PIDFILE .pid` + echo -n " $INSTNAME" + stop_inst + start_inst + 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` + INSTNAME=`basename $PIDFILE .pid` + echo -n " $INSTNAME" + stop_inst + start_inst + else + echo -n " (failure: No such tunnel is running: $1)" + fi + done + fi + echo "." + ;; + restart|force-reload) + 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..8c1138a --- /dev/null +++ b/debian/rules @@ -0,0 +1,68 @@ +#!/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 + cd src && ./configure --no-manpage --prefix=/usr --sysconfdir=/etc && cd .. + touch configure-stamp + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + + cd src && $(MAKE) && cd .. + + 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)/src distclean + dh_clean + +install: build + dh_testdir + dh_testroot + dh_installdirs + + # Add here commands to install the package into debian/uanytun. + cd src && $(MAKE) DESTDIR=$(CURDIR)/debian/rharchive install && cd .. + +# 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_installchangelogs ChangeLog + dh_installdocs + dh_installexamples + dh_installinit + dh_installman doc/rharchive.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/src/Makefile b/src/Makefile index 4046ec6..a1e4e9d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -104,11 +104,6 @@ INSTALL_TARGETS += install-man REMOVE_TARGETS += remove-man endif -ifdef EXAMPLESDIR -INSTALL_TARGETS += install-examples -REMOVE_TARGETS += remove-examples -endif - install: all $(INSTALL_TARGETS) install-bin: $(EXECUTABLE) @@ -116,16 +111,7 @@ install-bin: $(EXECUTABLE) $(INSTALL) -m 755 $(EXECUTABLE) $(DESTDIR)$(BINDIR) install-etc: - $(INSTALL) -d $(DESTDIR)$(ETCDIR)/init.d/ - $(INSTALL) -m 755 ../contrib/initscript $(DESTDIR)$(ETCDIR)/init.d/$(EXECUTABLE) - $(INSTALL) -d $(DESTDIR)$(ETCDIR)/default/ - $(INSTALL) -m 644 ../contrib/default $(DESTDIR)$(ETCDIR)/default/$(EXECUTABLE) - @ echo "# $(EXECUTABLE) configuration file" > $(DESTDIR)$(ETCDIR)/$(EXECUTABLE).conf - @ echo "# example configurations can be found at $(EXAMPLESDIR)/$(EXECUTABLE)" >> $(DESTDIR)$(ETCDIR)/$(EXECUTABLE).conf - -install-examples: - $(INSTALL) -d $(DESTDIR)$(EXAMPLESDIR)/$(EXECUTABLE) - $(INSTALL) -m 644 ../contrib/example.conf $(DESTDIR)$(EXAMPLESDIR)/$(EXECUTABLE)/ + $(INSTALL) -d $(DESTDIR)$(ETCDIR)/rharchive/ install-man: manpage $(INSTALL) -d $(DESTDIR)$(MANDIR)/man8/ @@ -141,9 +127,6 @@ remove-bin: remove-etc: rm -f $(DESTDIR)$(ETCDIR)/init.d/$(EXECUTABLE) -remove-examples: - rm -rf $(DESTDIR)$(EXAMPLESDIR)/$(EXECUTABLE)/ - remove-man: rm -f $(DESTDIR)$(MANDIR)/man8/$(EXECUTABLE).8 diff --git a/src/configure b/src/configure index 1fa9232..ce0ec7f 100755 --- a/src/configure +++ b/src/configure @@ -98,7 +98,7 @@ LDFLAGS="$LDFLAGS $(pkg-config --libs gstreamer-0.10)" rm -f include.mk rm -f config.h -case $TARGET in +case $TARGET in Linux) ;; OpenBSD|FreeBSD|NetBSD|GNU/kFreeBSD) @@ -125,7 +125,7 @@ fi cat > include.mk <<EOF # this file was created automatically -# do not edit this file directly +# do not edit this file directly # use ./configure instead TARGET := '$TARGET' @@ -160,7 +160,7 @@ HOSTNAME=`hostname` DATE=`date +"%d.%m.%Y %H:%M:%S %Z"` cat > config.h <<EOF -/* +/* * rharchive config header * * this file was created automatically |