diff --git a/GNUmakefile b/GNUmakefile index 4d78581..8921dea 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -30,8 +30,9 @@ CFLAGS += -mno-cygwin LDFLAGS += -mno-cygwin BIN_EXT ?= .exe else -UHUB_CONF_DIR ?= /etc/uhub -UHUB_PREFIX ?= /usr/local +DESTDIR ?= / +UHUB_CONF_DIR ?= $(DESTDIR)/etc/uhub +UHUB_PREFIX ?= $(DESTDIR)/usr/ CFLAGS += -I/usr/local/include LDFLAGS += -L/usr/local/lib BIN_EXT ?= @@ -251,7 +252,7 @@ install: $(uhub_BINARY) @if [ ! -d $(UHUB_CONF_DIR) ]; then echo Creating $(UHUB_CONF_DIR); mkdir -p $(UHUB_CONF_DIR); fi @if [ ! -f $(UHUB_CONF_DIR)/uhub.conf ]; then cp doc/uhub.conf $(UHUB_CONF_DIR); fi @if [ ! -f $(UHUB_CONF_DIR)/users.conf ]; then cp doc/users.conf $(UHUB_CONF_DIR); fi - @touch $(UHUB_CONF_DIR)/motd + @touch $(UHUB_CONF_DIR)/motd.txt @echo done. endif diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..ad1af2e --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +uhub (0.2.6-1) unstable; urgency=low + + * Initial release (Closes: #nnnn) + + -- Jan Vidar Krey Tue, 17 Mar 2009 00:38:12 +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/conffiles b/debian/conffiles new file mode 100644 index 0000000..45da062 --- /dev/null +++ b/debian/conffiles @@ -0,0 +1,3 @@ +etc/uhub/uhub.conf +etc/uhub/users.conf +etc/uhub/motd.txt diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..b3428f4 --- /dev/null +++ b/debian/control @@ -0,0 +1,15 @@ +Source: uhub +Section: net +Priority: extra +Maintainer: Jan Vidar Krey +Build-Depends: debhelper (>= 7) +Standards-Version: 3.8.1 +Homepage: http://www.extatic.org/uhub/ + +Package: uhub +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: 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. + uHub uses the ADC protocol, and is compatible with DC++, jUCy and other ADC clients. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..7a61bf5 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,9 @@ +Copyright: + + Copyright (C) 2008-2009 Jan Vidar Krey + +License: + +Licensed under the GPL version 3, +see `/usr/share/common-licenses/GPL-3'. + diff --git a/debian/dirs b/debian/dirs new file mode 100644 index 0000000..e772481 --- /dev/null +++ b/debian/dirs @@ -0,0 +1 @@ +usr/bin diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..f714b73 --- /dev/null +++ b/debian/docs @@ -0,0 +1,3 @@ +BUGS +README +AUTHORS diff --git a/debian/files b/debian/files new file mode 100644 index 0000000..437d594 --- /dev/null +++ b/debian/files @@ -0,0 +1 @@ +uhub_0.2.6-1_amd64.deb net extra diff --git a/debian/init.d b/debian/init.d new file mode 100644 index 0000000..628ae89 --- /dev/null +++ b/debian/init.d @@ -0,0 +1,157 @@ +#! /bin/sh +# +# skeleton example file to build /etc/init.d/ scripts. +# This file should be used to construct scripts for /etc/init.d. +# +# Written by Miquel van Smoorenburg . +# Modified for Debian +# by Ian Murdock . +# Further changes by Javier Fernandez-Sanguino +# +# Version: @(#)skeleton 1.9 26-Feb-2001 miquels@cistron.nl +# + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=/usr/bin/uhub +NAME=uhub +DESC=uhub + +test -x $DAEMON || exit 0 + +LOGDIR=/var/log/uhub +PIDFILE=/var/run/$NAME.pid +DODTIME=1 # Time to wait for the server to die, in seconds + # If this value is set too low you might not + # let some servers to die gracefully and + # 'restart' will not work + +# Include uhub defaults if available +if [ -f /etc/default/uhub ] ; then + . /etc/default/uhub +fi + +set -e + +running_pid() +{ + # Check if a given process pid's cmdline matches a given name + pid=$1 + name=$2 + [ -z "$pid" ] && return 1 + [ ! -d /proc/$pid ] && return 1 + cmd=`cat /proc/$pid/cmdline | tr "\000" "\n"|head -n 1 |cut -d : -f 1` + # Is this the expected child? + [ "$cmd" != "$name" ] && return 1 + return 0 +} + +running() +{ +# Check if the process is running looking at /proc +# (works for all users) + + # No pidfile, probably no daemon present + [ ! -f "$PIDFILE" ] && return 1 + # Obtain the pid and check it against the binary name + pid=`cat $PIDFILE` + running_pid $pid $DAEMON || return 1 + return 0 +} + +force_stop() { +# Forcefully kill the process + [ ! -f "$PIDFILE" ] && return + if running ; then + kill -15 $pid + # Is it really dead? + [ -n "$DODTIME" ] && sleep "$DODTIME"s + if running ; then + kill -9 $pid + [ -n "$DODTIME" ] && sleep "$DODTIME"s + if running ; then + echo "Cannot kill $LABEL (pid=$pid)!" + exit 1 + fi + fi + fi + rm -f $PIDFILE + return 0 +} + +case "$1" in + start) + echo -n "Starting $DESC: " + start-stop-daemon --start --quiet --pidfile $PIDFILE \ + --exec $DAEMON -- $DAEMON_OPTS + if running ; then + echo "$NAME." + else + echo " ERROR." + fi + ;; + stop) + echo -n "Stopping $DESC: " + start-stop-daemon --stop --quiet --pidfile $PIDFILE \ + --exec $DAEMON + echo "$NAME." + ;; + force-stop) + echo -n "Forcefully stopping $DESC: " + force_stop + if ! running ; then + echo "$NAME." + else + echo " ERROR." + fi + ;; + reload) + # + # If the daemon can reload its config files on the fly + # for example by sending it SIGHUP, do it here. + # + # If the daemon responds to changes in its config file + # directly anyway, make this a do-nothing entry. + # + echo "Reloading $DESC configuration files." + start-stop-daemon --stop --signal 1 --quiet --pidfile \ + /var/run/$NAME.pid --exec $DAEMON + #;; + force-reload) + # + # If the "reload" option is implemented, move the "force-reload" + # option to the "reload" entry above. If not, "force-reload" is + # just the same as "restart" except that it does nothing if the + # daemon isn't already running. + # check wether $DAEMON is running. If so, restart + start-stop-daemon --stop --test --quiet --pidfile \ + /var/run/$NAME.pid --exec $DAEMON \ + && $0 restart \ + || exit 0 + ;; + restart) + echo -n "Restarting $DESC: " + start-stop-daemon --stop --quiet --pidfile \ + /var/run/$NAME.pid --exec $DAEMON + [ -n "$DODTIME" ] && sleep $DODTIME + start-stop-daemon --start --quiet --pidfile \ + /var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS + echo "$NAME." + ;; + status) + echo -n "$LABEL is " + if running ; then + echo "running" + else + echo " not running." + exit 1 + fi + ;; + *) + N=/etc/init.d/$NAME + # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 + echo "Usage: $N {start|stop|restart|force-reload|status|force-stop}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 0000000..8c64049 --- /dev/null +++ b/debian/postinst @@ -0,0 +1,39 @@ +#!/bin/sh +# postinst script for uhub +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-remove' +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + configure) + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/debian/postrm b/debian/postrm new file mode 100644 index 0000000..93737af --- /dev/null +++ b/debian/postrm @@ -0,0 +1,37 @@ +#!/bin/sh +# postrm script for uhub +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/debian/preinst b/debian/preinst new file mode 100644 index 0000000..f8559dd --- /dev/null +++ b/debian/preinst @@ -0,0 +1,35 @@ +#!/bin/sh +# preinst script for uhub +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `install' +# * `install' +# * `upgrade' +# * `abort-upgrade' +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + install|upgrade) + ;; + + abort-upgrade) + ;; + + *) + echo "preinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/debian/prerm b/debian/prerm new file mode 100644 index 0000000..f0a8219 --- /dev/null +++ b/debian/prerm @@ -0,0 +1,38 @@ +#!/bin/sh +# prerm script for uhub +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `upgrade' +# * `failed-upgrade' +# * `remove' `in-favour' +# * `deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + remove|upgrade|deconfigure) + ;; + + failed-upgrade) + ;; + + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..65ff9a9 --- /dev/null +++ b/debian/rules @@ -0,0 +1,91 @@ +#!/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 + # Add here commands to configure the package. + + touch configure-stamp + + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + + # Add here commands to compile the package. + $(MAKE) + #docbook-to-man debian/uhub.sgml > uhub.1 + + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + $(MAKE) clean + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_prep + dh_installdirs + + # Add here commands to install the package into debian/uhub. + $(MAKE) DESTDIR=$(CURDIR)/debian/uhub 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_installchangelogs ChangeLog + dh_installdocs + dh_installexamples +# dh_install +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_python +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman + dh_link + dh_strip + dh_compress + dh_fixperms +# dh_perl +# dh_makeshlibs + 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/debian/uhub.default b/debian/uhub.default new file mode 100644 index 0000000..828c5cd --- /dev/null +++ b/debian/uhub.default @@ -0,0 +1,10 @@ +# Defaults for uhub initscript +# sourced by /etc/init.d/uhub +# installed at /etc/default/uhub by the maintainer scripts + +# Additional options that are passed to the Daemon. +ENABLED=1 +LOGFILE="/var/log/uhug.log" +USER=nobody +GROUP=nogroup +DAEMON_OPTS="-f -l ${LOGFILE} -u ${USER} -g {GROUP}"