Hi,

> Patch attached.

Updated patch attached. I forgot that /var/run gets cleaned every boot.


Regards,

-- 
Chris Lamb, UK                                       [EMAIL PROTECTED]
                                                            GPG: 0x634F9A20
diff -urNad opendchub-0.7.15.orig/debian/config.default 
opendchub-0.7.15/debian/config.default
--- opendchub-0.7.15.orig/debian/config.default 1970-01-01 01:00:00.000000000 
+0100
+++ opendchub-0.7.15/debian/config.default      2008-07-31 18:01:39.000000000 
+0100
@@ -0,0 +1,62 @@
+hub_name = "Open DC Hub"
+
+max_users = 1000
+
+hub_full_mess = "Sorry, this hub is full at the moment"
+
+hub_description = "A Unix/Linux Direct Connect Hub"
+
+min_share = 0
+
+admin_pass = "admin_pass"
+
+default_pass = ""
+
+link_pass = "link_pass"
+
+users_per_fork = 1000
+
+listening_port = 411
+
+admin_port = 53696
+
+admin_localhost = 0
+
+hublist_upload = 1
+
+public_hub_host = "vandel405.dynip.com"
+
+hub_hostname = "127.0.1.1"
+
+min_version = ""
+
+redirect_host = ""
+
+registered_only = 0
+
+check_key = 0
+
+reverse_dns = 0
+
+ban_overrides_allow = 0
+
+verbosity = 4
+
+redir_on_min_share = 1
+
+syslog_enable = 0
+
+searchcheck_exclude_internal = 1
+
+searchcheck_exclude_all = 0
+
+kick_bantime = 5
+
+searchspam_time = 5
+
+max_email_len = 50
+
+max_desc_len = 100
+
+crypt_enable = 1
+
diff -urNad opendchub-0.7.15.orig/debian/control opendchub-0.7.15/debian/control
--- opendchub-0.7.15.orig/debian/control        2008-07-31 18:01:18.000000000 
+0100
+++ opendchub-0.7.15/debian/control     2008-07-31 18:01:39.000000000 +0100
@@ -7,7 +7,7 @@
 
 Package: opendchub
 Architecture: any
-Depends: ${shlibs:Depends}
+Depends: ${shlibs:Depends}, adduser
 Description: hub clone for DC (Direct Connect P2P network)
  Open DC hub is a Unix/Linux version of the hub software for the Direct
  Connect network.  Direct Connect is a file sharing network made up by
