mirror of
https://github.com/danog/php.git
synced 2024-12-02 17:38:24 +01:00
45 lines
887 B
Plaintext
45 lines
887 B
Plaintext
|
#!/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
|