#!/bin/sh
#**********************************************************************
# Program : setup
# Pupose  : Setup script for IBM 4029 printer support
# Version : 0.2 Beta
# Date    : 11/04/92
# Author  : Matt King (Lexmark International, Inc.)
#----------------------------------------------------------------------
# Copyright (c) 1992 Lexmark International, Inc.
# Program Property of Lexmark International, Inc.
# All Rights Reserved.
#**********************************************************************

INSTALL="install -c"
INSTALL_DIRECTORY="$INSTALL -d"
INSTALL_PROGRAM="$INSTALL -m 775"
INSTALL_FILE="$INSTALL -m 660"

SPOOLDIR=/var/spool/ibm4079
TOUCHFILES="acct log"
PRINTCAP=printcap.4079

# Require that user be root
if [ `whoami` != "root" ]
then
	echo "Must be logged in as root to run setup."
	exit 1
fi

if [ ! -d $SPOOLDIR ]
then
	$INSTALL_DIRECTORY -o daemon -g daemon $SPOOLDIR
	echo "setup: Created $SPOOLDIR directory."
else
	echo "setup: Warning -- Spool directory ($SPOOLDIR) already exists."
fi

touch $TOUCHFILES
$INSTALL_FILE -o daemon -g daemon log $SPOOLDIR
$INSTALL_FILE -o daemon -g daemon acct $SPOOLDIR
echo "setup: Created $TOUCHFILES in $SPOOLDIR directory"
rm -f $TOUCHFILES

if grep -s "IBM 4079" /etc/printcap
then
	echo "setup: Detected IBM 4079 printcap entry -- $PRINTCAP NOT appended"
else
	mv /etc/printcap /etc/printcap.old
	echo "setup: Renamed /etc/printcap to /etc/printcap.old"
	cat /etc/printcap.old $PRINTCAP >>/etc/printcap
	echo "setup: Concatenated $PRINTCAP to /etc/printcap"
fi