diff -urNad opendchub-0.7.15.orig/debian/init opendchub-0.7.15/debian/init
--- opendchub-0.7.15.orig/debian/init   1970-01-01 01:00:00.000000000 +0100
+++ opendchub-0.7.15/debian/init        2008-07-31 18:01:39.000000000 +0100
@@ -0,0 +1,58 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides:          opendchub
+# Required-Start:    $remote_fs $syslog
+# Required-Stop:     $remote_fs $syslog
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Init script for opendchub DC++ server
+### END INIT INFO
+
+ACTION="${1}"
+
+NAME="opendchub"
+DESC="DC++ server"
+LOGFILE="/var/log/opendchub"
+BINARY="/usr/bin/opendchub"
+USERGROUP="odchub"
+
+test -x ${BINARY} || exit 0
+
+. /lib/lsb/init-functions
+
+case "${ACTION}" in
+       start)
+
+               log_daemon_msg "Starting ${DESC}" ${NAME}
+               if start-stop-daemon --start --oknodo --exec ${BINARY} -- \
+                       -u ${USERGROUP} -g ${USERGROUP} 2>&1 >> ${LOGFILE}
+               then
+                       log_end_msg 0
+               else
+                       log_end_msg 1
+                       exit 1
+               fi
+               ;;
+       stop)
+               log_daemon_msg "Stopping ${DESC}" ${NAME}
+               if start-stop-daemon --stop -q --oknodo \
+                       --retry 10 --exec ${BINARY} 2>&1 >> ${LOGFILE}
+               then
+                       log_end_msg 0
+               else
+                       log_end_msg 1
+                       exit 1
+               fi
+               ;;
+       restart|force-reload)
+               ${0} stop
+               sleep 1
+               ${0} start
+               ;;
+       *)
+               echo "Usage: /etc/init.d/${NAME} 
{start|stop|restart|force-reload}"
+               exit 1
+               ;;
+esac
+
+exit 0
diff -urNad opendchub-0.7.15.orig/debian/motd.default 
opendchub-0.7.15/debian/motd.default
--- opendchub-0.7.15.orig/debian/motd.default   1970-01-01 01:00:00.000000000 
+0100
+++ opendchub-0.7.15/debian/motd.default        2008-07-31 18:01:39.000000000 
+0100
@@ -0,0 +1,3 @@
+Welcome to the hub. Enjoy your stay.
+
+This hub is powered by Debian GNU/Linux.
diff -urNad opendchub-0.7.15.orig/debian/postinst 
opendchub-0.7.15/debian/postinst
--- opendchub-0.7.15.orig/debian/postinst       1970-01-01 01:00:00.000000000 
+0100
+++ opendchub-0.7.15/debian/postinst    2008-07-31 18:03:01.000000000 +0100
@@ -0,0 +1,88 @@
+#!/bin/sh
+
+set -e
+
+USERGROUP="odchub"
+OPENDC_TEMP="tmp"
+
+LOGFILE="/var/log/opendchub"
+HOMEDIR="/var/lib/opendchub/homedir"
+RUNDIR="/var/lib/opendchub/rundir"
+
+User () {
+       # Create opendchub user and group
+       if ! getent passwd ${USERGROUP} >/dev/null; then
+               adduser --quiet --system --group --no-create-home \
+                   --home ${HOMEDIR} ${USERGROUP}
+       fi
+}
+
+Config() {
+       # Configure permissions on conffiles - the opendchub daemon needs to
+       # write back to the file and they contain passwords.
+       for FILE in config motd
+       do
+               if ! dpkg-statoverride --list --quiet /etc/opendchub/${FILE} 
>/dev/null
+               then
+                       dpkg-statoverride --force --quiet --update \
+                           --add root ${USERGROUP} 0660 /etc/opendchub/${FILE}
+               fi
+       done
+
+       # Generate sensible passwords in place of the defaults. This should only
+       # happen on first installation.
+       sed -i -e "s/admin_pass = \"admin_pass\"/admin_pass = \"$(pwgen -s 
15)\"/g" \
+               -e "s/link_pass = \"link_pass\"/link_pass = \"$(pwgen -s 
15)\"/g" \
+               /etc/opendchub/config
+}
+
+Logfile () {
+       if [ ! -e ${LOGFILE} ]
+       then
+               touch ${LOGFILE}
+       fi
+
+       chown ${USERGROUP}:${USERGROUP} ${LOGFILE}
+}
+
+Rundir () {
+       mkdir -p ${RUNDIR}
+       chown ${USERGROUP}:${USERGROUP} ${RUNDIR}
+}
+
+Homedir () {
+       # Create and populate the false home directory. We do this because the
+       # opendchub daemon insists on reading from ~/.opendchub/foo and the
+       # "working directory" switch is broken.
+
+       rm -rf ${HOMEDIR}
+       mkdir -p ${HOMEDIR}
+
+       # Ensure config files are not hidden behind a dotfile
+       ln -s ${HOMEDIR} "${HOMEDIR}/.opendchub"
+
+       ln -s ${LOGFILE} "${HOMEDIR}/log"
+       ln -s ${RUNDIR} "${HOMEDIR}/${OPENDC_TEMP}"
+
+       # Configure configuration files
+       for FILE in config motd
+       do
+               ln -s /etc/opendchub/${FILE} ${HOMEDIR}/${FILE}
+       done
+
+       # Configure run-time files. The "1" variants are used by the daemon as
+       # temporary files.
+       for FILE in allowlist banlist linklist nickbanlist odchlist op_permlist 
reglist
+       do
+               ln -s ${RUNDIR}/${FILE} ${HOMEDIR}/${FILE}
+               ln -s ${RUNDIR}/${FILE}1 ${HOMEDIR}/${FILE}1
+       done
+}
+
+User
+Config
+Logfile
+Rundir
+Homedir
+
+#DEBHELPER#
diff -urNad opendchub-0.7.15.orig/debian/postrm opendchub-0.7.15/debian/postrm
--- opendchub-0.7.15.orig/debian/postrm 1970-01-01 01:00:00.000000000 +0100
+++ opendchub-0.7.15/debian/postrm      2008-07-31 18:02:08.000000000 +0100
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+set -e
+
+#DEBHELPER#
+
+if [ "$1" = "purge" ]; then
+       for FILE in config motd
+       do
+               if dpkg-statoverride --list --quiet /etc/opendchub/${FILE} 
>/dev/null
+               then
+                       dpkg-statoverride --force --quiet --remove 
/etc/opendchub/${FILE}
+               fi
+       done
+
+       deluser --system --quiet odchub || true
+
+       rm -rf /etc/opendchub
+       rm -rf /var/lib/opendchub
+fi
diff -urNad opendchub-0.7.15.orig/debian/rules opendchub-0.7.15/debian/rules
--- opendchub-0.7.15.orig/debian/rules  2008-07-31 18:01:18.000000000 +0100
+++ opendchub-0.7.15/debian/rules       2008-07-31 18:01:39.000000000 +0100
@@ -16,5 +16,10 @@
                ( touch config.h.in && touch stamp-h1 && touch config.h && \
                touch debian/stamp-configure-opendchub )
 
+install/opendchub::
+       mkdir -p $(DEB_DESTDIR)/etc/opendchub
+       cp debian/config.default $(DEB_DESTDIR)/etc/opendchub/config
+       cp debian/motd.default $(DEB_DESTDIR)/etc/opendchub/motd
+
 clean::
        rm -f debian/stamp-configure-opendchub

Attachment: signature.asc
Description: PGP signature

Reply via email to