--- ample-0.5.7.orig/debian/postrm
+++ ample-0.5.7/debian/postrm
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+    purge|remove|upgrade|abort-upgrade|failed-upgrade|abort-install|disapper)
+    ;;
+
+    *)
+        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
--- ample-0.5.7.orig/debian/copyright
+++ ample-0.5.7/debian/copyright
@@ -0,0 +1,26 @@
+This package was debianized by Samuele Giovanni Tonon <samu@debian.org> on
+Wed,  6 Aug 2003 10:09:29 +0200.
+
+It was downloaded from http://ample.sourceforge.net
+
+Upstream Author: David Härdeman <david@2gen.com>
+
+Copyright  2002, 2003 David Hardeman:
+
+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 2 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 with
+the Debian GNU/Linux distribution in file /usr/share/common-licenses/GPL;
+if not, write to the Free Software Foundation, Inc., 51 Franklin Street,
+Fifth Floor, Boston, MA 02110-1301, USA
+
+On Debian systems, the complete text of the GNU General Public
+License, version 2, can be found in /usr/share/common-licenses/GPL-2.
--- ample-0.5.7.orig/debian/ample.default
+++ ample-0.5.7/debian/ample.default
@@ -0,0 +1,13 @@
+# Defaults for ample initscript
+# sourced by /etc/init.d/ample
+
+# Ample should start by default
+STARTAMPLE="no"
+
+# ample could run as any UID
+# by default nobody:nogroup is choose 
+# please remember to change the permission 
+# of /var/run/ample if you wish to change this
+DEFUSER="nobody"
+DEFGROUP="nogroup"
+
--- ample-0.5.7.orig/debian/changelog
+++ ample-0.5.7/debian/changelog
@@ -0,0 +1,134 @@
+ample (0.5.7-7.4.201403120902) ucs4-0-0-0; urgency=low
+
+  * UCS auto build. No patches were applied to the original source package
+
+ -- Univention builddaemon <buildd@univention.de>  Wed, 12 Mar 2014 09:02:32 +0100
+
+ample (0.5.7-7) unstable; urgency=low
+
+  * QA upload.
+  * Move pidfile to /var/run/ample.pid (Closes: #689769)
+  * Drop privileges in ample, not with start-stop-daemon, so that pidfile can
+    be created without being owned by nobody:nogroup.
+
+ -- Michael Stapelberg <stapelberg@debian.org>  Tue, 04 Dec 2012 22:05:44 +0100
+
+ample (0.5.7-6.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Create /var/run/ample at startup, Thanks to Thomas Goirand for the patch.
+    (Closes: #689769)
+  * Depend on $remote_fs in init script.
+
+ -- Ulrich Dangel <uli@debian.org>  Sat, 03 Nov 2012 13:53:23 +0000
+
+ample (0.5.7-6) unstable; urgency=low
+
+  * debian/postrm 
+    + remove /var/run/ample just at remove/purge.
+    + delete /var/run/ample dpkg-statoverride entry if exists.
+  * Delete changes made it directly to .diff.gz, this changes was introduced
+    to clean some warnings for unused variables.
+  * debian/postinst
+    + don't override ownership of /var/run/ample if it has a
+      dpkg-statoverride entry.
+    + add 'set -e' 
+    + create /var/run/ample at configure since previous postrm remove the dir
+      even on upgrade.
+  * debian/rules - use -R option at dh_installinit to minimize the downtime on
+    upgrades.
+  * add_pidfile_option.patch 
+    + use EXIT_SUCESS with exit() 
+    + Don't require arguments at do_pidfile
+    + Improve help output.
+    + check for errors in do_pidfile
+    + merge with add_i_pidfile_option.patch
+  * debian/copyright - add umlaut to upstream's name
+  * debian/init.d - remove $RETEVAL Workaround 
+  * debian/NEWS.Debian - Improve wording 
+
+ -- Rene Mayorga <rmayorga@debian.org.sv>  Tue, 30 Sep 2008 20:45:49 -0400
+
+ample (0.5.7-5) unstable; urgency=low
+
+  * Don't ignore errors when building SUBDIRS 
+    Thanks goes to Martin Koeppe (Closes: #488204)
+    + makefile_build_subdirs.patch added
+  * set standard-versions to 3.8.0
+    + add README.source
+    + Promote Homepage pseudo field to a source field
+  * set debhelper compat level to 7
+  * Add ${misc:Depends} to Depends field
+  * Remove noopt catch from debian/rules, dpkg-buildpackage can 
+    do the job
+  * Cosmetical changes to debian/rules
+  * Split changes from .diff.gz
+    + add makefile_debian_location.path
+  * Add a small patch to correct minus as hyphen at ample.conf.5
+    + hyphen_as_minus.patch
+  * Install an example config file at /etc/ample/ample.conf;
+    install init.d script, and /etc/default/ample
+    also include  add_pidfile_option.patch to add -i option
+    to write a pidfile. (Closes: #456002)
+  * add NEWS.Debian; noting about the add of -i option
+  * Remove README.Debian - most info is included in NEWS.Debian
+  * add_i_option_to_manpage.patch added
+
+ -- Rene Mayorga <rmayorga@debian.org.sv>  Fri, 27 Jun 2008 10:05:39 -0600
+
+ample (0.5.7-4) unstable; urgency=low
+
+  * Changing libwrap-dev to libwrap0-dev on Build-Depends (Closes: #436311)
+
+ -- Rene Mayorga <rmayorga@debian.org.sv>  Mon, 06 Aug 2007 20:05:20 -0600
+
+ample (0.5.7-3) unstable; urgency=low
+
+  * New Maintainer  (Closes: #424710)
+  * Updated to the policy standards version 3.7.2
+    debian/copyright updated to the new FSF address
+    debian/watch added
+    Added Homepage to long description
+    debian/control updated
+
+ -- Rene Mayorga <rmayorga@debian.org.sv>  Tue, 22 May 2007 16:51:56 -0600
+
+ample (0.5.7-2) unstable; urgency=low
+
+  * Fixed up copyright file as pointed out by Peter Palfrader on 
+    debian-devel-announce
+
+ -- Samuele Giovanni Tonon <samu@debian.org>  Wed, 17 Dec 2003 12:48:50 +0100
+
+ample (0.5.7-1) unstable; urgency=medium
+
+  * New Upstream Release with *SECURITY* fixes
+  * Fixed a buffer overflow maybe locally exploitable; David told me:
+    "The overflow is not very serious due to two facts:
+    1) No data is actually written, but the buffer contents is copied until
+    NULL is found meaning that huge amounts of memory may be allocated
+    2) The socket which the malicious data must enter trough is bound to the
+    loopback interface so it should only be locally exploitable"
+
+ -- Samuele Giovanni Tonon <samu@debian.org>  Wed, 26 Nov 2003 22:03:50 +0100
+
+ample (0.5.6-3) unstable; urgency=low
+
+  * Fixed rules file to make man pages with correct path
+
+ -- Samuele Giovanni Tonon <samu@debian.org>  Thu, 28 Aug 2003 15:41:22 +0200
+
+ample (0.5.6-2) unstable; urgency=low
+
+  * Modified control file
+
+ -- Samuele Giovanni Tonon <samu@debian.org>  Tue, 19 Aug 2003 15:47:34 +0200
+
+ample (0.5.6-1) unstable; urgency=low
+
+  * Initial Release.
+  * Modified Makefile.in to make target distclean available
+  * Modified logfile from ample.conf to ample.log
+
+ -- Samuele Giovanni Tonon <samu@debian.org>  Wed,  6 Aug 2003 10:09:29 +0200
+
--- ample-0.5.7.orig/debian/compat
+++ ample-0.5.7/debian/compat
@@ -0,0 +1 @@
+7
--- ample-0.5.7.orig/debian/init.d
+++ ample-0.5.7/debian/init.d
@@ -0,0 +1,109 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides:          ample
+# Required-Start:    $remote_fs $network
+# Required-Stop:     $remote_fs
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Ample MP3 server
+# Description:       Simple MP3 Server
+#
+### END INIT INFO
+
+# Author: Rene Mayorga <rmayorga@debian.org.sv>
+#
+
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+DESC="AMPLE mp3 server"
+NAME=ample
+DAEMON=/usr/bin/$NAME
+DAEMON_ARGS="-c /etc/ample/ample.conf -i /var/run/$NAME.pid"
+PIDFILE=/var/run/$NAME.pid
+SCRIPTNAME=/etc/init.d/$NAME
+
+# Exit if the package is not installed
+[ -x "$DAEMON" ] || exit 0
+
+# Read configuration variable file if it is present
+[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+
+if [ -z "$STARTAMPLE" ] ; then
+	exit 0
+fi
+
+if [ "$STARTAMPLE" != "no" ] ; then
+	STARTAMPLE=yes
+fi
+
+if [ "$DEFUSER" -a "$DEFGROUP" ] ; then
+	DAEMON_ARGS="$DAEMON_ARGS -u $DEFUSER -g $DEFGROUP"
+fi
+
+test "$STARTAMPLE" = yes || exit 0
+
+. /lib/lsb/init-functions
+
+do_start()
+{
+	# Return
+	#   0 if daemon has been started
+	#   1 if daemon was already running
+	#   2 if daemon could not be started
+	start-stop-daemon --start --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
+		|| return 1
+	start-stop-daemon --start --pidfile $PIDFILE --exec $DAEMON -- \
+		$DAEMON_ARGS \
+		|| return 2
+}
+
+do_stop()
+{
+	start-stop-daemon --stop --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME \
+		|| return 1
+}
+
+do_reload() {
+	start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
+	return 0
+}
+
+case "$1" in
+  start)
+	[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
+	do_start
+	case "$?" in
+		0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+		2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+	esac
+	;;
+  stop)
+	[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+	do_stop
+	case "$?" in
+		0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+		2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+	esac
+	;;
+  restart|force-reload)
+	log_daemon_msg "Restarting $DESC" "$NAME"
+	do_stop
+	case "$?" in
+	  0|1)
+		do_start
+		case "$?" in
+			0) log_end_msg 0 ;;
+			1) log_end_msg 1 ;; # Old process is still running
+			*) log_end_msg 1 ;; # Failed to start
+		esac
+		;;
+	  *)
+	  	# Failed to stop
+		log_end_msg 1
+		;;
+	esac
+	;;
+  *)
+	echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
+	exit 3
+	;;
+esac
--- ample-0.5.7.orig/debian/ample.conf
+++ ample-0.5.7/debian/ample.conf
@@ -0,0 +1,44 @@
+# An example of Ample config file
+#
+
+# Port number to use
+port = 1234
+
+# Should files be ordered when playing a mixed stream?
+order = false
+
+# Amount of simaltaneous client allowed
+clients = 5
+
+# Path to logile if syslog isn't used
+#logfile /var/log/ample.log
+
+# Path(s) to MP3 dir/files or M3U file
+
+#Add your MP3 path here
+#mp3path = /usr/share/mp3
+
+#mp3path = /home/moremp3
+#mp3path = /home/favourites.m3u
+
+# Path to the HTML file to use as a template
+#htmlfile = /home/ample.html
+
+
+# Should the MP3 dir(s) be recursively scanned?
+recursive = true
+
+# Name of the server
+# (displayed to clients here and there)
+#serveraddress = 192.168.0.1
+
+
+# Username and password, if these are specified, Ample
+# will automatically ask for username/password
+#username = MusicLover
+#password = Pekaboo
+
+
+# Filter to pass each music file through
+# (before they are sent to the client)
+# filter = /usr/bin/lame -b64 --quiet "@FPATH@" -
--- ample-0.5.7.orig/debian/rules
+++ ample-0.5.7/debian/rules
@@ -0,0 +1,77 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper.
+# GNU copyright 1997 to 1999 by Joey Hess.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+
+DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+
+include /usr/share/quilt/quilt.make
+
+CFLAGS = -Wall -g
+
+config.status: $(QUILT_STAMPFN)
+	dh_testdir
+ifneq "$(wildcard /usr/share/misc/config.sub)" ""
+	cp -f /usr/share/misc/config.sub config.sub
+endif
+ifneq "$(wildcard /usr/share/misc/config.guess)" ""
+	cp -f /usr/share/misc/config.guess config.guess
+endif
+	./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info --localstatedir=\$${prefix}/../var --sysconfdir=/etc/ample --enable-libwrap
+
+
+build: build-stamp
+
+build-stamp:  config.status
+	dh_testdir
+	$(MAKE)
+	touch $@
+
+clean: unpatch
+	dh_testdir
+	dh_testroot
+	dh_clean build-stamp 
+	[ ! -f Makefile ] || $(MAKE) dist-clean
+
+ifneq "$(wildcard /usr/share/misc/config.sub)" ""
+	rm -f config.sub
+endif
+ifneq "$(wildcard /usr/share/misc/config.guess)" ""
+	rm -f config.guess
+endif
+
+install: install-stamp
+install-stamp: build-stamp
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+	dh_installdirs
+	$(MAKE) install prefix=$(CURDIR)/debian/ample/usr sysconfdir=$(CURDIR)/debian/ample/etc/ample
+	touch $@
+
+
+binary-indep: build install
+# We have nothing to do by default.
+
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+	dh_install --sourcedir=$(CURDIR)/debian ample.conf etc/ample/
+	dh_installchangelogs ChangeLog
+	dh_installdocs
+	dh_installinit -R
+	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 
--- ample-0.5.7.orig/debian/README.source
+++ ample-0.5.7/debian/README.source
@@ -0,0 +1,3 @@
+This package uses quilt for managing patches.
+
+Cf. /usr/share/doc/quilt/README.source
--- ample-0.5.7.orig/debian/NEWS.Debian
+++ ample-0.5.7/debian/NEWS.Debian
@@ -0,0 +1,12 @@
+ample (0.5.7-5) unstable; urgency=low
+
+  Since 0.5.7-5 ample can write a PID file and run as a daemon for
+  unattended use. This is disabled by default, but an init script and
+  basic config file are included in the package. To enable daemon mode,
+  edit /etc/default/ample.
+
+  This release also adds the option -i, which writes a PID file in the
+  given directory - see ample(1).
+
+ -- Rene Mayorga <rmayorga@debian.org.sv>  Fri, 27 Jun 2008 10:05:39 -0600
+
--- ample-0.5.7.orig/debian/control
+++ ample-0.5.7/debian/control
@@ -0,0 +1,17 @@
+Source: ample
+Section: sound
+Priority: optional
+Maintainer: Debian QA Group <packages@qa.debian.org>
+Build-Depends: debhelper (>= 7), libwrap0-dev, quilt, lsb-base (>= 3.0-6)
+Standards-Version: 3.8.0
+Homepage: http://ample.sourceforge.net
+
+Package: ample
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: A simple MP3 server easy to use
+ Ample (An MP3 LEnder) is a simple MP3 server written in C. 
+ It does not support mixing, radio shows, etc. Ample is just 
+ intended to be an easy way to remotely listen to your MP3s 
+ using the "open location" features in XMMS, WinAmp, 
+ and Media Player.
--- ample-0.5.7.orig/debian/docs
+++ ample-0.5.7/debian/docs
@@ -0,0 +1,3 @@
+README
+TODO
+debian/NEWS.Debian
--- ample-0.5.7.orig/debian/ample.dirs
+++ ample-0.5.7/debian/ample.dirs
@@ -0,0 +1 @@
+etc/ample
--- ample-0.5.7.orig/debian/watch
+++ ample-0.5.7/debian/watch
@@ -0,0 +1,2 @@
+version=3
+http://sf.net/ample/ample-(.*)\.tar\.gz
--- ample-0.5.7.orig/debian/patches/add_pidfile_option.patch
+++ ample-0.5.7/debian/patches/add_pidfile_option.patch
@@ -0,0 +1,156 @@
+--- ample-0.5.7.orig/src/ample.c
++++ ample-0.5.7/src/ample.c
+@@ -241,6 +241,26 @@
+ 	return;
+ }
+ 
++/*
++ * Write a pidfile
++ * 
++ * Added by Debian Maintainer
++ *
++ */
++static int
++do_pidfile(void)
++{
++	FILE *f;
++	int pidnum;
++	pidnum = getpid();
++	f = fopen(gconf.pidfile, "w");
++	if (!f) {
++		return (1);
++	}
++	fprintf(f,"%d\n", pidnum);
++	fclose(f);
++	return(0);
++}
+ 
+ /*
+  * Checks if a file descriptor is a socket.
+@@ -292,6 +312,15 @@
+ 		die("fork");
+ }
+ 
++/* Remove pidfile when dies
++ * 
++ */
++static void
++removepidfile(void)
++{
++	unlink(gconf.pidfile);
++	exit(EXIT_SUCCESS);
++}
+ 
+ /*
+  * Prepares the proper way for ample to log messages.
+@@ -460,6 +489,18 @@
+ 	checkopt(argc, argv);	
+ 	gconf.inetd = issocket(0);
+ 	daemonize();
++
++	/* Added by Debian Maintainer */
++	if (gconf.pidfile) {
++		debug (1, "pidfile:%s \n", gconf.pidfile);
++		if (do_pidfile() != 0) {
++			debug(1, "could not write pidfile");
++			exit(1);
++		}
++
++	}
++	/**/
++
+ 	preparelog();
+ 	if(!gconf.inetd)
+ 		logmsg("Ample/%s started\n", AMPLE_VERSION);
+@@ -488,6 +529,12 @@
+ 	memset(&sa, 0, sizeof(sa));
+ 	sa.sa_handler = sigchild_handler;
+ 	sigaction(SIGCHLD, &sa, NULL);
++	
++	/* Added by the Debian Maintainer */
++	if (signal(SIGTERM, removepidfile) == SIG_ERR) {
++		debug(1, "err, I can't quit");
++	}
++	/**/
+ 	sigemptyset(&chld);
+ 	sigaddset(&chld, SIGCHLD);
+ 
+--- ample-0.5.7.orig/src/ample.h
++++ ample-0.5.7/src/ample.h
+@@ -36,6 +36,7 @@
+ 	char * servername;
+ 	char * serveraddress;
+ 	char * filter;
++	char * pidfile;
+ };
+ 
+ struct childstat {
+--- ample-0.5.7.orig/src/configuration.c
++++ ample-0.5.7/src/configuration.c
+@@ -621,6 +621,7 @@
+ 		{"servername", OPT_STRING, &gconf.servername},
+ 		{"serveraddress", OPT_STRING, &gconf.serveraddress},		
+ 		{"username", OPT_STRING, &gconf.username},
++		{"pidfile", OPT_STRING, &gconf.pidfile},
+ 		{NULL, 0, NULL}
+ 	};
+ 	
+@@ -674,13 +675,14 @@
+ 		{"debug", optional_argument, NULL, 'd'},
+ 		{"trace", no_argument, NULL, 't'},
+ 		{"version", no_argument, NULL, 'v'},
++		{"pidfile", no_argument, NULL, 'i'},
+ 		{NULL, 0, NULL, 0}
+ 	};
+ 
+-	while((c = getopt_long(argc, argv, "p:oc:nf:m:hd::tv", longopts, &i)) 
++	while((c = getopt_long(argc, argv, "p:oc:nf:m:hd::ti:v", longopts, &i)) 
+ 	      != -1) {
+ #else
+-	while((c = getopt(argc, argv, "p:oc:nf:m:hd::tv")) != -1) {
++	while((c = getopt(argc, argv, "p:oc:nf:m:hd::ti:v")) != -1) {
+ #endif
+ 		switch(c) {
+ 		case 'p':
+@@ -718,6 +720,9 @@
+ 		case 'v':
+ 			printf("Ample version %s\n", AMPLE_VERSION);
+ 			exit(0);
++		case 'i':
++			gconf.pidfile = strdup(optarg);
++			break;
+ 		default:
+ 			usage(TRUE);
+ 		}
+--- ample-0.5.7.orig/src/configuration.h
++++ ample-0.5.7/src/configuration.h
+@@ -70,6 +70,7 @@
+                               higher number means more detail\n\
+   -t, --trace                 no forking, no backgrounding\n\
+                               helpful when debugging\n\
++  -i, --pidfile               create a pidfile \n\
+   -v, --version               output version information and exit\n\
+ \n\
+ Report bugs to <david@2gen.com>\n"
+@@ -86,7 +87,8 @@
+   -d[=NUMBER]                 debug messages will be printed,\n\
+                               higher number means more detail\n\
+   -t                          no forking, no backgrounding,\n\
+-                              helpful when debugging)\n\
++                              (helpful when debugging)\n\
++  -i                          create a pidfile \n\
+   -v                          output version information and exit\n\
+ \n\
+ Report bugs to <david@2gen.com>\n"
+--- ample-0.5.7.orig/docs/ample.1.in
++++ ample-0.5.7/docs/ample.1.in
+@@ -86,6 +86,9 @@
+ .B -v --version
+ Display version information and exit.
+ .TP
++.B -i --pidfile [PIDFILE]
++Write a PIDFILE to handle ample as a daemon
++.TP
+ .BI "[" "PATH" "...]"
+ These are path(s) to files or directories that Ample can use to 
+ populate it's list of MP3's. If
--- ample-0.5.7.orig/debian/patches/makefile_debian_location.path
+++ ample-0.5.7/debian/patches/makefile_debian_location.path
@@ -0,0 +1,15 @@
+Index: ample-0.5.7/Makefile.in
+===================================================================
+--- ample-0.5.7.orig/Makefile.in	2008-06-27 20:10:22.000000000 -0600
++++ ample-0.5.7/Makefile.in	2008-06-27 20:10:23.000000000 -0600
+@@ -42,7 +42,9 @@
+ 
+ conffile = $(sysconfdir)/ample.conf
+ logdir  = $(localstatedir)/log
+-logfile = $(logdir)/ample.conf
++##Modified for debian
++##logfile = $(logdir)/ample.conf
++logfile = $(logdir)/ample.log
+ mp3path = $(datadir)/mp3
+ 
+ SUBDIRS = src docs
--- ample-0.5.7.orig/debian/patches/makefile_build_subdirs.patch
+++ ample-0.5.7/debian/patches/makefile_build_subdirs.patch
@@ -0,0 +1,11 @@
+--- ample-0.5.7.orig/Makefile.in
++++ ample-0.5.7/Makefile.in
+@@ -55,7 +55,7 @@
+ all:
+ 	@for i in $(SUBDIRS); do \
+ 	  echo "Making all in $$i ..."; \
+-	  cd $$i; $(MAKE) $(MDEFS) all; \
++	  cd $$i; $(MAKE) $(MDEFS) all || exit ;  \
+ 	  cd ..; \
+ 	done
+ 
--- ample-0.5.7.orig/debian/patches/series
+++ ample-0.5.7/debian/patches/series
@@ -0,0 +1,6 @@
+hyphen_as_minus.patch
+makefile_build_subdirs.patch
+makefile_debian_location.path
+add_pidfile_option.patch
+add_user_group.patch
+#add_i_option_to_manpage.patch
--- ample-0.5.7.orig/debian/patches/add_user_group.patch
+++ ample-0.5.7/debian/patches/add_user_group.patch
@@ -0,0 +1,80 @@
+diff --git i/src/ample.c w/src/ample.c
+index da14086..622a152 100644
+--- i/src/ample.c
++++ w/src/ample.c
+@@ -54,6 +54,8 @@
+ int allow_severity = LOG_INFO;
+ int deny_severity = LOG_WARNING;
+ #endif
++#include <pwd.h>
++#include <grp.h>
+ 
+ 
+ #include "ample.h"
+@@ -502,6 +504,23 @@ main(int argc, char *argv[])
+ 	/**/
+ 
+ 	preparelog();
++
++        if(gconf.group) {
++                struct group *pwent = getgrnam(gconf.group);
++                if (pwent == NULL)
++                        die("No such group");
++                if (setgid(pwent->gr_gid) != 0)
++                        die("Could not setgid()");
++        }
++
++        if(gconf.user) {
++                struct passwd *pwent = getpwnam(gconf.user);
++                if (pwent == NULL)
++                        die("No such user");
++                if (setuid(pwent->pw_uid) != 0)
++                        die("Could not change to specified user");
++        }
++
+ 	if(!gconf.inetd)
+ 		logmsg("Ample/%s started\n", AMPLE_VERSION);
+ 
+diff --git i/src/ample.h w/src/ample.h
+index 68f0f90..297f9d7 100644
+--- i/src/ample.h
++++ w/src/ample.h
+@@ -37,6 +37,8 @@ struct global_config {
+ 	char * serveraddress;
+ 	char * filter;
+ 	char * pidfile;
++	char * user;
++	char * group;
+ };
+ 
+ struct childstat {
+diff --git i/src/configuration.c w/src/configuration.c
+index 97f5cbb..7fd1feb 100644
+--- i/src/configuration.c
++++ w/src/configuration.c
+@@ -679,10 +679,10 @@ setcmdopt(int argc, char * argv[])
+ 		{NULL, 0, NULL, 0}
+ 	};
+ 
+-	while((c = getopt_long(argc, argv, "p:oc:nf:m:hd::ti:v", longopts, &i)) 
++	while((c = getopt_long(argc, argv, "p:oc:nf:m:hd::ti:vu:g:", longopts, &i))
+ 	      != -1) {
+ #else
+-	while((c = getopt(argc, argv, "p:oc:nf:m:hd::ti:v")) != -1) {
++	while((c = getopt(argc, argv, "p:oc:nf:m:hd::ti:vu:g:")) != -1) {
+ #endif
+ 		switch(c) {
+ 		case 'p':
+@@ -723,6 +723,12 @@ setcmdopt(int argc, char * argv[])
+ 		case 'i':
+ 			gconf.pidfile = strdup(optarg);
+ 			break;
++		case 'u':
++			gconf.user = strdup(optarg);
++			break;
++		case 'g':
++			gconf.group = strdup(optarg);
++			break;
+ 		default:
+ 			usage(TRUE);
+ 		}
--- ample-0.5.7.orig/debian/patches/hyphen_as_minus.patch
+++ ample-0.5.7/debian/patches/hyphen_as_minus.patch
@@ -0,0 +1,13 @@
+Index: ample-0.5.7/docs/ample.conf.5.in
+===================================================================
+--- ample-0.5.7.orig/docs/ample.conf.5.in	2008-06-27 16:08:28.000000000 -0600
++++ ample-0.5.7/docs/ample.conf.5.in	2008-06-27 16:09:32.000000000 -0600
+@@ -77,7 +77,7 @@
+ 
+ # Filter to pass each music file through
+ # (before they are sent to the client)
+-filter = /usr/bin/lame -b64 --quiet "@FPATH@" -
++filter = /usr/bin/lame \-b64 \-\-quiet "@FPATH@" \-
+ 
+ # The end
+ 
