home *** CD-ROM | disk | FTP | other *** search
- :
- # Install psf filters on Xenix 2.* (install.xenix)
- #
- # note: this script records configuration parameters in
- # various ".cfg" files in the current directory.
- # it also expects some .cfg files to be created
- # by "selectdef".
-
- PATH=.:/bin:/usr/bin:/etc
-
- INSTALLPOINT="/tmp/psf"
-
- # sense if we are running from "install" or from a normal directory
- # If from "install" then $0 == "init.psf". the normal script file
- # name is "installpsf".
-
- case $0 in
- *Install.xenix)
- ;;
- *) cd $INSTALLPOINT
- ;;
- esac
-
- DEFDIR="/usr/spool/lp/model/psfprint.def"
- BINDIR="/usr/local/bin"
- SPOOLDIR="/usr/spool/lp"
-
- INTERFACE="$SPOOLDIR/interface"
- MODEL="$SPOOLDIR/model"
- DEFFILES="defs/*.def"
- PAGESIZE="undefined"
- PNAME="undefined"
- BINARIES="psf pnf pmf psd psbanner psdetect"
- MANS="psf.1 pnf.1 pmf.1 psd.1 psmbox.1 psman.1 psnroff.1"
- SCRIPTS="psmbox psman psmandouble psnroff"
- MANCHAP="LOCAL"
-
-
- # get existing psf installation parameters
-
- if test -f Pmanchap.cfg
- then
- MANCHAP=`cat Pmanchap.cfg`
- fi
-
- if test -f Pbindir.cfg
- then
- BINDIR=`cat Pbindir.cfg`
- fi
-
- # Define return values
-
- : ${OK=0} ${FAIL=1} ${STOP=10} ${HALT=11}
-
-
- # Print an error message
- error() {
- echo "\nError: $*" >&2
- return 1
- }
-
- # Prompt with mesg, return non-zero on q
- prompt() {
- while echo "\n${mesg}or enter q to $quit: \c" >&2
- do read cmd
- case $cmd in
- +x|-x) set $cmd ;;
- Q|q) return 1 ;;
- !*) eval `expr "$cmd" : "!\(.*\)"` ;;
- "") # If there is an argument use it as the default
- # else loop until 'cmd' is set
- [ "$1" ] && {
- cmd=$1
- return 0
- }
- : continue
- ;;
- *) return 0 ;;
- esac
- done
- }
-
-
- showstats () {
- echo "\nPSF INSTALLATION OPTIONS SELECTED"
- echo "--------------------------------"
- echo "printer selected from: $PNAME"
- echo "printer page size is: $PAGESIZE"
- echo "psf default options: $PSFOPT"
- echo "banner options: $BANNEROPT"
- echo "binaries and scripts in: $BINDIR"
- echo "man pages in chapter: $MANCHAP"
- }
-
- createprinter () {
- bdir="$BINDIR"
- echo " "
- echo "Install PSF binaries and"
- ./query " scripts in which directory [$bdir]? "
- read bdir
- case "$bdir" in
- '') ;;
- *) BINDIR="$bdir"
- ;;
- esac
- if test ! -d $BINDIR
- then
- echo "\nDirectory $BINDIR does not exist."
- echo "Create the directory and re-start the installation.\n"
- exit $FAIL
- fi
- echo "$BINDIR" > Pbindir.cfg
- cp $BINARIES $BINDIR
- cp $SCRIPTS $BINDIR
- rm -f psf.model
- sed "s@BINARY@$BINDIR@g" psfxenix.LP | sed "s@OPTIONS@$PSFOPT@g" \
- | sed "s@BANNER@$BANNEROPT@g" > psf.model
- chmod +rw psf.model
- cp psf.model $MODEL/psf.model
- cp $PNAME $DEFDIR
- chown lp $MODEL/psf.model $DEFDIR
- chgrp bin $MODEL/psf.model $DEFDIR
-
- showstats
- echo "\nNow use menu item 2 to install this printer with 'mkdev lp'."
- return 0
- }
-
-
- getsizes () {
- PAGESIZE=`cat Ppagesize.cfg`
- PNAME=`cat Ppsfprint.cfg`
- cp $PNAME psfprint.def
- case $PAGESIZE in
- DEFAULT) PSFOPT= ;;
- *) PSFOPT=`echo -g $PAGESIZE` ;;
- esac
- case $PAGESIZE in
- DEFAULT) BANNEROPT= ;;
- *) BANNEROPT=`echo -g $PAGESIZE` ;;
- esac
- return 0
- }
-
- replaceprinter () {
- selectdef $DEFFILES
- case $? in
- 0) ;;
- *) return $?
- esac
- getsizes
- return 0
- }
-
-
- manpages () {
- echo "\nNormally, PSF man pages for xenix should be placed in the 'LOCAL'"
- echo "chapter. Some sites prefer to use other chapters."
- cdir="$MANCHAP"
- echo " "
- ./query "Which chapter should be used for the PSF man pages [$cdir]? "
- read cdir
- case "$cdir" in
- '') ;;
- *) MANCHAP="$cdir"
- ;;
- esac
- if test ! -d /usr/man/man.$MANCHAP
- then
- echo "\nDirectory /usr/man/man.$MANCHAP does not exist."
- echo "Create the directory and re-start the manual installation.\n"
- exit $FAIL
- fi
-
- cp pmf.1 /usr/man/man.$MANCHAP/pmf.$MANCHAP
- cp pnf.1 /usr/man/man.$MANCHAP/pnf.$MANCHAP
- cp psf.1 /usr/man/man.$MANCHAP/psf.$MANCHAP
- cp psd.1 /usr/man/man.$MANCHAP/psd.$MANCHAP
- cp psman.1 /usr/man/man.$MANCHAP/psman.$MANCHAP
- cp psnroff.1 /usr/man/man.$MANCHAP/psnroff.$MANCHAP
- cp psmbox.1 /usr/man/man.$MANCHAP/psmbox.$MANCHAP
- man $MANCHAP pmf > /dev/null
- man $MANCHAP pnf > /dev/null
- man $MANCHAP psd > /dev/null
- man $MANCHAP psf > /dev/null
- man $MANCHAP psman > /dev/null
- man $MANCHAP psnroff > /dev/null
- man $MANCHAP psmbox > /dev/null
- echo "$MANCHAP" > Pmanchap.cfg
- echo "\nPSF man pages have been installed in /usr/man/man.$MANCHAP"
- return 0
- }
-
- printman () {
- if test ! -d /usr/man/man.$MANCHAP
- then
- psf -2l 66 $DOCS | lp
- else
- psnroff -man $MANS
- fi
-
- return 0
- }
-
- removeall () {
- cdir="$MANCHAP"
- echo " "
- ./query "Remove PSF man pages from chapter [$cdir]? "
- read cdir
- case "$cdir" in
- '') ;;
- *) MANCHAP="$cdir"
- ;;
- esac
- if test ! -d /usr/man/man.$MANCHAP
- then
- echo "\nDirectory /usr/man/man.$MANCHAP does not exist."
- exit $FAIL
- fi
-
- bdir="$BINDIR"
- echo " "
- ./query "Remove PSF binaries+scripts from directory [$bdir]? "
- read bdir
- case "$bdir" in
- '') ;;
- *) BINDIR="$bdir"
- ;;
- esac
- if test ! -d $BINDIR
- then
- echo "\nDirectory $BINDIR does not exist."
- exit 1
- fi
-
- rm -f /usr/man/man.$MANCHAP/pmf.$MANCHAP
- rm -f /usr/man/man.$MANCHAP/pnf.$MANCHAP
- rm -f /usr/man/man.$MANCHAP/psf.$MANCHAP
- rm -f /usr/man/man.$MANCHAP/psd.$MANCHAP
- rm -f /usr/man/man.$MANCHAP/psman.$MANCHAP
- rm -f /usr/man/man.$MANCHAP/psnroff.$MANCHAP
- rm -f /usr/man/man.$MANCHAP/psmbox.$MANCHAP
-
- rm -f /usr/man/cat.$MANCHAP/pmf.$MANCHAP
- rm -f /usr/man/cat.$MANCHAP/pnf.$MANCHAP
- rm -f /usr/man/cat.$MANCHAP/psf.$MANCHAP
- rm -f /usr/man/cat.$MANCHAP/psd.$MANCHAP
- rm -f /usr/man/cat.$MANCHAP/psman.$MANCHAP
- rm -f /usr/man/cat.$MANCHAP/psnroff.$MANCHAP
- rm -f /usr/man/cat.$MANCHAP/psmbox.$MANCHAP
-
- thisdir=`pwd`
-
- cd $BINDIR
- rm $BINARIES $SCRIPTS
-
- cd $thisdir
-
- rm $MODEL/psf.model
- rm $DEFDIR
-
- return 0
- }
-
-
- #
- # main()
- #
- echo '\n\tPSF: Postscript print filter installation'
- while
- mesg='\t1. Select printer type, install psf, make printer model.
- 2. Install selected printer with mkdev lp.
- 3. Install man pages in /usr/man.
- 4. Print man pages.
- 5. Remove psf software and files from binary and spool directories.
-
- Select an option '
- quit=quit
- do
- prompt
- choice=$cmd
- quit="return to the previous menu"
- case $choice in
- 1) # select and install
- replaceprinter
- [ -r Ppagesize.cfg ] && [ -r Ppsfprint.cfg ] && [ -r $PNAME ] && createprinter
- ;;
- 2) mkdev lp
- ;;
- 3) manpages
- ;;
- 4) printman
- ;;
- 5) removeall
- ;;
- [qQ]) break ;;
- *) error "unknown option: \"$choice\""
- ;;
- esac
- done
- exit $OK
-