#!/bin/sh
# Installation script for Printer Mac version 1.0.
# Produced using ESP Package Manager v4.1; report problems to epm@easysw.com.
#%product Printer Mac
#%vendor Xerox
#%copyright 2008-04-9 Xerox
#%version 1.0 1000000
#%description Raster printer driver
#%rootsize 14078
#%usrsize 0
#
PATH=/usr/xpg4/bin:/bin:/usr/bin:/usr/ucb:${PATH}
SHELL=/bin/sh
case "`uname`" in
	Darwin*)
	case "`id -un`" in
		root)
		;;
		*)
		echo Sorry, you must have administrative priviledges to install this software.
		exit 1
		;;
	esac
	;;
	*)
	case "`id`" in
		uid=0*)
		;;
		*)
		echo Sorry, you must be root to install this software.
		exit 1
		;;
	esac
	;;
esac
echo Copyright 2008-04-9\ Xerox
# Reset umask for install...
umask 002
# Determine correct echo options...
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
	ac_n=-n
	ac_c=
else
	ac_n=
	ac_c='\c'
fi
# Determine correct extract options for the tar command...
if test `uname` = Darwin; then
	ac_tar="tar -xpPf"
else if test "`tar --help 2>&1 | grep GNU`" = ""; then
	ac_tar="tar -xpf"
else
	ac_tar="tar -xpPf"
fi fi
if test "$*" = "now"; then
	echo Software license silently accepted via command-line option.
else
	echo ""
	echo This installation script will install the Printer\ Mac
	echo software version 1.0 on your system.
	echo ""
	while true ; do
		echo $ac_n "Do you wish to continue? $ac_c"
		read yesno
		case "$yesno" in
			y | yes | Y | Yes | YES)
			break
			;;
			n | no | N | No | NO)
			exit 1
			;;
			*)
			echo Please enter yes or no.
			;;
		esac
	done
	more xerox.license
	echo ""
	while true ; do
		echo $ac_n "Do you agree with the terms of this license? $ac_c"
		read yesno
		case "$yesno" in
			y | yes | Y | Yes | YES)
			break
			;;
			n | no | N | No | NO)
			exit 1
			;;
			*)
			echo Please enter yes or no.
			;;
		esac
	done
fi
if test -x /etc/software/xerox.remove; then
	echo Removing old versions of xerox software...
	/etc/software/xerox.remove now
fi
case `uname` in
	AIX)
	dfroot=`df -k / | tr '\n' ' '`
	dfusr=`df -k /usr | tr '\n' ' '`
	fsroot=`echo $dfroot | awk '{print $15}'`
	sproot=`echo $dfroot | awk '{print $11}'`
	fsusr=`echo $dfusr | awk '{print $15}'`
	spusr=`echo $dfusr | awk '{print $11}'`
	;;

	HP-UX)
	dfroot=`df -k / | tr '\n' ' '`
	dfusr=`df -k /usr | tr '\n' ' '`
	fsroot=`echo $dfroot | awk '{print $1}'`
	sproot=`echo $dfroot | awk '{print $9}'`
	fsusr=`echo $dfusr | awk '{print $1}'`
	spusr=`echo $dfusr | awk '{print $9}'`
	;;

	IRIX*)
	dfroot=`df -k / | tr '\n' ' '`
	dfusr=`df -k /usr | tr '\n' ' '`
	fsroot=`echo $dfroot | awk '{print $15}'`
	sproot=`echo $dfroot | awk '{print $13}'`
	fsusr=`echo $dfusr | awk '{print $15}'`
	spusr=`echo $dfusr | awk '{print $13}'`
	;;

	SCO*)
	dfroot=`df -k -B / | tr '\n' ' '`
	dfusr=`df -k -B /usr | tr '\n' ' '`
	fsroot=`echo $dfroot | awk '{print $13}'`
	sproot=`echo $dfroot | awk '{print $11}'`
	fsusr=`echo $dfusr | awk '{print $13}'`
	spusr=`echo $dfusr | awk '{print $11}'`
	;;

	*)
	dfroot=`df -k / | tr '\n' ' '`
	dfusr=`df -k /usr | tr '\n' ' '`
	fsroot=`echo $dfroot | awk '{print $13}'`
	sproot=`echo $dfroot | awk '{print $11}'`
	fsusr=`echo $dfusr | awk '{print $13}'`
	spusr=`echo $dfusr | awk '{print $11}'`
	;;
