From 4b64b2877785fd4027cee178e695c8d362e8642d Mon Sep 17 00:00:00 2001 From: Jan Vidar Krey Date: Tue, 26 Jan 2010 17:00:55 +0100 Subject: [PATCH] Added proper debian package scripts. --- debian/changelog | 13 +++++++ debian/compat | 1 + debian/control | 24 ++++++++++++ debian/copyright | 19 +++++++++ debian/rules | 45 +++++++++++++++++++++ debian/uhub.default | 4 ++ debian/uhub.dirs | 6 +++ debian/uhub.docs | 5 +++ debian/uhub.init | 91 +++++++++++++++++++++++++++++++++++++++++++ debian/uhub.logrotate | 9 +++++ debian/uhub.manpages | 1 + debian/uhub.postinst | 28 +++++++++++++ debian/uhub.postrm | 6 +++ debian/uhub.prerm | 10 +++++ 14 files changed, 262 insertions(+) create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100755 debian/rules create mode 100644 debian/uhub.default create mode 100644 debian/uhub.dirs create mode 100644 debian/uhub.docs create mode 100644 debian/uhub.init create mode 100644 debian/uhub.logrotate create mode 100644 debian/uhub.manpages create mode 100644 debian/uhub.postinst create mode 100644 debian/uhub.postrm create mode 100644 debian/uhub.prerm diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..3a8d76e --- /dev/null +++ b/debian/changelog @@ -0,0 +1,13 @@ +uhub (0.3.0-2) unstable; urgency=low + + * Fixed init.d scripts. + * Fixed lintian warnings. + + -- Jan Vidar Krey Tue, 26 Jan 2010 19:02:02 +0100 + +uhub (0.3.0-1) unstable; urgency=low + + * Initial Release. + + -- Jan Vidar Krey Tue, 26 Jan 2010 18:59:02 +0100 + diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +7 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..b029fa1 --- /dev/null +++ b/debian/control @@ -0,0 +1,24 @@ +Source: uhub +Section: net +Priority: optional +Maintainer: Jan Vidar Krey +Build-Depends: debhelper (>= 7.0.0) +Standards-Version: 3.8.3.0 + +Package: uhub +Architecture: any +Depends: ${shlibs:Depends} +Description: High performance ADC p2p hub + uhub is a high performance peer-to-peer hub for the ADC network. + Its low memory footprint allows it to handle several thousand users on + high-end servers, or a small private hub on embedded hardware. + . + Key features: + - High performance and low memory usage + - IPv4 and IPv6 support + - Experimental SSL support (optional) + - Advanced access control support + - Easy configuration + . +Homepage: http://www.uhub.org/ + diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..337fbf9 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,19 @@ +uhub - High performance ADC p2p hub. +Copyright (C) 2010 Jan Vidar Krey + +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 program. If not, see . + +On Debian GNU/Linux systems, the complete text of the GNU General Public +License can be found in `/usr/share/common-licenses/GPL'. + diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..151de37 --- /dev/null +++ b/debian/rules @@ -0,0 +1,45 @@ +#!/usr/bin/make -f + +# export DH_VERBOSE=1 + +makeopts := DESTDIR=$(shell pwd)/debian/uhub/ \ + UHUB_PREFIX=$(shell pwd)/debian/uhub/usr \ + RELEASE=YES SILENT=YES + +build: build-stamp +build-stamp: + dh_testdir + make $(makeopts) + touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp + make clean + dh_clean + +binary-indep: build + +binary-arch: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + $(MAKE) install $(makeopts) + dh_installdocs + dh_installinit + dh_installlogrotate + dh_installman -A + dh_installchangelogs ChangeLog + dh_strip + dh_compress + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary + diff --git a/debian/uhub.default b/debian/uhub.default new file mode 100644 index 0000000..efe90a6 --- /dev/null +++ b/debian/uhub.default @@ -0,0 +1,4 @@ +# uhub - high performance adc hub. + +UHUB_ENABLE=0 + diff --git a/debian/uhub.dirs b/debian/uhub.dirs new file mode 100644 index 0000000..84accea --- /dev/null +++ b/debian/uhub.dirs @@ -0,0 +1,6 @@ +etc/default +etc/init.d +etc/logrotate.d +etc/uhub +usr/bin +var/log/uhub diff --git a/debian/uhub.docs b/debian/uhub.docs new file mode 100644 index 0000000..8a6c81c --- /dev/null +++ b/debian/uhub.docs @@ -0,0 +1,5 @@ +AUTHORS +README +BUGS +TODO +doc/getstarted.txt diff --git a/debian/uhub.init b/debian/uhub.init new file mode 100644 index 0000000..8996f32 --- /dev/null +++ b/debian/uhub.init @@ -0,0 +1,91 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: uhub +# Required-Start: $remote_fs $network +# Required-Stop: $remote_fs $network +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: uhub - High performance ADC p2p hub. +### END INIT INFO + +PATH=/sbin:/bin:/usr/sbin:/usr/bin + +NAME=uhub +DESC="ADC hub" +DAEMON=/usr/bin/uhub +PIDFILE=/var/run/uhub/uhub.pid +LOGFILE=/var/log/uhub/uhub.log +SCRIPTNAME=/etc/init.d/uhub + +DEFAULTFILE=/etc/default/uhub +[ -r $DEFAULTFILE ] && . $DEFAULTFILE + +DAEMON_ENABLE="${UHUB_ENABLE}" +DAEMON_OPTS="-l ${LOGFILE} -f -p ${PIDFILE}" + +test -x $DAEMON || exit 0 + +. /lib/lsb/init-functions + +ulimit -n 65536 + +set -e + +case "$1" in + start) + if [ "$DAEMON_ENABLE" != "true" ]; then + log_daemon_msg "Disabled $DESC" $NAME + log_end_msg 0 + exit 0 + fi + + log_daemon_msg "Starting $DESC" $NAME + if ! start-stop-daemon --start --quiet --oknodo \ + --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS + then + log_end_msg 1 + else + log_end_msg 0 + fi + ;; + + stop) + log_daemon_msg "Stopping $DESC" $NAME + if start-stop-daemon --quiet --stop --oknodo --retry 30 --oknodo \ + --pidfile $PIDFILE --exec $DAEMON + then + rm -f $PIDFILE + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + + reload) + log_daemon_msg "Reloading $DESC configuration" $NAME + if start-stop-daemon --stop --signal 2 --oknodo --retry 30 --oknodo \ + --quiet --pidfile $PIDFILE --exec $DAEMON + then + if start-stop-daemon --start --quiet \ + --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS ; then + log_end_msg 0 + else + log_end_msg 1 + fi + else + log_end_msg 1 + fi + ;; + + restart|force-reload) + $0 stop + $0 start + ;; + + *) + echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/debian/uhub.logrotate b/debian/uhub.logrotate new file mode 100644 index 0000000..8e8820e --- /dev/null +++ b/debian/uhub.logrotate @@ -0,0 +1,9 @@ +/var/log/uhub/*.log +{ + compress + size 10M + rotate 10 + missingok + notifempty +} + diff --git a/debian/uhub.manpages b/debian/uhub.manpages new file mode 100644 index 0000000..60d9bd4 --- /dev/null +++ b/debian/uhub.manpages @@ -0,0 +1 @@ +doc/uhub.1 diff --git a/debian/uhub.postinst b/debian/uhub.postinst new file mode 100644 index 0000000..85d544b --- /dev/null +++ b/debian/uhub.postinst @@ -0,0 +1,28 @@ +#!/bin/sh +set -e + +case "$1" in + configure) + chmod 0750 /var/log/uhub + chmod 0755 /var/run/uhub + + if [ -x /etc/init.d/uhub ]; then + update-rc.d uhub defaults >/dev/null + + if [ -x /usr/sbin/invoke-rc.d ]; then + invoke-rc.d uhub restart + else + /etc/init.d/uhub restart + fi + fi + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst: error: unknown argument: $1" >&2 + exit 1 + ;; +esac + diff --git a/debian/uhub.postrm b/debian/uhub.postrm new file mode 100644 index 0000000..9373984 --- /dev/null +++ b/debian/uhub.postrm @@ -0,0 +1,6 @@ +#!/bin/sh -e + +if [ "$1" = purge ]; then + update-rc.d uhub remove >/dev/null +fi + diff --git a/debian/uhub.prerm b/debian/uhub.prerm new file mode 100644 index 0000000..12ec82c --- /dev/null +++ b/debian/uhub.prerm @@ -0,0 +1,10 @@ +#!/bin/sh -e + +if [ "$1" = remove ]; then + if command -v invoke-rc.d >/dev/null 2>&1; then + invoke-rc.d uhub stop || true + else + /etc/init.d/uhub stop + fi +fi +