-
-
Notifications
You must be signed in to change notification settings - Fork 435
Expand file tree
/
Copy pathtest-installcomposer
More file actions
executable file
·30 lines (26 loc) · 1.03 KB
/
Copy pathtest-installcomposer
File metadata and controls
executable file
·30 lines (26 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh
# Let's set a sane environment
set -o errexit
set -o nounset
WANTED_VERSION="${1:-}"
INSTALLME=@composer
if test -n "$WANTED_VERSION"; then
INSTALLME="$INSTALLME-$1"
fi
CI=true ./install-php-extensions "$INSTALLME"
INSTALLED_VERSION="$(composer --version | sed -E 's/^.*[Vv]ersion\s*(\S+).*$/\1/')"
if test -z "$WANTED_VERSION"; then
echo 'Installing the latest version worked'
elif printf '%s' "$WANTED_VERSION" | grep -Eq '^[0-9]+$'; then
if test "${INSTALLED_VERSION#$WANTED_VERSION.}" = "$INSTALLED_VERSION"; then
printf 'Installing major version %s DID NOT worked (we installed version %s)\n' "$WANTED_VERSION" "$INSTALLED_VERSION"
exit 1
fi
printf 'Installing major version %s worked (we installed version %s)\n' "$WANTED_VERSION" "$INSTALLED_VERSION"
else
if test "$INSTALLED_VERSION" != "$WANTED_VERSION"; then
printf 'Installing specific version %s DID NOT worked (we installed version %s)\n' "$WANTED_VERSION" "$INSTALLED_VERSION"
exit 1
fi
printf 'Installing specific version %s worked\n' "$INSTALLED_VERSION"
fi