esac

if test x$sproot = x -o x$spusr = x; then
	echo WARNING: Unable to determine available disk space\; installing blindly...
else
	if test x$fsroot = x$fsusr; then
		if test 14078 -gt $sproot; then
			echo Not enough free disk space for software:
			echo You need 14078 kbytes but only have $sproot kbytes available.
			exit 1
		fi
	else
		if test 14078 -gt $sproot; then
			echo Not enough free disk space for software:
			echo You need 14078 kbytes in / but only have $sproot kbytes available.
			exit 1
		fi

		if test 0 -gt $spusr; then
			echo Not enough free disk space for software:
			echo You need 0 kbytes in /usr but only have $spusr kbytes available.
			exit 1
		fi
	fi
fi
echo Backing up old versions of non-shared files to be installed...
for file in /Library/Printers/PPDs/Contents/Resources/en.lproj/XeroxPhaser3100 /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/Info.plist \
/Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/MacOS/ShiftfromBinding \
/Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/Resources/English.lproj/Localizable.strings \
/Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/Resources/English.lproj/ShiftfromBinding.nib/classes.nib \
/Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/Resources/English.lproj/ShiftfromBinding.nib/info.nib \
/Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/Resources/English.lproj/ShiftfromBinding.nib/objects.xib \
/Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/Info.plist /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/MacOS/Watermark \
/Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/Resources/English.lproj/Localizable.strings \
/Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/Resources/English.lproj/Watermark.nib/classes.nib \
/Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/Resources/English.lproj/Watermark.nib/info.nib \
/Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/Resources/English.lproj/Watermark.nib/objects.xib \
/Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/Resources/Info_Watermark.plist \
/Library/Printers/Xerox/Utility/BmpInfo.plist /Library/Printers/Xerox/Utility/CreateFile \
/Library/Printers/Xerox/Utility/Info.plist /Library/Printers/Xerox/Utility/InstructionPage/A4Long \
/Library/Printers/Xerox/Utility/InstructionPage/A4Short /Library/Printers/Xerox/Utility/InstructionPage/A5Long \
/Library/Printers/Xerox/Utility/InstructionPage/A5Short /Library/Printers/Xerox/Utility/InstructionPage/A5_LEFLong \
/Library/Printers/Xerox/Utility/InstructionPage/A5_LEFShort /Library/Printers/Xerox/Utility/InstructionPage/B5_ISOLong \
/Library/Printers/Xerox/Utility/InstructionPage/B5_ISOShort /Library/Printers/Xerox/Utility/InstructionPage/ExecutiveLong \
/Library/Printers/Xerox/Utility/InstructionPage/ExecutiveShort /Library/Printers/Xerox/Utility/InstructionPage/Folio_legal_13Long \
/Library/Printers/Xerox/Utility/InstructionPage/Folio_legal_13Short /Library/Printers/Xerox/Utility/InstructionPage/JIS_B5Long \
/Library/Printers/Xerox/Utility/InstructionPage/JIS_B5Short /Library/Printers/Xerox/Utility/InstructionPage/LegalLong \
/Library/Printers/Xerox/Utility/InstructionPage/LegalShort /Library/Printers/Xerox/Utility/InstructionPage/LetterLong \
/Library/Printers/Xerox/Utility/InstructionPage/LetterShort /Library/Printers/Xerox/Utility/InstructionPage/OfficioLong \
/Library/Printers/Xerox/Utility/InstructionPage/OfficioShort /Library/Printers/Xerox/Utility/InstructionPage/Statement_half_LetterLong \
/Library/Printers/Xerox/Utility/InstructionPage/Statement_half_LetterShort /Library/Printers/Xerox/filter/rastertoprinter; do
	if test -d "$file" -o -f "$file" -o -h "$file"; then
		mv -f "$file" "$file.O"
	fi
done
echo Creating installation directories...
if test ! -d /Library/Printers/Xerox -a ! -f /Library/Printers/Xerox -a ! -h /Library/Printers/Xerox; then
	mkdir -p /Library/Printers/Xerox
else
	if test -f /Library/Printers/Xerox; then
		echo Error: /Library/Printers/Xerox already exists as a regular file!
		exit 1
	fi
