don't use major.minor for PHP 5

Signed-off-by: <rrobgill@protonmail.com>
This commit is contained in:
Rob Gill 2018-06-09 11:35:30 +10:00 committed by GitHub
parent a3569d88c9
commit 6381bdbf33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -166,13 +166,13 @@ if command -v apt-get &> /dev/null; then
echo -e " ${INFO} Existing PHP installation detected : PHP version $phpInsVersion" echo -e " ${INFO} Existing PHP installation detected : PHP version $phpInsVersion"
phpInsMajor="$(echo "$phpInsVersion" | cut -d\. -f1)" phpInsMajor="$(echo "$phpInsVersion" | cut -d\. -f1)"
phpInsMinor="$(echo "$phpInsVersion" | cut -d\. -f2)" phpInsMinor="$(echo "$phpInsVersion" | cut -d\. -f2)"
# Is installed php version supported? (php 5.4 is EOL) # Is installed php version newer than php5?
if [ "$(echo "$phpInsMajor.$phpInsMinor < 5.5" | bc )" == 0 ]; then if [ "$(echo "$phpInsMajor.$phpInsMinor < 7.0" | bc )" == 0 ]; then
phpInsSupported=true phpInsNewer=true
fi fi
fi fi
# Check if installed php is unsupported version (5.4 is EOL) # Check if installed php is unsupported version (5.4 is EOL)
if [[ "$phpInsSupported" != true ]]; then if [[ "$phpInsNewer" != true ]]; then
# Prefer the php metapackage if it's there # Prefer the php metapackage if it's there
if ${PKG_MANAGER} install --dry-run php > /dev/null 2>&1; then if ${PKG_MANAGER} install --dry-run php > /dev/null 2>&1; then
phpVer="php" phpVer="php"
@ -181,7 +181,7 @@ if command -v apt-get &> /dev/null; then
phpVer="php5" phpVer="php5"
fi fi
else else
# Supported php is installed, its common, cgi & sqlite counterparts are deps # Newer php is installed, its common, cgi & sqlite counterparts are deps
phpVer="php$phpInsMajor.$phpInsMinor" phpVer="php$phpInsMajor.$phpInsMinor"
fi fi
# We also need the correct version for `php-sqlite` (which differs across distros) # We also need the correct version for `php-sqlite` (which differs across distros)