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