fi
chown root /Library/Printers/Xerox
chgrp admin /Library/Printers/Xerox
chmod 755 /Library/Printers/Xerox
if test ! -d /Library/Printers/Xerox/PDEs -a ! -f /Library/Printers/Xerox/PDEs -a ! -h /Library/Printers/Xerox/PDEs; then
	mkdir -p /Library/Printers/Xerox/PDEs
else
	if test -f /Library/Printers/Xerox/PDEs; then
		echo Error: /Library/Printers/Xerox/PDEs already exists as a regular file!
		exit 1
	fi
fi
chown root /Library/Printers/Xerox/PDEs
chgrp admin /Library/Printers/Xerox/PDEs
chmod 755 /Library/Printers/Xerox/PDEs
if test ! -d /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin -a ! -f /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin -a ! -h /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin; then
	mkdir -p /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin
else
	if test -f /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin; then
		echo Error: /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin already exists as a regular file!
		exit 1
	fi
fi
chown root /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin
chgrp admin /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin
chmod 755 /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin
if test ! -d /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents -a ! -f /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents -a ! -h /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents; then
	mkdir -p /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents
else
	if test -f /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents; then
		echo Error: /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents already exists as a regular file!
		exit 1
	fi
fi
chown root /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents
chgrp admin /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents
chmod 755 /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents
if test ! -d /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/MacOS -a ! -f /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/MacOS -a ! -h /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/MacOS; then
	mkdir -p /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/MacOS
else
	if test -f /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/MacOS; then
		echo Error: /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/MacOS already exists as a regular file!
		exit 1
	fi
fi
chown root /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/MacOS
chgrp admin /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/MacOS
chmod 755 /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/MacOS
if test ! -d /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/Resources -a ! -f /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/Resources -a ! -h /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/Resources; then
	mkdir -p /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/Resources
else
	if test -f /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/Resources; then
		echo Error: /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/Resources already exists as a regular file!
		exit 1
	fi
fi
chown root /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/Resources
chgrp admin /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/Resources
chmod 755 /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/Resources
if test ! -d /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/Resources/English.lproj -a ! -f /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/Resources/English.lproj -a ! -h /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/Resources/English.lproj; then
	mkdir -p /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/Resources/English.lproj
else
	if test -f /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/Resources/English.lproj; then
		echo Error: /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/Resources/English.lproj already exists as a regular file!
		exit 1
	fi
fi
chown root /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/Resources/English.lproj
chgrp admin /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/Resources/English.lproj
chmod 755 /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/Resources/English.lproj
if test ! -d /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/Resources/English.lproj/ShiftfromBinding.nib -a ! -f /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/Resources/English.lproj/ShiftfromBinding.nib -a ! -h /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/Resources/English.lproj/ShiftfromBinding.nib; then
	mkdir -p /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/Resources/English.lproj/ShiftfromBinding.nib
else
	if test -f /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/Resources/English.lproj/ShiftfromBinding.nib; then
		echo Error: /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/Resources/English.lproj/ShiftfromBinding.nib already exists as a regular file!
		exit 1
	fi
fi
chown root /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/Resources/English.lproj/ShiftfromBinding.nib
chgrp admin /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/Resources/English.lproj/ShiftfromBinding.nib
chmod 755 /Library/Printers/Xerox/PDEs/ShiftfromBinding.plugin/Contents/Resources/English.lproj/ShiftfromBinding.nib
if test ! -d /Library/Printers/Xerox/PDEs/Watermark.plugin -a ! -f /Library/Printers/Xerox/PDEs/Watermark.plugin -a ! -h /Library/Printers/Xerox/PDEs/Watermark.plugin; then
	mkdir -p /Library/Printers/Xerox/PDEs/Watermark.plugin
else
	if test -f /Library/Printers/Xerox/PDEs/Watermark.plugin; then
		echo Error: /Library/Printers/Xerox/PDEs/Watermark.plugin already exists as a regular file!
		exit 1
	fi
fi
chown root /Library/Printers/Xerox/PDEs/Watermark.plugin
chgrp admin /Library/Printers/Xerox/PDEs/Watermark.plugin
chmod 755 /Library/Printers/Xerox/PDEs/Watermark.plugin
if test ! -d /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents -a ! -f /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents -a ! -h /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents; then
	mkdir -p /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents
else
	if test -f /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents; then
		echo Error: /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents already exists as a regular file!
		exit 1
	fi
