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