1# 
2# -- START --
3# postinstall.generic.sh,v 1.1 2001/08/21 20:33:16 root Exp
4#
5# This is the shell script that does the postinstall
6# dynamic fixup
7#  It needs to be massaged with the information for
8#  various paths.
9# If you are building a package,  then you do NOT want
10#  to have this executed - it will put the sample files
11#  in place.  You need to do this during the postinstall
12#  step in the package installation.
13#
14echo RUNNING postinstall - generic MAKEPACKAGE="$MAKEPACKAGE" MAKEINSTALL="$MAKEINSTALL" PREFIX="$PREFIX" INIT=$INIT cwd `pwd`
15if [ "$VERBOSE_INSTALL" != "" ] ; then set -x; fi
16fix () {
17	v=`echo $1 | sed -e 's/[:;].*//'`;
18    p=`echo $2 | sed -e 's/:.*//'`; d=`dirname $p`;
19	if expr "$p" : "\|" >/dev/null ; then
20		echo "$v is a filter '$p'" 
21		return 0
22	fi
23	echo "Checking for $v.sample in $d"
24	if [ ! -d "$d" ] ; then
25		echo "Directory $d does not exist!"
26		sh mkinstalldirs $d
27	fi
28	if [ -f $v.sample ] ; then
29		if [ $v.sample != $p.sample ] ; then ${INSTALL} -m 644 $v.sample $p.sample; fi
30	elif [ -f $v ] ; then
31		if [ $v != $p.sample ] ; then ${INSTALL} $v $p.sample; fi
32	else
33		echo "Do not have $v.sample or $v"
34	fi
35	if [ ! -f $p.sample ] ; then
36		echo "Do not have $p.sample"
37	elif [ ! -f $p ] ; then
38		${INSTALL} -m 644 $p.sample $p;
39	fi;
40}
41if [ "X$MAKEINSTALL" = "XYES" ] ; then
42	if [ -f lpd.perms ] ; then fix lpd.perms "${DESTDIR}${LPD_PERMS_PATH}" ; fi;
43	if [ -f lpd.conf ] ; then fix lpd.conf "${DESTDIR}${LPD_CONF_PATH}" ; fi;
44	if [ -f printcap ] ; then fix printcap "${DESTDIR}${PRINTCAP_PATH}" ; fi;
45	if [ "$INIT" != "no" ] ; then
46		echo "Stopping LPD"
47		kill -INT `ps ${PSHOWALL} | awk '/lpd/{ print $1;}'` >/dev/null 2>&1
48		sleep 2;
49		echo "Checking printcap"
50		${SBINDIR}/checkpc -f
51		echo "Starting LPD"
52		${LPD_PATH}
53	fi
54fi
55exit 0
56