37 lines
858 B
Bash
37 lines
858 B
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
usage() {
|
|
echo "usage: $0 [channel/]<package> ..."
|
|
echo " ie: $0 uploadprogress oauth-1.2.3"
|
|
}
|
|
|
|
if [ $# -eq 0 ]; then
|
|
usage >&2
|
|
exit 1
|
|
fi
|
|
|
|
pecl install "$@"
|
|
|
|
while [ $# -gt 0 ]; do
|
|
ext="$1"
|
|
ext=$(echo "$ext" | cut -d- -f1)
|
|
ext=$(echo "$ext" | cut -d\/ -f2)
|
|
shift
|
|
|
|
for module in $(find /usr/local/lib/php/extensions -name "$ext.so"); do
|
|
ini="/usr/local/etc/php/conf.d/docker-php-pecl-$ext.ini"
|
|
if grep -q zend_extension_entry "$module"; then
|
|
# https://wiki.php.net/internals/extensions#loading_zend_extensions
|
|
line="zend_extension=$(readlink -f "$module")"
|
|
else
|
|
line="extension=$(basename "$module")"
|
|
fi
|
|
if ! grep -q "$line" "$ini" 2>/dev/null; then
|
|
echo "$line" >> "$ini"
|
|
fi
|
|
done
|
|
done
|
|
|
|
rm -rf /tmp/*
|