Line 0
Link Here
|
|
|
1 |
#!/bin/sh |
2 |
PREFIX=/usr/local |
3 |
LPD_PATH="/usr/local/sbin/lpd" |
4 |
INSTALL="/usr/bin/install -c -o root -g wheel" |
5 |
LPD_PERMS_PATH="/usr/local/etc/lpd.perms" |
6 |
LPD_CONF_PATH="/usr/local/etc/lpd.conf" |
7 |
PRINTCAP_PATH="/usr/local/etc/printcap" |
8 |
SYSCONFDIR=/usr/local/etc |
9 |
SBINDIR=/usr/local/sbin |
10 |
FILTER_DIR=/usr/local/libexec/filters |
11 |
LOCKFILE="/var/run/lpd" |
12 |
PSHOWALL="-ax" |
13 |
VERSION=3.8.21 |
14 |
INIT= |
15 |
MANDIR=/usr/local/man |
16 |
# |
17 |
# -- START -- |
18 |
# postinstall.freebsd.sh,v 1.1 2001/08/21 20:33:16 root Exp |
19 |
# |
20 |
# If you are building a PORT, see the |
21 |
# DISTRIBUTIONS/Freebsd directory for a complete port |
22 |
# building package. |
23 |
# |
24 |
# This is the shell script that does the postinstall |
25 |
# dynamic fixup |
26 |
# It needs to be massaged with the information for |
27 |
# various paths. |
28 |
# If you are building a package, then you do NOT want |
29 |
# to have this executed - it will put the sample files |
30 |
# in place. You need to do this during the postinstall |
31 |
# step in the package installation. |
32 |
# |
33 |
echo RUNNING postinstall.freebsd.sh parms "'$0 $@'" MAKEPACKAGE="$MAKEPACKAGE" MAKEINSTALL="$MAKEINSTALL" PREFIX="$PREFIX" INIT="$INIT" cwd `pwd` |
34 |
if [ "$VERBOSE_INSTALL" != "" ] ; then set -x; fi |
35 |
fix () { |
36 |
v=`echo $1 | sed -e 's/[:;].*//'`; |
37 |
p=`echo $2 | sed -e 's/:.*//'`; d=`dirname $p`; |
38 |
if expr "$p" : "\|" >/dev/null ; then |
39 |
echo "$v is a filter '$p'" |
40 |
return 0 |
41 |
fi |
42 |
echo "Putting $p in $d, using $v.sample" |
43 |
if [ ! -d "$d" ] ; then |
44 |
echo "Directory $d does not exist!" |
45 |
mkdir -p $d |
46 |
fi |
47 |
if [ -f $v.sample ] ; then |
48 |
if [ $v.sample != $p.sample ] ; then cp $v.sample $p.sample; fi |
49 |
elif [ -f $v ] ; then |
50 |
if [ $v != $p.sample ] ; then cp $v $p.sample; fi |
51 |
else |
52 |
echo "Do not have $v.sample or $v" |
53 |
fi |
54 |
if [ ! -f $p.sample ] ; then |
55 |
echo "Do not have $p.sample" |
56 |
elif [ ! -f $p ] ; then |
57 |
chmod 644 $p.sample |
58 |
cp $p.sample $p; |
59 |
chmod 644 $p; |
60 |
fi; |
61 |
} |
62 |
# we use the /usr/local/etc/rc.d method to start |
63 |
# lpd |
64 |
# we have to take them from one place and put in another |
65 |
if [ "X$MAKEPACKAGE" = "XYES" ] ; then |
66 |
hold=${DESTDIR}${PREFIX}/etc |
67 |
echo "Setting up configuration files path for package" ${hold} |
68 |
# we put files into the destination |
69 |
if [ ! -d ${hold} ] ; then mkdir -p ${hold} ; fi; |
70 |
cp lpd.perms ${hold}/lpd.perms.sample |
71 |
cp lpd.conf ${hold}/lpd.conf.sample |
72 |
cp printcap ${hold}/printcap.sample |
73 |
if [ "$INIT" != no ] ; then |
74 |
cp init.freebsd ${hold}/lprng.sh |
75 |
fi |
76 |
elif [ "X$MAKEINSTALL" = XYES ] ; then |
77 |
# we have the port pre-install operation |
78 |
if [ "$MANDIR" = "/usr/man" -a ! -d ${DESTDIR}/usr/man ] ; then |
79 |
# we have the dreaded standard installation |
80 |
# try to make a symbolic link to |
81 |
echo "Creating symbolic link from /usr/man to /usr/share/man" |
82 |
v=`ln -s ${DESTDIR}/usr/share/man ${DESTDIR}/usr/man`; |
83 |
fi |
84 |
echo "Setting up configuration files path for installation" ${hold} |
85 |
hold=${DESTDIR}${PREFIX}/etc |
86 |
if [ ! -d ${hold} ] ; then mkdir -p ${hold} ; fi; |
87 |
cp lpd.perms ${hold}/lpd.perms.sample |
88 |
cp lpd.conf ${hold}/lpd.conf.sample |
89 |
cp printcap ${hold}/printcap.sample |
90 |
|
91 |
fix ${hold}/lpd.perms "${DESTDIR}${LPD_PERMS_PATH}" |
92 |
fix ${hold}/lpd.conf "${DESTDIR}${LPD_CONF_PATH}" |
93 |
fix ${hold}/printcap "${DESTDIR}${PRINTCAP_PATH}" |
94 |
|
95 |
if [ "$INIT" != no ] ; then |
96 |
if [ -f /etc/rc.conf ] ; then |
97 |
perl -spi.bak -e 's/^lpd_enable/#lpd_enable/;' ${DESTDIR}/etc/rc.conf |
98 |
fi |
99 |
cp init.freebsd ${hold}/lprng.sh |
100 |
init=${DESTDIR}/usr/local/etc/rc.d/lprng.sh |
101 |
echo "Setting up init script $init using init.freebsd" |
102 |
if [ ! -d `dirname $init` ] ; then mkdir -p `dirname $init ` ; fi; |
103 |
rm -f $init |
104 |
cp init.freebsd $init |
105 |
chmod 744 $init |
106 |
|
107 |
echo "Stopping LPD" |
108 |
kill -INT `ps ${PSHOWALL} | awk '/lpd/{ print $1;}'` >/dev/null 2>&1 |
109 |
sleep 2; |
110 |
# check the printcap information |
111 |
echo "Checking Printcap Info and fixing permissions" |
112 |
${SBINDIR}/checkpc -f |
113 |
# restart the server |
114 |
echo "Restarting server" |
115 |
sh $init start |
116 |
fi |
117 |
elif [ "X$2" = "XPOST-INSTALL" ] ; then |
118 |
# when doing an install from a package we get the file from the package |
119 |
hold=etc |
120 |
if [ -f ${hold}/lpd.perms.sample ] ; then |
121 |
fix ${hold}/lpd.perms "${LPD_PERMS_PATH}" |
122 |
fix ${hold}/lpd.conf "${LPD_CONF_PATH}" |
123 |
fix ${hold}/printcap "${PRINTCAP_PATH}" |
124 |
if [ "$INIT" != no ] ; then |
125 |
init=/usr/local/etc/rc.d/lprng.sh |
126 |
cp ${hold}/lprng.sh $init; |
127 |
chmod 755 $init; |
128 |
if [ -f /etc/rc.conf ] ; then |
129 |
perl -spi.bak -e 's/^lpd_enable/#lpd_enable/;' /etc/rc.conf |
130 |
fi |
131 |
fi |
132 |
else |
133 |
echo "WARNING: configuration files missing from package! CWD " `pwd` |
134 |
ls |
135 |
exit 1 |
136 |
fi |
137 |
elif [ "X$2" = "XPRE-INSTALL" ] ; then |
138 |
# we have the port pre-install operation |
139 |
if [ "$MANDIR" = "/usr/man" -a ! -d /usr/man ] ; then |
140 |
# we have the dreaded standard installation |
141 |
# try to make a symbolic link to |
142 |
echo "Creating symbolic link from /usr/man to /usr/share/man" |
143 |
v=`ln -s /usr/share/man /usr/man`; |
144 |
fi |
145 |
fi |
146 |
exit 0 |