ulib/sysinfos: support de oracle linux; correction d'un bug pour macosx

This commit is contained in:
Jephté Clain 2017-02-10 10:17:50 +04:00
parent 27a2ab0c01
commit e5f0df2e18
1 changed files with 34 additions and 7 deletions

View File

@ -12,9 +12,9 @@ urequire base
# attention: dans SYSNAMES et *_SYSDISTS, les noms doivent être ordonnés du
# moins spécifique au plus spécifique
SYSNAMES=(linux linux64 linux32 linuxppc64 linuxppc32 linuxarm macosx)
linux_SYSDISTS=(debianlike debian ubuntu redhatlike rhel fedora centos suse gentoo)
linux32_SYSDISTS=(debianlike debian ubuntu redhatlike rhel fedora centos suse gentoo)
linux64_SYSDISTS=(debianlike debian ubuntu redhatlike rhel fedora centos suse gentoo)
linux_SYSDISTS=(debianlike debian ubuntu redhatlike ol rhel fedora centos suse gentoo)
linux32_SYSDISTS=(debianlike debian ubuntu redhatlike ol rhel fedora centos suse gentoo)
linux64_SYSDISTS=(debianlike debian ubuntu redhatlike ol rhel fedora centos suse gentoo)
linuxppc32_SYSDISTS=(debianlike debian ubuntu redhatlike fedora)
linuxppc64_SYSDISTS=(debianlike debian ubuntu redhatlike fedora)
linuxarm_SYSDISTS=(debianlike debian ubuntu)
@ -28,6 +28,7 @@ debianlike_SYSVERS=()
debian_SYSVERS=(stretch jessie wheezy squeeze lenny etch)
ubuntu_SYSVERS=(oneiric natty maverick lucid karmic jaunty intrepid hardy)
redhatlike_SYSVERS=()
ol_SYSVERS=(ol7 ol6 redhat7 redhat6)
rhel_SYSVERS=(rhel7 rhel6 rhel5 rhel4 redhat7 redhat6 redhat5 redhat4)
fedora_SYSVERS=(fedora14 fedora13 fedora12 fedora11)
centos_SYSVERS=(centos7 centos6 centos5 centos4 redhat7 redhat6 redhat5 redhat4)
@ -66,6 +67,7 @@ function __compute_local_sysinfos_data() {
"$UNAME_MACHINE"
"$([ -f /etc/debian_version ] && cat /etc/debian_version)"
"$([ -f /etc/gentoo-release ] && cat /etc/gentoo-release)"
"$([ -f /etc/oracle-release ] && cat /etc/oracle-release)"
"$([ -f /etc/redhat-release ] && cat /etc/redhat-release)"
"$([ -f /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Resources/version.plist ] && cat /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Resources/version.plist)"
"$([ -f /System/Library/Frameworks/CoreServices.framework/Resources/version.plist ] && cat /System/Library/Frameworks/CoreServices.framework/Resources/version.plist)"
@ -81,6 +83,8 @@ echo .----------------.
echo .----------------.
[ -f /etc/gentoo-release ] && cat /etc/gentoo-release
echo .----------------.
[ -f /etc/oracle-release ] && cat /etc/oracle-release
echo .----------------.
[ -f /etc/redhat-release ] && cat /etc/redhat-release
echo .----------------.
[ -f /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Resources/version.plist ] && cat /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Resources/version.plist
@ -120,10 +124,14 @@ function __compute_sysinfos() {
local machine="${SYSINFOS_DATA[1]}"
local debian_version="${SYSINFOS_DATA[2]}"
local gentoo_release="${SYSINFOS_DATA[3]}"
local redhat_release="${SYSINFOS_DATA[4]}"
local macosx_plist1="${SYSINFOS_DATA[5]}"
local macosx_plist2="${SYSINFOS_DATA[6]}"
local oracle_release="${SYSINFOS_DATA[4]}"
local redhat_release="${SYSINFOS_DATA[5]}"
local macosx_plist1="${SYSINFOS_DATA[6]}"
local macosx_plist2="${SYSINFOS_DATA[7]}"
MYSYSNAME=(unknown)
MYSYSDIST=(unknown)
MYSYSVER=(unknown)
if [ "$system" == "Linux" ]; then
case "$machine" in
x86_64) MYSYSNAME=(linux64 linux); MYBITS=64;;
@ -145,6 +153,12 @@ function __compute_sysinfos() {
esac
elif [ -n "$gentoo_release" ]; then
MYSYSDIST=(gentoo)
elif [ -n "$oracle_release" ]; then
MYSYSDIST=(ol rhel redhatlike)
case "$oracle_release" in
Oracle*Linux*release\ 7*) MYSYSVER=(ol7 rhel7 redhat7);;
Oracle*Linux*release\ 6*) MYSYSVER=(ol6 rhel6 redhat6);;
esac
elif [ -n "$redhat_release" ]; then
case "$redhat_release" in
Fedora*) MYSYSDIST=(fedora redhatlike);;
@ -178,13 +192,14 @@ s/<\/string>.*$//g'
done
}
MYSYSNAME=(macosx darwin)
case "$(get_macosx_version)" in
case "$(get_macosx_version "$macosx_plist1" "$macosx_plist2")" in
10.7*) MYSYSDIST=(lion);;
10.6*) MYSYSDIST=(snowleopard);;
10.5*) MYSYSDIST=(leopard);;
10.4*) MYSYSDIST=(tiger);;
10.3*) MYSYSDIST=(panther);;
esac
MYSYSVER=()
fi
}
@ -316,6 +331,18 @@ function ensure_sysinfos() {
__fix_sysinfos_downward
}
function dump_sysinfos_desc() {
# Afficher les valeurs de SYSNAME, SYSDIST, SYSVER qui décrivent le système
# actuel
local sysname_="${1:-MYSYSNAME}[*]"
local sysdist_="${2:-MYSYSDIST}[*]"
local sysver_="${3:-MYSYSVER}[*]"
echo "\
sysname: ${!sysname_}
sysdist: ${!sysdist_}
sysver: ${!sysver_}"
}
function get_sysinfos_desc() {
# Afficher une chaine de la forme SYSNAME/SYSDIST/SYSVER qui décrit le
# système actuel