File tree Expand file tree Collapse file tree 3 files changed +75
-4
lines changed Expand file tree Collapse file tree 3 files changed +75
-4
lines changed Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22set -Eeuo pipefail
33
4- [ -f versions.json ] # run "versions.sh" first
4+ # Don't tolerate outdated bash on Darwin
5+ [ " ${BASH_VERSINFO:- 0} " -ge 4 ] || ( echo " Outdated bash version: ${BASH_VERSION} . If you're on MacOS/Darwin, please 'brew install bash' to move away from this comically outdated version." && exit 1)
6+
7+ [ -f versions.json ] || (echo " run 'versions.sh' first so templates can be applied to the right versions" && exit 1)
8+
9+ type gawk > /dev/null 2>&1 || (echo " Please install the gawk command. On MacOS, run 'brew install gawk'" && exit 1)
10+
11+ # GNU sed for Mac.
12+ # Copied from:
13+ # https://gist.github.com/bittner/5436f3dc011d43ab7551#file-gnu-tools-for-mac-sh
14+ sedcmd=" sed"
15+
16+ [[ ` uname` == ' Darwin' ]] && {
17+ which gsed > /dev/null && {
18+ sedcmd=" gsed"
19+ } || {
20+ echo ' ERROR: GNU sed required for Mac. You may use homebrew to install it: brew install gnu-sed'
21+ exit 1
22+ }
23+ }
524
625jqt=' .jq-template.awk'
726if [ -n " ${BASHBREW_SCRIPTS:- } " ]; then
@@ -76,7 +95,7 @@ for version; do
7695
7796 cmd=" $( jq <<< " $cmd" -r ' .[0]' ) "
7897 if [ " $cmd " != ' php' ]; then
79- sed -i -e ' s! php ! ' " $cmd " ' !g' " $version /$dir /docker-php-entrypoint"
98+ $sedcmd -i -e ' s! php ! ' " $cmd " ' !g' " $version /$dir /docker-php-entrypoint"
8099 fi
81100 done
82101done
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22set -Eeuo pipefail
33
4- cd " $( dirname " $( readlink -f " $BASH_SOURCE " ) " ) "
4+ # Don't tolerate outdated bash on Darwin
5+ [ " ${BASH_VERSINFO:- 0} " -ge 4 ] || ( echo " Outdated bash version: ${BASH_VERSION} . If you're on MacOS/Darwin, please 'brew install bash' to move away from this comically outdated version." && exit 1)
6+
7+ # Substitute for readlink that works on MacOS/Darwin.
8+ # Copied from: https://stackoverflow.com/questions/29836821/how-does-this-os-x-bash-script-that-emulates-linuxs-readlink-work
9+ function abspath() {
10+ pushd . > /dev/null;
11+ if [ -d " $1 " ]; then
12+ cd " $1 " ;
13+ dirs -l +0;
14+ else
15+ cd " ` dirname \" $1 \" ` " ;
16+ cur_dir=` dirs -l +0` ;
17+ if [ " $cur_dir " == " /" ]; then
18+ echo " $cur_dir ` basename \" $1 \" ` " ;
19+ else
20+ echo " $cur_dir /` basename \" $1 \" ` " ;
21+ fi ;
22+ fi ;
23+ popd > /dev/null;
24+ }
25+
26+ cd " $( dirname " $( abspath " $BASH_SOURCE " ) " ) "
527
628./versions.sh " $@ "
729./apply-templates.sh " $@ "
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22set -Eeuo pipefail
33
4+ # Don't tolerate outdated bash on Darwin
5+ [ " ${BASH_VERSINFO:- 0} " -ge 4 ] || ( echo " Outdated bash version: ${BASH_VERSION} . If you're on MacOS/Darwin, please 'brew install bash' to move away from this comically outdated version." && exit 1)
6+
7+ # Substitute for readlink that works on MacOS/Darwin.
8+ # Copied from: https://stackoverflow.com/questions/29836821/how-does-this-os-x-bash-script-that-emulates-linuxs-readlink-work
9+ function abspath() {
10+ pushd . > /dev/null;
11+ if [ -d " $1 " ]; then
12+ cd " $1 " ;
13+ dirs -l +0;
14+ else
15+ cd " ` dirname \" $1 \" ` " ;
16+ cur_dir=` dirs -l +0` ;
17+ if [ " $cur_dir " == " /" ]; then
18+ echo " $cur_dir ` basename \" $1 \" ` " ;
19+ else
20+ echo " $cur_dir /` basename \" $1 \" ` " ;
21+ fi ;
22+ fi ;
23+ popd > /dev/null;
24+ }
25+
426# https://www.php.net/gpg-keys.php
527declare -A gpgKeys=(
628 # https://wiki.php.net/todo/php81
@@ -31,7 +53,7 @@ declare -A gpgKeys=(
3153)
3254# see https://www.php.net/downloads.php
3355
34- cd " $( dirname " $( readlink -f " $BASH_SOURCE " ) " ) "
56+ cd " $( dirname " $( abspath " $BASH_SOURCE " ) " ) "
3557
3658versions=( " $@ " )
3759if [ ${# versions[@]} -eq 0 ]; then
4365versions=( " ${versions[@]%/ } " )
4466
4567for version in " ${versions[@]} " ; do
68+ # Versions begin with a digit
69+ if ! [[ $version =~ [0-9].* ]]; then
70+ echo " Ignoring directory $version , since versions must begin with a digit."
71+ continue
72+ fi
73+
74+ echo " Looking up php at version $version ..."
75+
4676 rcVersion=" ${version% -rc} "
4777 export version rcVersion
4878
You can’t perform that action at this time.
0 commit comments