#! /bin/sh -e
## 
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description. 

[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
patch_opts="${patch_opts:--f --no-backup-if-mismatch}"

if [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi  
case "$1" in
       -patch) patch $patch_opts -p1 < $0;;
       -unpatch) patch $patch_opts -p1 -R < $0;;
        *)
                echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
		exit 1;;
esac            

exit 0
@DPATCH@
--- mgetty-1.1.30.orig/Makefile	2002-12-16 08:08:23.000000000 -0500
+++ mgetty-1.1.30/Makefile	2003-04-28 00:25:24.000000000 -0400
@@ -164,7 +164,7 @@
 #
 # if your systems doesn't have one, use the shell script that I provide
 # in "inst.sh" (taken from X11R5). Needed on IRIX5.2
-INSTALL=install -c -o bin -g bin
+INSTALL=install -c
 #INSTALL=install -c -o root -g wheel		# NeXT/BSD
 #INSTALL=/usr/ucb/install -c -o bin -g bin	# AIX, Solaris 2.x
 #INSTALL=installbsd -c -o bin -g bin		# OSF/1, AIX 4.1, 4.2
@@ -172,11 +172,11 @@
 #
 # prefix, where most (all?) of the stuff lives, usually /usr/local or /usr
 #
-prefix=/usr/local
+prefix=$(DESTDIR)/usr
 #
 # prefix for all the spool directories (usually /usr/spool or /var/spool)
 #
-spool=/var/spool
+spool=$(DESTDIR)/var/spool
 #
 # where the mgetty + sendfax binaries live (used for "make install")
 #
@@ -188,11 +188,11 @@
 #
 # where the font+coverpage files go
 #
-LIBDIR=$(prefix)/lib/mgetty+sendfax
+LIBDIR=$(prefix)/lib/mgetty-fax
 #
 # where the configuration files (*.config, aliases, fax.allow/deny) go to
 #
-CONFDIR=$(prefix)/etc/mgetty+sendfax
+CONFDIR=$(DESTDIR)/etc/mgetty
 #CONFDIR=/etc/default/
 #
 #
@@ -216,31 +216,33 @@
 # (it's possible to run faxrunq(d) as root, but the FAX_OUT_USER 
 #  MUST NOT BE root or any other privileged account).
 #
-FAX_OUT_USER=fax
+FAX_OUT_USER=uucp
 #
 #
 # Where section 1 manual pages should be placed
-MAN1DIR=$(prefix)/man/man1
+MAN1DIR=$(prefix)/share/man/man1
 #
 # Where section 4 manual pages (mgettydefs.4) should be placed
-MAN4DIR=$(prefix)/man/man4
+MAN4DIR=$(prefix)/share/man/man4
 #
 # Section 5 man pages (faxqueue.5)
-MAN5DIR=$(prefix)/man/man5
+MAN5DIR=$(prefix)/share/man/man5
 #
 # Section 8 man pages (sendfax.8)
-MAN8DIR=$(prefix)/man/man8
+MAN8DIR=$(prefix)/share/man/man8
 #
 # Where the GNU Info-Files are located
 #
-INFODIR=$(prefix)/info
+INFODIR=$(prefix)/share/info
 #
 #
 # A shell that understands bourne-shell syntax
 #  Usually this will be /bin/sh or /usr/bin/sh, but bash or ksh are fine.
 #  (on some ultrix systems, you may need /bin/sh5 here)
 #
-SHELL=/bin/sh
+# On Debian GNU/Linux, bash is a required package so we can use it to solve
+# bug #149851.
+SHELL=/bin/bash
 #
 # If your shell requires pre-posix syntax to disable traps ('trap 0' 
 #  instead of 'trap - 0'), set this to "0" (very rarely needed)
@@ -285,7 +287,7 @@
 
 # To maintain security, I recommend creating a new group for
 # users who are allowed to manipulate the recorded voice messages.
-PHONE_GROUP=phone
+PHONE_GROUP=voice
 PHONE_PERMS=770
 
 # Add -DNO_STRSTR to CFLAGS if you don't have strstr().
@@ -586,7 +588,7 @@
		mv -f $(SBINDIR)/mgetty $(SBINDIR)/mgetty.old ; fi
	if [ -f $(SBINDIR)/sendfax ] ; then \
		mv -f $(SBINDIR)/sendfax $(SBINDIR)/sendfax.old ; fi
-	$(INSTALL) -s -m 700 mgetty $(SBINDIR)
+	$(INSTALL) -s -m 755 mgetty $(SBINDIR)
 	$(INSTALL) -s -m 755 sendfax $(SBINDIR)
 #
 # data files + directories
@@ -738,3 +740,5 @@
 class1.o: class1.c mgetty.h ugly.h fax_lib.h tio.h class1.h
 class1lib.o: class1lib.c mgetty.h ugly.h fax_lib.h tio.h class1.h
 hyla_nsf.o: hyla_nsf.c mgetty.h ugly.h policy.h
+ 
+.PHONY: install install.bin