fi
chown root /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents
chgrp admin /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents
chmod 755 /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents
if test ! -d /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/MacOS -a ! -f /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/MacOS -a ! -h /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/MacOS; then
	mkdir -p /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/MacOS
else
	if test -f /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/MacOS; then
		echo Error: /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/MacOS already exists as a regular file!
		exit 1
	fi
fi
chown root /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/MacOS
chgrp admin /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/MacOS
chmod 755 /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/MacOS
if test ! -d /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/Resources -a ! -f /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/Resources -a ! -h /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/Resources; then
	mkdir -p /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/Resources
else
	if test -f /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/Resources; then
		echo Error: /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/Resources already exists as a regular file!
		exit 1
	fi
fi
chown root /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/Resources
chgrp admin /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/Resources
chmod 755 /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/Resources
if test ! -d /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/Resources/English.lproj -a ! -f /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/Resources/English.lproj -a ! -h /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/Resources/English.lproj; then
	mkdir -p /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/Resources/English.lproj
else
	if test -f /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/Resources/English.lproj; then
		echo Error: /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/Resources/English.lproj already exists as a regular file!
		exit 1
	fi
fi
chown root /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/Resources/English.lproj
chgrp admin /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/Resources/English.lproj
chmod 755 /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/Resources/English.lproj
if test ! -d /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/Resources/English.lproj/Watermark.nib -a ! -f /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/Resources/English.lproj/Watermark.nib -a ! -h /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/Resources/English.lproj/Watermark.nib; then
	mkdir -p /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/Resources/English.lproj/Watermark.nib
else
	if test -f /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/Resources/English.lproj/Watermark.nib; then
		echo Error: /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/Resources/English.lproj/Watermark.nib already exists as a regular file!
		exit 1
	fi
fi
chown root /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/Resources/English.lproj/Watermark.nib
chgrp admin /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/Resources/English.lproj/Watermark.nib
chmod 755 /Library/Printers/Xerox/PDEs/Watermark.plugin/Contents/Resources/English.lproj/Watermark.nib
if test ! -d /Library/Printers/Xerox/Utility -a ! -f /Library/Printers/Xerox/Utility -a ! -h /Library/Printers/Xerox/Utility; then
	mkdir -p /Library/Printers/Xerox/Utility
else
	if test -f /Library/Printers/Xerox/Utility; then
		echo Error: /Library/Printers/Xerox/Utility already exists as a regular file!
		exit 1
	fi
fi
chown root /Library/Printers/Xerox/Utility
chgrp admin /Library/Printers/Xerox/Utility
chmod 755 /Library/Printers/Xerox/Utility
if test ! -d /Library/Printers/Xerox/Utility/InstructionPage -a ! -f /Library/Printers/Xerox/Utility/InstructionPage -a ! -h /Library/Printers/Xerox/Utility/InstructionPage; then
	mkdir -p /Library/Printers/Xerox/Utility/InstructionPage
else
	if test -f /Library/Printers/Xerox/Utility/InstructionPage; then
		echo Error: /Library/Printers/Xerox/Utility/InstructionPage already exists as a regular file!
		exit 1
	fi
fi
chown root /Library/Printers/Xerox/Utility/InstructionPage
chgrp admin /Library/Printers/Xerox/Utility/InstructionPage
chmod 755 /Library/Printers/Xerox/Utility/InstructionPage
if test ! -d /Library/Printers/Xerox/filter -a ! -f /Library/Printers/Xerox/filter -a ! -h /Library/Printers/Xerox/filter; then
	mkdir -p /Library/Printers/Xerox/filter
else
	if test -f /Library/Printers/Xerox/filter; then
		echo Error: /Library/Printers/Xerox/filter already exists as a regular file!
		exit 1
	fi
fi
chown root /Library/Printers/Xerox/filter
chgrp admin /Library/Printers/Xerox/filter
chmod 755 /Library/Printers/Xerox/filter
echo Installing software...
gzip -dc xerox.sw | $ac_tar -
if test -d /etc/software; then
	rm -f /etc/software/xerox.remove
else
	mkdir -p /etc/software
fi
cp xerox.remove /etc/software
chmod 544 /etc/software/xerox.remove
echo Updating file permissions...
if test -f /usr/.writetest; then
	rm -f /usr/.writetest
fi
echo Installation is complete.
