Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions docker-php-ext-install
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ for ext; do
if [ -z "$ext" ]; then
continue
fi
if ! grep -qE "^$ext$" /usr/src/php-available-exts; then
echo >&2 "error: /usr/src/php/ext/$ext does not exist"
echo >&2
usage >&2
exit 1
if ! grep -qE "^$ext$" /usr/src/php-available-exts ; then
if [ ! -d "/usr/src/php/ext/$ext" ] ; then
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nested if as its not that easy to make some XOR in shell scripts.

echo >&2 "error: /usr/src/php/ext/$ext does not exist"
echo >&2
usage >&2
exit 1
fi
fi
exts="$exts $ext"
done
Expand Down
7 changes: 6 additions & 1 deletion docker-php-source
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ case "$1" in
echo >&2 "$dir exists and is not a directory"
exit 1
fi
if [ ! -d "$dir" ]; then
if [[ ! -d "$dir" || $(ls -1 "$dir") == "ext" ]]; then
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just don't check that ext is a directory here... but I think we shouldn't care because people in this case would intentionally make their builds fail I guess ^^

mkdir -p "$dir"
tar -Jxf /usr/src/php.tar.xz -C "$dir" --strip-components=1

Expand All @@ -36,6 +36,11 @@ case "$1" in
;;
delete)
rm -rf "$dir"
# To maintain BC we create this directory because many people
# were extracting some of their custom extensions in this directory
# See https://github.com/docker-library/php/issues/266
# Was breaked by https://github.com/docker-library/php/pull/256
mkdir -p "$dir/ext"
;;
*)
usage
Expand Down