1# 2# -- START -- 3# postinstall.solaris.sh,v 1.1 2001/08/21 20:33:17 root Exp 4# 5# We use this when we are building a package or doing an install 6# 7# 8echo RUNNING postinstall.solaris MAKEPACKAGE="$MAKEPACKAGE" MAKEINSTALL="$MAKEINSTALL" PREFIX="$PREFIX" INIT="$INIT" cwd `pwd` 9if [ "$VERBOSE_INSTALL" != "" ] ; then set -x; fi 10fix () { 11 v=`echo $1 | sed -e 's/[:;].*//'`; 12 p=`echo $2 | sed -e 's/:.*//'`; d=`dirname $p`; 13 if expr "$p" : "\|" >/dev/null ; then 14 echo "$v is a filter '$p'" 15 return 0 16 fi 17 echo "Checking for $v.sample in $d" 18 if [ ! -d "$d" ] ; then 19 echo "Directory $d does not exist!" 20 mkdir -p $d; 21 fi 22 if [ -f $v.sample ] ; then 23 if [ $v.sample != $p.sample ] ; then ${INSTALL} -m 644 $v.sample $p.sample; fi 24 elif [ -f $v ] ; then 25 if [ $v != $p.sample ] ; then ${INSTALL} -m 644 $v $p.sample; fi 26 else 27 echo "Do not have $v.sample or $v" 28 fi 29 if [ ! -f $p.sample ] ; then 30 echo "Do not have $p.sample" 31 elif [ ! -f $p ] ; then 32 ${INSTALL} -m 644 $p.sample $p; 33 fi; 34} 35echo "Installing configuration files" 36init=${DESTDIR}/etc/init.d/lprng 37if [ -f lpd.perms ] ; then fix lpd.perms "${DESTDIR}${LPD_PERMS_PATH}"; fi; 38if [ -f lpd.conf ] ; then fix lpd.conf "${DESTDIR}${LPD_CONF_PATH}"; fi; 39if [ -f printcap ] ; then fix printcap "${DESTDIR}${PRINTCAP_PATH}"; fi; 40fix "${DESTDIR}${LPD_PERMS_PATH}" "${DESTDIR}${LPD_PERMS_PATH}" 41fix "${DESTDIR}${LPD_CONF_PATH}" "${DESTDIR}${LPD_CONF_PATH}" 42fix "${DESTDIR}${PRINTCAP_PATH}" "${DESTDIR}${PRINTCAP_PATH}" 43# 44# Now we reconfigure the printer 45# 46if [ "$INIT" != no ] ; then 47 if [ -f init.solaris ] ; then 48 if [ ! -d `dirname $init` ] ; then mkdir -p `dirname $init ` ; fi; 49 ${INSTALL} -m 755 init.solaris $init 50 fi 51 for i in rc2.d/S80lprng rc1.d/K39lprng \ 52 rc0.d/K39lprng rcS.d/K39lprng ; do 53 s=${DESTDIR}/etc/$i; 54 if [ ! -d `dirname $s` ] ; then mkdir -p `dirname $s` ; fi; 55 rm -f $s; 56 echo ln -s ../init.d/lprng $s; 57 ln -s ../init.d/lprng $s; 58 done 59 if [ "$MAKEPACKAGE" != "YES" ]; then 60 if grep '^printer' /etc/inetd.conf >/dev/null; then 61 echo "Removing printer service from inetd.conf" 62 ${INSTALL} -m 644 /etc/inetd.conf /etc/inetd.conf.orig 63 sed -e 's/^printer/#printer/' < /etc/inetd.conf.orig >/etc/inetd.conf 64 echo "Restarting inetd" 65 kill -HUP `ps ${PSHOWALL} | awk '/inetd/{ print $1;}'` >/dev/null 2>&1 66 fi 67 if [ -x /usr/sbin/lpshut ] ; then 68 echo "Stopping lpsched" 69 lpshut 70 fi; 71 for i in `ls /etc/*.d/*lp 2>/dev/null` ; do 72 echo saving $i 73 f=`basename $i`; d=`dirname $i`; 74 mv $i $d/UNUSED.$f.orig 75 done 76 echo "Stopping lpd" 77 kill -INT `ps ${PSHOWALL} | awk '/lpd/{ print $1;}'` >/dev/null 2>&1 78 sleep 2 79 echo "Checking printcap" 80 ${SBINDIR}/checkpc -f 81 echo "Starting lprng lpd server" 82 sh $init start 83 fi; 84fi; 85exit 0 86