2016-07-13 02:12:43 +02:00
|
|
|
#!/bin/sh
|
|
|
|
set -e
|
2016-08-09 23:28:11 +02:00
|
|
|
|
2016-07-13 02:12:43 +02:00
|
|
|
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)
|
2016-08-09 23:28:11 +02:00
|
|
|
mkdir -p "$dir"
|
|
|
|
if [ ! -f "$dir/.docker-extracted" ]; then
|
2016-07-13 02:12:43 +02:00
|
|
|
tar -Jxf /usr/src/php.tar.xz -C "$dir" --strip-components=1
|
2016-08-09 23:28:11 +02:00
|
|
|
touch "$dir/.docker-extracted"
|
2016-07-13 02:12:43 +02:00
|
|
|
fi
|
|
|
|
;;
|
2016-08-09 23:28:11 +02:00
|
|
|
|
2016-07-13 02:12:43 +02:00
|
|
|
delete)
|
|
|
|
rm -rf "$dir"
|
|
|
|
;;
|
2016-08-09 23:28:11 +02:00
|
|
|
|
2016-07-13 02:12:43 +02:00
|
|
|
*)
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|