Package-Name: shadow
Gentoo-Package: sys-apps/shadow
Requires: glibc
Compile-Requires: gcc binutils make
Source: ibibliolinux:///system/admin/shadow-(\d\d)(\d\d\d\d).tar.gz e:($1+1900).$2
Repack:
	tar xzvfp "$(SOURCE)"
	test -d shadow-"$(VERSION)" || mv shadow* shadow-"$(VERSION)"
Compile:
	mv -f doc/{ANNOUNCE,CHANGES,HOWTO,LICENSE,README*,WISHLIST} "$(PREFIX)/"
	$(MAKE) -f ../Makefile configure
	echo >>config.h '#undef UT_USER'
	echo >>config.h '#define UT_USER ut_user'
	$(MAKE)
	$(MAKE) install
	ln -fs pwconv.8 "$(PREFIX)"/man/man8/pwunconv.8
	ln -fs pwconv.8 "$(PREFIX)"/man/man8/grpconv.8
	ln -fs pwconv.8 "$(PREFIX)"/man/man8/grpunconv.8
Install:
	chmod 4711 "$(PREFIX)"/bin/{chage,chfn,chsh,expiry,gpasswd,newgrp,passwd,su}
	for f in login su ; do \
		if [ -f "$(PREFIX)"/bin/$$f.old -a ! -f "$(PREFIX)"/bin/$$f.older ] ; then \
			mv -f "$(PREFIX)"/bin/$$f.old "$(PREFIX)"/bin/$$f.older ; \
		fi ; \
		if [ -f /bin/$$f ] ; then \
			mv -f /bin/$$f "$(PREFIX)"/bin/$$f.old ; \
		fi ; \
	done
	mv -f "$(PREFIX)"/bin/{login,su} /bin/
	$(MAKE) instbin BIN="chage chfn chsh expiry faillog gpasswd lastlog newgrp passwd sg"
	$(MAKE) instsbin SBIN="chpasswd dpasswd groupadd groupdel groupmod grpck grpconv grpunconv logoutd mkpasswd newusers pwck pwconv pwunconv useradd userdel usermod vipw"
	$(MAKE) instman SECTION=1 MAN="chage chfn chsh gpasswd login newgrp passwd su"
# FIXME: shadow.3 should really be part of glibc
	$(MAKE) instman SECTION=3 MAN=shadow
	$(MAKE) instman SECTION=5 MAN="faillog limits login.access login.defs passwd porttime shadow suauth"
	$(MAKE) instman SECTION=8 MAN="chpasswd dpasswd faillog groupadd groupdel groupmod grpck grpconv grpunconv lastlog logoutd mkpasswd newusers pwck pwconv pwunconv useradd userdel usermod vipw"
Patch: <<EOT
######## begin GCC 3.4 patch
--- libmisc/xmalloc.c.old	1997-12-08 08:27:11 +0900
+++ libmisc/xmalloc.c	2004-08-20 20:51:28 +0900
@@ -13,11 +13,10 @@
 RCSID("$Id: xmalloc.c,v 1.2 1997/12/07 23:27:11 marekm Exp $")
 
 #include <stdio.h>
+#include <stdlib.h>
 
 #include "defines.h"
 
-extern char *malloc();
-
 char *
 xmalloc(size_t size)
 {
######## end GCC 3.4 patch
--- config.guess.old	1997-01-30 23:25:25 +0900
+++ config.guess	2002-11-23 11:32:39 +0900
@@ -338,11 +338,11 @@
 	# The BFD linker knows what the default object file format is, so
 	# first see if it will tell us.
 	ld_help_string=`ld --help 2>&1`
-	if echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf_i[345]86"; then
+	if echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf_i[3456]86"; then
 	  echo "${UNAME_MACHINE}-unknown-linux" ; exit 0
-	elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i[345]86linux"; then
+	elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i[3456]86linux"; then
 	  echo "${UNAME_MACHINE}-unknown-linuxaout" ; exit 0
-	elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i[345]86coff"; then
+	elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i[3456]86coff"; then
 	  echo "${UNAME_MACHINE}-unknown-linuxcoff" ; exit 0
 	elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68kelf"; then
 	  echo "${UNAME_MACHINE}-unknown-linux" ; exit 0
--- config.sub.old	1997-01-30 23:25:25 +0900
+++ config.sub	2002-11-23 11:35:48 +0900
@@ -129,7 +129,7 @@
 case $basic_machine in
 	# Recognize the basic CPU types without company name.
 	# Some are omitted here because they have special meanings below.
-	tahoe | i[345]86 | i860 | m68k | m68000 | m88k | ns32k | arm \
+	tahoe | i[3456]86 | i860 | m68k | m68000 | m88k | ns32k | arm \
 		| arme[lb] | pyramid \
 		| tron | a29k | 580 | i960 | h8300 | hppa1.0 | hppa1.1 \
 		| alpha | we32k | ns16k | clipper | sparclite | i370 | sh \
@@ -144,7 +144,7 @@
 		exit 1
 		;;
 	# Recognize the basic CPU types with company name.
-	vax-* | tahoe-* | i[345]86-* | i860-* | m68k-* | m68000-* | m88k-* \
+	vax-* | tahoe-* | i[3456]86-* | i860-* | m68k-* | m68000-* | m88k-* \
 	      | sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \
 	      | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* | power-* \
 	      | none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
@@ -308,19 +308,19 @@
 		os=-mvs
 		;;
 # I'm not sure what "Sysv32" means.  Should this be sysv3.2?
-	i[345]86v32)
+	i[3456]86v32)
 		basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
 		os=-sysv32
 		;;
