|
Line 0
Link Here
|
|
|
1 |
#!/bin/sh |
| 2 |
PREFIX=/usr |
| 3 |
SYSCONFDIR=/etc |
| 4 |
IFHP_CONF=/etc/ifhp.conf |
| 5 |
MANDIR=/usr/man |
| 6 |
VERSION=3.5.6 |
| 7 |
# |
| 8 |
# -- START -- |
| 9 |
# $Id: postinstall.freebsd.sh,v 1.9 2001/12/12 01:54:49 papowell Exp papowell $ |
| 10 |
# |
| 11 |
# If you are building a PORT, see the |
| 12 |
# DISTRIBUTIONS/Freebsd directory for a complete port |
| 13 |
# building package. |
| 14 |
# |
| 15 |
# This is the shell script that does the postinstall |
| 16 |
# dynamic fixup |
| 17 |
# It needs to be massaged with the information for |
| 18 |
# various paths. |
| 19 |
# If you are building a package, then you do NOT want |
| 20 |
# to have this executed - it will put the sample files |
| 21 |
# in place. You need to do this during the postinstall |
| 22 |
# step in the package installation. |
| 23 |
# |
| 24 |
echo RUNNING postinstall.freebsd.sh MAKEPACKAGE="$MAKEPACKAGE" MAKEINSTALL="$MAKEINSTALL" PREFIX="$PREFIX" cwd `pwd` |
| 25 |
if [ "$VERBOSE_INSTALL" != "" ] ; then set -x; fi |
| 26 |
fix () { |
| 27 |
v=`echo $1 | sed -e 's/[:;].*//'`; |
| 28 |
p=`echo $2 | sed -e 's/:.*//'`; d=`dirname $p`; |
| 29 |
if expr "$p" : "\|" >/dev/null ; then |
| 30 |
echo "$v is a filter '$p'" |
| 31 |
exit 0 |
| 32 |
fi |
| 33 |
echo "Putting $p in $d, using $v.sample" |
| 34 |
if [ ! -d "$d" ] ; then |
| 35 |
echo "Directory $d does not exist!" |
| 36 |
mkdir -p $d |
| 37 |
fi |
| 38 |
if [ -f $v.sample ] ; then |
| 39 |
if [ $v.sample != $p.sample ] ; then cp $v.sample $p.sample; fi |
| 40 |
elif [ -f $v ] ; then |
| 41 |
if [ $v != $p.sample ] ; then cp $v $p.sample; fi |
| 42 |
else |
| 43 |
echo "Do not have $v.sample or $v" |
| 44 |
fi |
| 45 |
if [ ! -f $p.sample ] ; then |
| 46 |
echo "Do not have $p.sample" |
| 47 |
else |
| 48 |
if [ -f $p ] ; then |
| 49 |
date=`date | awk '{ print $6, $2, $3, $4;}' | sed -e 's/ */_/g' ` |
| 50 |
echo "Saving $p in $p.$date" |
| 51 |
mv $p $p.$date |
| 52 |
fi |
| 53 |
chmod 644 $p.sample |
| 54 |
cp $p.sample $p; |
| 55 |
chmod 644 $p; |
| 56 |
fi; |
| 57 |
} |
| 58 |
# we use the /usr/local/etc/rc.d method to start |
| 59 |
# lpd |
| 60 |
# we have to take them from one place and put in another |
| 61 |
if [ "X$MAKEPACKAGE" = "XYES" ] ; then |
| 62 |
hold=${DESTDIR}${PREFIX}/etc |
| 63 |
echo "Setting up configuration files path for package creation" ${hold} |
| 64 |
if [ ! -d ${hold} ] ; then mkdir -p ${hold} ; fi; |
| 65 |
cp ifhp.conf ${hold}/ifhp.conf.sample |
| 66 |
elif [ X$MAKEINSTALL = XYES ] ; then |
| 67 |
# we have the port pre-install operation |
| 68 |
if [ "$MANDIR" = "/usr/man" -a ! -d ${DESTDIR}/usr/man ] ; then |
| 69 |
# we have the dreaded standard installation |
| 70 |
# try to make a symbolic link to |
| 71 |
echo "Creating symbolic link from /usr/man to /usr/share/man" |
| 72 |
v=`ln -s ${DESTDIR}/usr/share/man ${DESTDIR}/usr/man`; |
| 73 |
fi |
| 74 |
hold=${DESTDIR}${PREFIX}/etc |
| 75 |
echo "Setting up configuration files path for installation" ${hold} |
| 76 |
if [ ! -d ${hold} ] ; then mkdir -p ${hold} ; fi; |
| 77 |
cp ifhp.conf ${hold}/ifhp.conf.sample |
| 78 |
fix ifhp.conf "${DESTDIR}${IFHP_CONF}" |
| 79 |
elif [ "X$2" = "XPOST-INSTALL" ] ; then |
| 80 |
# when doing an install from a package we get the file from the package |
| 81 |
hold=etc |
| 82 |
if [ -f ${hold}/ifhp.conf.sample ] ; then |
| 83 |
fix ${hold}/ifhp.conf "${IFHP_CONF}" |
| 84 |
else |
| 85 |
echo "WARNING: configuration files missing from package! CWD " `pwd` |
| 86 |
ls |
| 87 |
exit 1 |
| 88 |
fi |
| 89 |
elif [ "X$2" = "XPRE-INSTALL" ] ; then |
| 90 |
# we have the port pre-install operation |
| 91 |
if [ "$MANDIR" = "/usr/man" -a ! -d /usr/man ] ; then |
| 92 |
# we have the dreaded standard installation |
| 93 |
# try to make a symbolic link to |
| 94 |
echo "Creating symbolic link from /usr/man to /usr/share/man" |
| 95 |
v=`ln -s /usr/share/man /usr/man`; |
| 96 |
fi |
| 97 |
fi |
| 98 |
exit 0 |