parent
ece68a1e81
commit
dd8abe1592
|
@ -26,19 +26,28 @@ getDistro () {
|
|||
getDistro_os_id=''
|
||||
if test -r /etc/os-release; then
|
||||
getDistro_os_id="$(cat /etc/os-release | grep -E ^ID= | cut -d = -f 2)"
|
||||
case "$getDistro_os_id" in
|
||||
alpine|debian)
|
||||
;;
|
||||
*)
|
||||
getDistro_os_id=''
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if test -n "$getDistro_os_id"; then
|
||||
printf '%s' "$getDistro_os_id"
|
||||
else
|
||||
printf '%s' 'debian'
|
||||
printf '%s' "$getDistro_os_id"
|
||||
}
|
||||
|
||||
# Get the distribution name and the version
|
||||
#
|
||||
# Example output:
|
||||
# alpine@3.10
|
||||
# debian@9
|
||||
getDistroVersion () {
|
||||
getDistroVersion_distro="$(getDistro)"
|
||||
if test -z "$getDistroVersion_distro"; then
|
||||
return
|
||||
fi
|
||||
getDistroVersion_versionID=''
|
||||
if test -r /etc/os-release; then
|
||||
getDistroVersion_versionID="$(cat /etc/os-release | grep -E ^VERSION_ID= | cut -d = -f 2 | cut -d '"' -f 2 | cut -d . -f 1,2)"
|
||||
fi
|
||||
if test -z "$getDistroVersion_distro"; then
|
||||
return
|
||||
fi
|
||||
printf '%s@%s' "$getDistroVersion_distro" "$getDistroVersion_versionID"
|
||||
}
|
||||
|
||||
# Get the PHP Major-Minor version as an integer value, in format MMmm (example: 506 for PHP 5.6.15)
|
||||
|
|
Loading…
Reference in New Issue