php/5.6/apache/docker-php-source

45 lines
887 B
Plaintext
Raw Normal View History

2016-07-13 02:15:01 +02:00
#!/bin/sh
set -e
dir=/usr/src/php
usage() {
echo "usage: $0 COMMAND"
echo
echo "Manage php source tarball lifecycle."
echo
echo "Commands:"
echo " extract extract php source tarball into directory $dir if not already done."
echo " delete delete extracted php source located into $dir if not already done."
echo
}
case "$1" in
extract)
if [ -e "$dir" -a ! -d "$dir" ] ; then
echo >&2 "$dir exists and is not a directory"
exit 1
fi
if [ ! -d "$dir" ]; then
mkdir -p "$dir"
tar -Jxf /usr/src/php.tar.xz -C "$dir" --strip-components=1
if [ ! -f /usr/src/php-available-exts ]; then
find "$dir/ext" \
-mindepth 2 \
-maxdepth 2 \
-type f \
-name 'config.m4' \
| xargs -n1 dirname | xargs -n1 basename | sort \
> /usr/src/php-available-exts
fi
fi
;;
delete)
rm -rf "$dir"
;;
*)
usage
exit 1
;;
esac