mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
Check for validity first
Signed-off-by: Christian König <ckoenig@posteo.de>
This commit is contained in:
parent
7d731870e5
commit
5818f3f997
1 changed files with 13 additions and 9 deletions
|
@ -298,17 +298,21 @@ package_manager_detect() {
|
||||||
# Update package cache
|
# Update package cache
|
||||||
update_package_cache || exit 1
|
update_package_cache || exit 1
|
||||||
# Check for and determine version number (major and minor) of current php install
|
# Check for and determine version number (major and minor) of current php install
|
||||||
local phpVer="php"
|
local phpVer
|
||||||
if is_command php ; then
|
if is_command php ; then
|
||||||
printf " %b Existing PHP installation detected : PHP version %s\\n" "${INFO}" "$(php <<< "<?php echo PHP_VERSION ?>")"
|
phpVer="$(php -v 2> /dev/null | head -n1 | cut -d '-' -f1 | cut -d ' ' -f2)"
|
||||||
printf -v phpInsMajor "%s" "$(php <<< "<?php echo PHP_MAJOR_VERSION ?>")"
|
# Check if the first character of the string is numeric
|
||||||
printf -v phpInsMinor "%s" "$(php <<< "<?php echo PHP_MINOR_VERSION ?>")"
|
if [[ ${phpVer:0:1} =~ [1-9] ]]; then
|
||||||
if [[ "$phpInsMajor" =~ [^[:digit:]] || "$phpInsMinor" =~ [^[:digit:]] ]]; then
|
printf " %b Existing PHP installation detected : PHP version %s\\n" "${INFO}" "${phpVer}"
|
||||||
printf " %b No valid PHP version detected\\n" "${CROSS}"
|
printf -v phpInsMajor "%d" "$(php <<< "<?php echo PHP_MAJOR_VERSION ?>")"
|
||||||
# so exit the installer
|
printf -v phpInsMinor "%d" "$(php <<< "<?php echo PHP_MINOR_VERSION ?>")"
|
||||||
exit
|
|
||||||
fi
|
|
||||||
phpVer="php$phpInsMajor.$phpInsMinor"
|
phpVer="php$phpInsMajor.$phpInsMinor"
|
||||||
|
else
|
||||||
|
printf " %b No valid PHP installation detected!\\n" "${CROSS}"
|
||||||
|
printf " %b PHP version : %s\\n" "${INFO}" "${phpVer}"
|
||||||
|
printf " %b Aborting installation.\\n" "${CROSS}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
# Packages required to perfom the os_check (stored as an array)
|
# Packages required to perfom the os_check (stored as an array)
|
||||||
OS_CHECK_DEPS=(grep dnsutils)
|
OS_CHECK_DEPS=(grep dnsutils)
|
||||||
|
|
Loading…
Reference in a new issue