Skip to content

Commit

Permalink
Fix a few superficial issues with "docker-php-ext-enable"
Browse files Browse the repository at this point in the history
  • Loading branch information
tianon committed Apr 19, 2018
1 parent 6a28b28 commit f504394
Show file tree
Hide file tree
Showing 32 changed files with 352 additions and 128 deletions.
15 changes: 11 additions & 4 deletions 5.6/alpine3.4/cli/docker-php-ext-enable
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/sh
set -e

cd "$(php -r 'echo ini_get("extension_dir");')"
extDir="$(php -r 'echo ini_get("extension_dir");')"
cd "$extDir"

usage() {
echo "usage: $0 [options] module-name [module-name ...]"
Expand All @@ -10,7 +11,12 @@ usage() {
echo " $0 --ini-name 0-apc.ini apcu apc"
echo
echo 'Possible values for module-name:'
echo $(find -maxdepth 1 -type f -name '*.so' -exec basename '{}' ';' | sort)
find -maxdepth 1 \
-type f \
-name '*.so' \
-exec basename '{}' ';' \
| sort \
| xargs
echo
echo 'Some of the above modules are already compiled into PHP; please check'
echo 'the output of "php -i" to see which modules are already loaded.'
Expand Down Expand Up @@ -47,7 +53,7 @@ for module; do
module="$module.so"
fi
if ! [ -f "$module" ]; then
echo >&2 "error: $(readlink -f "$module") does not exist"
echo >&2 "error: '$module' does not exist"
echo >&2
usage >&2
exit 1
Expand Down Expand Up @@ -80,7 +86,8 @@ fi
for module in $modules; do
if readelf --wide --syms "$module" | grep -q ' zend_extension_entry$'; then
# https://wiki.php.net/internals/extensions#loading_zend_extensions
line="zend_extension=$(readlink -f "$module")"
absModule="$(readlink -f "$module")"
line="zend_extension=$absModule"
else
line="extension=$module"
fi
Expand Down
15 changes: 11 additions & 4 deletions 5.6/alpine3.4/fpm/docker-php-ext-enable
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/sh
set -e

cd "$(php -r 'echo ini_get("extension_dir");')"
extDir="$(php -r 'echo ini_get("extension_dir");')"
cd "$extDir"

usage() {
echo "usage: $0 [options] module-name [module-name ...]"
Expand All @@ -10,7 +11,12 @@ usage() {
echo " $0 --ini-name 0-apc.ini apcu apc"
echo
echo 'Possible values for module-name:'
echo $(find -maxdepth 1 -type f -name '*.so' -exec basename '{}' ';' | sort)
find -maxdepth 1 \
-type f \
-name '*.so' \
-exec basename '{}' ';' \
| sort \
| xargs
echo
echo 'Some of the above modules are already compiled into PHP; please check'
echo 'the output of "php -i" to see which modules are already loaded.'
Expand Down Expand Up @@ -47,7 +53,7 @@ for module; do
module="$module.so"
fi
if ! [ -f "$module" ]; then
echo >&2 "error: $(readlink -f "$module") does not exist"
echo >&2 "error: '$module' does not exist"
echo >&2
usage >&2
exit 1
Expand Down Expand Up @@ -80,7 +86,8 @@ fi
for module in $modules; do
if readelf --wide --syms "$module" | grep -q ' zend_extension_entry$'; then
# https://wiki.php.net/internals/extensions#loading_zend_extensions
line="zend_extension=$(readlink -f "$module")"
absModule="$(readlink -f "$module")"
line="zend_extension=$absModule"
else
line="extension=$module"
fi
Expand Down
15 changes: 11 additions & 4 deletions 5.6/alpine3.4/zts/docker-php-ext-enable
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/sh
set -e

cd "$(php -r 'echo ini_get("extension_dir");')"
extDir="$(php -r 'echo ini_get("extension_dir");')"
cd "$extDir"

usage() {
echo "usage: $0 [options] module-name [module-name ...]"
Expand All @@ -10,7 +11,12 @@ usage() {
echo " $0 --ini-name 0-apc.ini apcu apc"
echo
echo 'Possible values for module-name:'
echo $(find -maxdepth 1 -type f -name '*.so' -exec basename '{}' ';' | sort)
find -maxdepth 1 \
-type f \
-name '*.so' \
-exec basename '{}' ';' \
| sort \
| xargs
echo
echo 'Some of the above modules are already compiled into PHP; please check'
echo 'the output of "php -i" to see which modules are already loaded.'
Expand Down Expand Up @@ -47,7 +53,7 @@ for module; do
module="$module.so"
fi
if ! [ -f "$module" ]; then
echo >&2 "error: $(readlink -f "$module") does not exist"
echo >&2 "error: '$module' does not exist"
echo >&2
usage >&2
exit 1
Expand Down Expand Up @@ -80,7 +86,8 @@ fi
for module in $modules; do
if readelf --wide --syms "$module" | grep -q ' zend_extension_entry$'; then
# https://wiki.php.net/internals/extensions#loading_zend_extensions
line="zend_extension=$(readlink -f "$module")"
absModule="$(readlink -f "$module")"
line="zend_extension=$absModule"
else
line="extension=$module"
fi
Expand Down
15 changes: 11 additions & 4 deletions 5.6/jessie/apache/docker-php-ext-enable
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/sh
set -e

cd "$(php -r 'echo ini_get("extension_dir");')"
extDir="$(php -r 'echo ini_get("extension_dir");')"
cd "$extDir"

usage() {
echo "usage: $0 [options] module-name [module-name ...]"
Expand All @@ -10,7 +11,12 @@ usage() {
echo " $0 --ini-name 0-apc.ini apcu apc"
echo
echo 'Possible values for module-name:'
echo $(find -maxdepth 1 -type f -name '*.so' -exec basename '{}' ';' | sort)
find -maxdepth 1 \
-type f \
-name '*.so' \
-exec basename '{}' ';' \
| sort \
| xargs
echo
echo 'Some of the above modules are already compiled into PHP; please check'
echo 'the output of "php -i" to see which modules are already loaded.'
Expand Down Expand Up @@ -47,7 +53,7 @@ for module; do
module="$module.so"
fi
if ! [ -f "$module" ]; then
echo >&2 "error: $(readlink -f "$module") does not exist"
echo >&2 "error: '$module' does not exist"
echo >&2
usage >&2
exit 1
Expand Down Expand Up @@ -80,7 +86,8 @@ fi
for module in $modules; do
if readelf --wide --syms "$module" | grep -q ' zend_extension_entry$'; then
# https://wiki.php.net/internals/extensions#loading_zend_extensions
line="zend_extension=$(readlink -f "$module")"
absModule="$(readlink -f "$module")"
line="zend_extension=$absModule"
else
line="extension=$module"
fi
Expand Down
15 changes: 11 additions & 4 deletions 5.6/jessie/cli/docker-php-ext-enable
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/sh
set -e

cd "$(php -r 'echo ini_get("extension_dir");')"
extDir="$(php -r 'echo ini_get("extension_dir");')"
cd "$extDir"

usage() {
echo "usage: $0 [options] module-name [module-name ...]"
Expand All @@ -10,7 +11,12 @@ usage() {
echo " $0 --ini-name 0-apc.ini apcu apc"
echo
echo 'Possible values for module-name:'
echo $(find -maxdepth 1 -type f -name '*.so' -exec basename '{}' ';' | sort)
find -maxdepth 1 \
-type f \
-name '*.so' \
-exec basename '{}' ';' \
| sort \
| xargs
echo
echo 'Some of the above modules are already compiled into PHP; please check'
echo 'the output of "php -i" to see which modules are already loaded.'
Expand Down Expand Up @@ -47,7 +53,7 @@ for module; do
module="$module.so"
fi
if ! [ -f "$module" ]; then
echo >&2 "error: $(readlink -f "$module") does not exist"
echo >&2 "error: '$module' does not exist"
echo >&2
usage >&2
exit 1
Expand Down Expand Up @@ -80,7 +86,8 @@ fi
for module in $modules; do
if readelf --wide --syms "$module" | grep -q ' zend_extension_entry$'; then
# https://wiki.php.net/internals/extensions#loading_zend_extensions
line="zend_extension=$(readlink -f "$module")"
absModule="$(readlink -f "$module")"
line="zend_extension=$absModule"
else
line="extension=$module"
fi
Expand Down
15 changes: 11 additions & 4 deletions 5.6/jessie/fpm/docker-php-ext-enable
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/sh
set -e

cd "$(php -r 'echo ini_get("extension_dir");')"
extDir="$(php -r 'echo ini_get("extension_dir");')"
cd "$extDir"

usage() {
echo "usage: $0 [options] module-name [module-name ...]"
Expand All @@ -10,7 +11,12 @@ usage() {
echo " $0 --ini-name 0-apc.ini apcu apc"
echo
echo 'Possible values for module-name:'
echo $(find -maxdepth 1 -type f -name '*.so' -exec basename '{}' ';' | sort)
find -maxdepth 1 \
-type f \
-name '*.so' \
-exec basename '{}' ';' \
| sort \
| xargs
echo
echo 'Some of the above modules are already compiled into PHP; please check'
echo 'the output of "php -i" to see which modules are already loaded.'
Expand Down Expand Up @@ -47,7 +53,7 @@ for module; do
module="$module.so"
fi
if ! [ -f "$module" ]; then
echo >&2 "error: $(readlink -f "$module") does not exist"
echo >&2 "error: '$module' does not exist"
echo >&2
usage >&2
exit 1
Expand Down Expand Up @@ -80,7 +86,8 @@ fi
for module in $modules; do
if readelf --wide --syms "$module" | grep -q ' zend_extension_entry$'; then
# https://wiki.php.net/internals/extensions#loading_zend_extensions
line="zend_extension=$(readlink -f "$module")"
absModule="$(readlink -f "$module")"
line="zend_extension=$absModule"
else
line="extension=$module"
fi
Expand Down
15 changes: 11 additions & 4 deletions 5.6/jessie/zts/docker-php-ext-enable
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/sh
set -e

cd "$(php -r 'echo ini_get("extension_dir");')"
extDir="$(php -r 'echo ini_get("extension_dir");')"
cd "$extDir"

usage() {
echo "usage: $0 [options] module-name [module-name ...]"
Expand All @@ -10,7 +11,12 @@ usage() {
echo " $0 --ini-name 0-apc.ini apcu apc"
echo
echo 'Possible values for module-name:'
echo $(find -maxdepth 1 -type f -name '*.so' -exec basename '{}' ';' | sort)
find -maxdepth 1 \
-type f \
-name '*.so' \
-exec basename '{}' ';' \
| sort \
| xargs
echo
echo 'Some of the above modules are already compiled into PHP; please check'
echo 'the output of "php -i" to see which modules are already loaded.'
Expand Down Expand Up @@ -47,7 +53,7 @@ for module; do
module="$module.so"
fi
if ! [ -f "$module" ]; then
echo >&2 "error: $(readlink -f "$module") does not exist"
echo >&2 "error: '$module' does not exist"
echo >&2
usage >&2
exit 1
Expand Down Expand Up @@ -80,7 +86,8 @@ fi
for module in $modules; do
if readelf --wide --syms "$module" | grep -q ' zend_extension_entry$'; then
# https://wiki.php.net/internals/extensions#loading_zend_extensions
line="zend_extension=$(readlink -f "$module")"
absModule="$(readlink -f "$module")"
line="zend_extension=$absModule"
else
line="extension=$module"
fi
Expand Down
15 changes: 11 additions & 4 deletions 7.0/alpine3.4/cli/docker-php-ext-enable
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/sh
set -e

cd "$(php -r 'echo ini_get("extension_dir");')"
extDir="$(php -r 'echo ini_get("extension_dir");')"
cd "$extDir"

usage() {
echo "usage: $0 [options] module-name [module-name ...]"
Expand All @@ -10,7 +11,12 @@ usage() {
echo " $0 --ini-name 0-apc.ini apcu apc"
echo
echo 'Possible values for module-name:'
echo $(find -maxdepth 1 -type f -name '*.so' -exec basename '{}' ';' | sort)
find -maxdepth 1 \
-type f \
-name '*.so' \
-exec basename '{}' ';' \
| sort \
| xargs
echo
echo 'Some of the above modules are already compiled into PHP; please check'
echo 'the output of "php -i" to see which modules are already loaded.'
Expand Down Expand Up @@ -47,7 +53,7 @@ for module; do
module="$module.so"
fi
if ! [ -f "$module" ]; then
echo >&2 "error: $(readlink -f "$module") does not exist"
echo >&2 "error: '$module' does not exist"
echo >&2
usage >&2
exit 1
Expand Down Expand Up @@ -80,7 +86,8 @@ fi
for module in $modules; do
if readelf --wide --syms "$module" | grep -q ' zend_extension_entry$'; then
# https://wiki.php.net/internals/extensions#loading_zend_extensions
line="zend_extension=$(readlink -f "$module")"
absModule="$(readlink -f "$module")"
line="zend_extension=$absModule"
else
line="extension=$module"
fi
Expand Down
15 changes: 11 additions & 4 deletions 7.0/alpine3.4/fpm/docker-php-ext-enable
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/sh
set -e

cd "$(php -r 'echo ini_get("extension_dir");')"
extDir="$(php -r 'echo ini_get("extension_dir");')"
cd "$extDir"

usage() {
echo "usage: $0 [options] module-name [module-name ...]"
Expand All @@ -10,7 +11,12 @@ usage() {
echo " $0 --ini-name 0-apc.ini apcu apc"
echo
echo 'Possible values for module-name:'
echo $(find -maxdepth 1 -type f -name '*.so' -exec basename '{}' ';' | sort)
find -maxdepth 1 \
-type f \
-name '*.so' \
-exec basename '{}' ';' \
| sort \
| xargs
echo
echo 'Some of the above modules are already compiled into PHP; please check'
echo 'the output of "php -i" to see which modules are already loaded.'
Expand Down Expand Up @@ -47,7 +53,7 @@ for module; do
module="$module.so"
fi
if ! [ -f "$module" ]; then
echo >&2 "error: $(readlink -f "$module") does not exist"
echo >&2 "error: '$module' does not exist"
echo >&2
usage >&2
exit 1
Expand Down Expand Up @@ -80,7 +86,8 @@ fi
for module in $modules; do
if readelf --wide --syms "$module" | grep -q ' zend_extension_entry$'; then
# https://wiki.php.net/internals/extensions#loading_zend_extensions
line="zend_extension=$(readlink -f "$module")"
absModule="$(readlink -f "$module")"
line="zend_extension=$absModule"
else
line="extension=$module"
fi
Expand Down
Loading

0 comments on commit f504394

Please sign in to comment.