diff options
Diffstat (limited to 'sysutils/LPRng/pkg-install')
-rw-r--r-- | sysutils/LPRng/pkg-install | 128 |
1 files changed, 77 insertions, 51 deletions
diff --git a/sysutils/LPRng/pkg-install b/sysutils/LPRng/pkg-install index d6e3b2284d17..238018dccdb0 100644 --- a/sysutils/LPRng/pkg-install +++ b/sysutils/LPRng/pkg-install @@ -2,15 +2,16 @@ PREFIX=/usr/local LPD_PATH="/usr/local/sbin/lpd" INSTALL="/usr/bin/install -c -o root -g wheel" -LPD_PERMS_PATH="/usr/local/etc/lpd.perms" -LPD_CONF_PATH="/usr/local/etc/lpd.conf" +LPD_PERMS_PATH="/usr/local/etc/lpd/lpd.perms" +LPD_CONF_PATH="/usr/local/etc/lpd/lpd.conf" PRINTCAP_PATH="/usr/local/etc/printcap" SYSCONFDIR=/usr/local/etc SBINDIR=/usr/local/sbin FILTER_DIR=/usr/local/libexec/filters LOCKFILE="/var/run/lpd" +CONFIG_SUBDIR=lpd PSHOWALL="-ax" -VERSION=3.8.21 +VERSION=3.8.23 INIT= MANDIR=/usr/local/man # @@ -32,6 +33,7 @@ MANDIR=/usr/local/man # echo RUNNING postinstall.freebsd.sh parms "'$0 $@'" MAKEPACKAGE="$MAKEPACKAGE" MAKEINSTALL="$MAKEINSTALL" PREFIX="$PREFIX" INIT="$INIT" cwd `pwd` if [ "$VERBOSE_INSTALL" != "" ] ; then set -x; fi + fix () { v=`echo $1 | sed -e 's/[:;].*//'`; p=`echo $2 | sed -e 's/:.*//'`; d=`dirname $p`; @@ -44,36 +46,66 @@ fix () { echo "Directory $d does not exist!" mkdir -p $d fi + old_version=` echo $p | sed -e "s,/$CONFIG_SUBDIR/,/,"` + if [ ! -f "$p" -a "$old_version" != "$p" -a -f "$old_version" ] ; then + echo "WARNING: Location of $p changed from $old_version" + echo " Copying $old_version to $p" + cp "$old_version" "$p" || echo "cannot copy $old_version to $p" + fi if [ -f $v.sample ] ; then - if [ $v.sample != $p.sample ] ; then cp $v.sample $p.sample; fi + if [ $v.sample != $p.sample ] ; then ${INSTALL} $v.sample $p.sample; fi elif [ -f $v ] ; then - if [ $v != $p.sample ] ; then cp $v $p.sample; fi + if [ $v != $p.sample ] ; then ${INSTALL} $v $p.sample; fi else echo "Do not have $v.sample or $v" fi if [ ! -f $p.sample ] ; then echo "Do not have $p.sample" elif [ ! -f $p ] ; then - chmod 644 $p.sample - cp $p.sample $p; - chmod 644 $p; + ${INSTALL} -m 644 $p.sample $p; fi; } + +startserver(){ + cnf=${DESTDIR}/etc/rc.conf + if [ -f ${cnf} ] ; then + if grep lprng ${cnf} ; then + : # no changes + else + echo 'lprng_enable="YES"' >> ${cnf} + fi + fi + echo "Stopping LPD" + killall lpd || true + sleep 2; + # check the printcap information + echo "Checking Printcap Info and fixing permissions" + ${SBINDIR}/checkpc -f || true + # restart the server + echo "Restarting server" + sh $init start || true + echo "Done" +} + # we use the /usr/local/etc/rc.d method to start -# lpd +init=${DESTDIR}/usr/local/etc/rc.d/lprng.sh + # we have to take them from one place and put in another if [ "X$MAKEPACKAGE" = "XYES" ] ; then - hold=${DESTDIR}${PREFIX}/etc + hold=${DESTDIR}${SYSCONFDIR}/lpd echo "Setting up configuration files path for package" ${hold} # we put files into the destination if [ ! -d ${hold} ] ; then mkdir -p ${hold} ; fi; - cp lpd.perms ${hold}/lpd.perms.sample - cp lpd.conf ${hold}/lpd.conf.sample - cp printcap ${hold}/printcap.sample - if [ "$INIT" != no ] ; then - cp init.freebsd ${hold}/lprng.sh - fi -elif [ "X$MAKEINSTALL" = XYES ] ; then + ${INSTALL} lpd.perms ${hold}/lpd.perms.sample + ${INSTALL} lpd.conf ${hold}/lpd.conf.sample + ${INSTALL} printcap ${hold}/printcap.sample + ${INSTALL} init.freebsd ${hold}/lprng.sh.sample + exit 0 +fi + +if [ "X$MAKEINSTALL" = XYES ] ; then + hold=${DESTDIR}${SYSCONFDIR}/lpd + echo "Setting up configuration files path for installation" ${hold} # we have the port pre-install operation if [ "$MANDIR" = "/usr/man" -a ! -d ${DESTDIR}/usr/man ] ; then # we have the dreaded standard installation @@ -81,60 +113,53 @@ elif [ "X$MAKEINSTALL" = XYES ] ; then echo "Creating symbolic link from /usr/man to /usr/share/man" v=`ln -s ${DESTDIR}/usr/share/man ${DESTDIR}/usr/man`; fi - echo "Setting up configuration files path for installation" ${hold} - hold=${DESTDIR}${PREFIX}/etc if [ ! -d ${hold} ] ; then mkdir -p ${hold} ; fi; - cp lpd.perms ${hold}/lpd.perms.sample - cp lpd.conf ${hold}/lpd.conf.sample - cp printcap ${hold}/printcap.sample + ${INSTALL} lpd.perms ${hold}/lpd.perms.sample + ${INSTALL} lpd.conf ${hold}/lpd.conf.sample + ${INSTALL} printcap ${hold}/printcap.sample + ${INSTALL} init.freebsd ${hold}/lprng.sh.sample fix ${hold}/lpd.perms "${DESTDIR}${LPD_PERMS_PATH}" fix ${hold}/lpd.conf "${DESTDIR}${LPD_CONF_PATH}" fix ${hold}/printcap "${DESTDIR}${PRINTCAP_PATH}" - if [ "$INIT" != no ] ; then - if [ -f /etc/rc.conf ] ; then - perl -spi.bak -e 's/^lpd_enable/#lpd_enable/;' ${DESTDIR}/etc/rc.conf - fi - cp init.freebsd ${hold}/lprng.sh - init=${DESTDIR}/usr/local/etc/rc.d/lprng.sh echo "Setting up init script $init using init.freebsd" if [ ! -d `dirname $init` ] ; then mkdir -p `dirname $init ` ; fi; rm -f $init - cp init.freebsd $init - chmod 744 $init + ${INSTALL} -m 755 init.freebsd $init + #startserver; + fi - echo "Stopping LPD" - kill -INT `ps ${PSHOWALL} | awk '/lpd/{ print $1;}'` >/dev/null 2>&1 - sleep 2; - # check the printcap information - echo "Checking Printcap Info and fixing permissions" - ${SBINDIR}/checkpc -f - # restart the server - echo "Restarting server" - sh $init start - fi -elif [ "X$2" = "XPOST-INSTALL" ] ; then - # when doing an install from a package we get the file from the package - hold=etc + exit 0 +fi + +# run from a package +if [ "X$2" = "XPOST-INSTALL" ] ; then + # when doing an install from a package we get the file from the hold locations + hold=etc/lpd + echo "Installing configuration files from `pwd` - $hold - `ls $hold`" if [ -f ${hold}/lpd.perms.sample ] ; then fix ${hold}/lpd.perms "${LPD_PERMS_PATH}" fix ${hold}/lpd.conf "${LPD_CONF_PATH}" fix ${hold}/printcap "${PRINTCAP_PATH}" + echo "Setting up init script $init.sample using ${hold}/lprng.sh.sample" + ${INSTALL} -c -m 755 ${hold}/lprng.sh.sample $init.sample; if [ "$INIT" != no ] ; then - init=/usr/local/etc/rc.d/lprng.sh - cp ${hold}/lprng.sh $init; - chmod 755 $init; - if [ -f /etc/rc.conf ] ; then - perl -spi.bak -e 's/^lpd_enable/#lpd_enable/;' /etc/rc.conf - fi + echo "Setting up init script $init using $init.sample" + ${INSTALL} -c -m 755 $init.sample $init; + #startserver; fi else echo "WARNING: configuration files missing from package! CWD " `pwd` - ls + echo "Contents" + ls + echo "Hold $hold" + ls $hold exit 1 fi -elif [ "X$2" = "XPRE-INSTALL" ] ; then + exit 0; +fi +if [ "X$2" = "XPRE-INSTALL" ] ; then # we have the port pre-install operation if [ "$MANDIR" = "/usr/man" -a ! -d /usr/man ] ; then # we have the dreaded standard installation @@ -142,5 +167,6 @@ elif [ "X$2" = "XPRE-INSTALL" ] ; then echo "Creating symbolic link from /usr/man to /usr/share/man" v=`ln -s /usr/share/man /usr/man`; fi + exit 0 fi exit 0 |