-	i[345]86v4*)
+	i[3456]86v4*)
 		basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
 		os=-sysv4
 		;;
-	i[345]86v)
+	i[3456]86v)
 		basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
 		os=-sysv
 		;;
-	i[345]86sol2)
+	i[3456]86sol2)
 		basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
 		os=-solaris2
 		;;
--- libmisc/chowntty.c.old	1997-12-08 08:27:01 +0900
+++ libmisc/chowntty.c	2003-04-18 13:48:39 +0900
@@ -110,9 +110,12 @@
 		snprintf(buf, sizeof buf, "Unable to change tty %s", tty);
 		SYSLOG((LOG_WARN, "unable to change tty `%s' for user `%s'\n",
 			tty, info->pw_name));
-		closelog();
-		perror (buf);
-		exit(1);
+		/* Allow root to log in over failures (eg. root FS readonly) */
+		if (getuid() != 0) {
+			closelog();
+			perror (buf);
+			exit(1);
+		}
 	}
 
 #ifdef __linux__
EOT

-/etc/consoles
-/etc/group
-/etc/issue
-/etc/login.defs
-/etc/motd
-/etc/passwd
-/etc/shadow
/bin/login
/bin/su
/etc/consoles
/etc/group
/etc/issue
/etc/login.defs
/etc/motd
/etc/passwd
/etc/shadow
/pkg/shadow/
/usr/bin/chage
/usr/bin/chfn
/usr/bin/chsh
/usr/bin/expiry
/usr/bin/faillog
/usr/bin/gpasswd
/usr/bin/lastlog
/usr/bin/newgrp
/usr/bin/passwd
/usr/bin/sg
/usr/man/man1/chage.1.gz
/usr/man/man1/chfn.1.gz
/usr/man/man1/chsh.1.gz
/usr/man/man1/gpasswd.1.gz
/usr/man/man1/login.1.gz
/usr/man/man1/newgrp.1.gz
/usr/man/man1/passwd.1.gz
/usr/man/man1/su.1.gz
/usr/man/man3/shadow.3.gz
/usr/man/man5/faillog.5.gz
/usr/man/man5/limits.5.gz
/usr/man/man5/login.access.5.gz
/usr/man/man5/login.defs.5.gz
/usr/man/man5/passwd.5.gz
/usr/man/man5/porttime.5.gz
/usr/man/man5/shadow.5.gz
/usr/man/man5/suauth.5.gz
/usr/man/man8/chpasswd.8.gz
/usr/man/man8/dpasswd.8.gz
/usr/man/man8/faillog.8.gz
/usr/man/man8/groupadd.8.gz
/usr/man/man8/groupdel.8.gz
/usr/man/man8/groupmod.8.gz
/usr/man/man8/grpck.8.gz
/usr/man/man8/grpconv.8.gz
/usr/man/man8/grpunconv.8.gz
/usr/man/man8/lastlog.8.gz
/usr/man/man8/logoutd.8.gz
/usr/man/man8/mkpasswd.8.gz
/usr/man/man8/newusers.8.gz
/usr/man/man8/pwck.8.gz
/usr/man/man8/pwconv.8.gz
/usr/man/man8/pwunconv.8.gz
/usr/man/man8/useradd.8.gz
/usr/man/man8/userdel.8.gz
/usr/man/man8/usermod.8.gz
/usr/man/man8/vipw.8.gz
/usr/sbin/chpasswd
/usr/sbin/dpasswd
/usr/sbin/groupadd
/usr/sbin/groupdel
/usr/sbin/groupmod
/usr/sbin/grpck
/usr/sbin/grpconv
/usr/sbin/grpunconv
/usr/sbin/logoutd
/usr/sbin/mkpasswd
/usr/sbin/newusers
/usr/sbin/pwck
/usr/sbin/pwconv
/usr/sbin/pwunconv
/usr/sbin/useradd
/usr/sbin/userdel
/usr/sbin/usermod
/usr/sbin/vipw
/var/log/lastlog
/var/log/sulog
