1# 2# -- START -- 3# postinstall.linux.sh,v 1.1 2001/08/21 20:33:17 root Exp 4# 5# If you are building an RPM package, please see the 6# DISTRIBUTIONS/RPM directory(s) for a RPM Spec file 7# that makes a package 8# This script is used from the Makefile when we are doing 9# a source level install and NOT building a package. 10# We first install the sample files 11# 12echo RUNNING postinstall.linux.sh MAKEPACKAGE="$MAKEPACKAGE" MAKEINSTALL="$MAKEINSTALL" PREFIX="$PREFIX" DESTDIR="$DESTDIR" INIT="$INIT" cwd `pwd` 13if [ "$VERBOSE_INSTALL" != "" ] ; then set -x; fi 14fix () { 15 v=`echo $1 | sed -e 's/[:;].*//'`; 16 p=`echo $2 | sed -e 's/:.*//'`; d=`dirname $p`; 17 if expr "$p" : "\|" >/dev/null ; then 18 echo "$v is a filter '$p'" 19 return 0 20 fi 21 echo "Checking for $v.sample in $d" 22 if [ ! -d "$d" ] ; then 23 echo "Directory $d does not exist!" 24 mkdir -p $d; 25 fi 26 if [ -f $v.sample ] ; then 27 if [ $v.sample != $p.sample ] ; then ${INSTALL} -m 644 $v.sample $p.sample; fi 28 elif [ -f $v ] ; then 29 if [ $v != $p.sample ] ; then ${INSTALL} -m 644 $v $p.sample; fi 30 else 31 echo "Do not have $v.sample or $v" 32 fi 33 if [ ! -f $p.sample ] ; then 34 echo "Do not have $p.sample" 35 elif [ ! -f $p ] ; then 36 ${INSTALL} -m 644 $p.sample $p; 37 fi; 38} 39echo "Installing configuration files" 40init=${DESTDIR}/etc/rc.d/init.d/lpd 41if [ "X$MAKEINSTALL" = "XYES" ] ; then 42 fix lpd.perms "${DESTDIR}${LPD_PERMS_PATH}" 43 fix lpd.conf "${DESTDIR}${LPD_CONF_PATH}" 44 fix printcap "${DESTDIR}${PRINTCAP_PATH}" 45 if [ "$INIT" != "no" ] ; then 46 if [ ! -d `dirname $init` ] ; then mkdir -p `dirname $init ` ; fi; 47 if [ -f /etc/redhat-release ] ; then 48 ${INSTALL} -m 755 init.redhat $init; 49 elif [ -d /lib/lsb ] ; then 50 ${INSTALL} -m 755 init.linuxsb $init; 51 else 52 ${INSTALL} -m 755 init.linux $init; 53 fi 54 fi; 55else 56 fix "${LPD_PERMS_PATH}" "${DESTDIR}${LPD_PERMS_PATH}" 57 fix "${LPD_CONF_PATH}" "${DESTDIR}${LPD_CONF_PATH}" 58 fix "${PRINTCAP_PATH}" "${DESTDIR}${PRINTCAP_PATH}" 59fi 60if [ "X$MAKEPACKAGE" != "XYES" -a "$INIT" != no ] ; then 61 echo "Configuring startup scripts" 62 if [ ! -f $init ] ; then 63 echo "Missing $init"; 64 fi 65 if [ -f /etc/redhat-release -a -f /sbin/chkconfig ] ; then 66 echo "RedHat Linux - running chkconfig" 67 ( 68 /sbin/chkconfig lpr off 69 /sbin/chkconfig --del lpr 70 /sbin/chkconfig lpr off 71 /sbin/chkconfig --del lpr 72 /sbin/chkconfig lprng off 73 /sbin/chkconfig --del lprng 74 ) 75 echo "Stopping server" 76 kill -INT `ps ${PSHOWALL} | awk '/lpd/{ print $1;}'` >/dev/null 2>&1 77 sleep 2 78 echo "Checking Printcap" 79 ${SBINDIR}/checkpc -f 80 echo "Installing Printer Startup Scripts" 81 /sbin/chkconfig --add lprng 82 /sbin/chkconfig --list lprng 83 /sbin/chkconfig lprng on 84 echo "Starting Printer" 85 sh $init start 86 echo "Printer Started" 87 else 88 echo "Stopping server" 89 kill -INT `ps ${PSHOWALL} | awk '/lpd/{ print $1;}'` >/dev/null 2>&1 90 sleep 2 91 echo "Checking Printcap" 92 ${SBINDIR}/checkpc -f 93 echo "Starting Printer" 94 ${LPD_PATH} 95 echo "Printer Started" 96 cat <<EOF 97# 98# You will have to install the run time startup files by hand. 99# The $init file contains the standard startup/shutdown sequence. 100# You usually need to put in links to this file in /etc/rc.d/rcX.d 101# to have it executed by the appropriate run level startup/shutdown 102# script. 103# 104# You can use the following a template for your installation 105# 106 ln -s ../init.d/lprng /etc/rc0.d/K60lprng 107 ln -s ../init.d/lprng /etc/rc1.d/K60lprng 108 ln -s ../init.d/lprng /etc/rc2.d/S60lprng 109 ln -s ../init.d/lprng /etc/rc3.d/S60lprng 110 ln -s ../init.d/lprng /etc/rc4.d/S60lprng 111 ln -s ../init.d/lprng /etc/rc5.d/S60lprng 112 ln -s ../init.d/lprng /etc/rc6.d/K60lprng 113 114EOF 115 fi; 116fi; 117