| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
MERGEDIR=$1; shift |
| 4 |
AP2MODS=opt/csw/apache2/ap2mod |
| 5 |
|
| 6 |
cd $MERGEDIR/ |
| 7 |
|
| 8 |
[ -d $AP2MODS ] || mkdir -p $AP2MODS |
| 9 |
|
| 10 |
for a in $*; do |
| 11 |
for f in $(find . -name "*$a*"); do |
| 12 |
modfile=$(basename $f) |
| 13 |
modname=$(echo $modfile | sed 's/^mod_//; s/^lib//; s/\.so$//') |
| 14 |
ap2modfile=$AP2MODS/$modname |
| 15 |
cat <<EOF > $ap2modfile |
| 16 |
|
| 17 |
PIR=\${PKG_INSTALL_ROOT:-'/'} |
| 18 |
AP2_PREFIX=/opt/csw/apache2 |
| 19 |
AP2_BINDIR=\$AP2_PREFIX/sbin |
| 20 |
AP2_LIBEXEC=\$AP2_PREFIX/libexec |
| 21 |
AP2_CONFDIR=\$AP2_PREFIX/etc |
| 22 |
AP2_CONFIG=\$AP2_CONFDIR/httpd.conf |
| 23 |
AP2_APXS=\$AP2_BINDIR/apxs |
| 24 |
|
| 25 |
if [ "\$1" = install ]; then |
| 26 |
|
| 27 |
echo "File created by \$PKGINST during install. Please do not remove." > \$PIR/$ap2modfile |
| 28 |
|
| 29 |
# Source csw.conf, if it exists |
| 30 |
if [ -f \$PIR/opt/csw/etc/csw.conf ] ; then |
| 31 |
. \$PIR/opt/csw/etc/csw.conf |
| 32 |
fi |
| 33 |
if [ -f \$PIR/etc/opt/csw/csw.conf ] ; then |
| 34 |
. \$PIR/etc/opt/csw/csw.conf |
| 35 |
fi |
| 36 |
|
| 37 |
# Modules will be enabled by default, but a global kill switch |
| 38 |
# is checked , followed by a module specific value. Thus, |
| 39 |
# either ap2_enable_modules or ap2_enable_suexec (for example) |
| 40 |
# could disable activation of the suexec module. The |
| 41 |
# |
| 42 |
# This value is passed to apxs (-a: add, enable; -A: add, |
| 43 |
# disable) |
| 44 |
enmod=-a |
| 45 |
|
| 46 |
if [ "\$ap2_enable_modules" = "no" ]; then |
| 47 |
enmod=-A |
| 48 |
fi |
| 49 |
|
| 50 |
if [ "\$ap2_enable_$modname" = "no" ]; then |
| 51 |
enmod=-A |
| 52 |
elif [ "$ap2_mod_specific" = "yes" ]; then |
| 53 |
enmod=-a |
| 54 |
fi |
| 55 |
|
| 56 |
if [ -f "\$PIR/\$AP2_CONFIG" -a -x "\$PIR/\$AP2_APXS" ]; then |
| 57 |
# Add the module module, optionally enabling it by default |
| 58 |
chroot \$PIR \$AP2_APXS -e \$enmod -n $modname $modfile |
| 59 |
fi |
| 60 |
|
| 61 |
else |
| 62 |
|
| 63 |
rm \$PIR/$ap2modfile |
| 64 |
|
| 65 |
if [ -f "\$PIR/\$AP2_CONFIG" -a -x "\$PIR/\$AP2_APXS" ]; then |
| 66 |
chroot \$PIR \$AP2_APXS -e -A -n $modname $modfile |
| 67 |
fi |
| 68 |
fi |
| 69 |
EOF |
| 70 |
done |
| 71 |
done |