#645: Función {{{ogGetOsVersion}}} detecta algunos sistemas GNU/Linux con EFI que usan ficheros similares a Mac OS.

git-svn-id: https://opengnsys.es/svn/branches/version1.0@4376 a21b9725-9963-47de-94b9-378ad31fedc9
remotes/github/debian-pkg
ramon 2014-09-04 10:15:55 +00:00
parent 477ba422f0
commit 045fd2da7f
2 changed files with 37 additions and 35 deletions

View File

@ -59,7 +59,7 @@ case "$TYPE" in
PARAMS=$(ogLinuxBootParameters $1 $2) || return $?
read -e KERNEL INITRD APPEND <<<"$PARAMS"
# Si no hay kernel, no hay sistema operativo.
[ -n "$KERNEL" ] || ogRaiseError $OG_ERR_NOTOS "$1 $2 $TYPE" || return $?
[ -n "$KERNEL" ] || ogRaiseError $OG_ERR_NOTOS "$1 $2 ($TYPE)" || return $?
# Arrancar de partición distinta a la original.
[ -e "$MNTDIR/etc" ] && APPEND=$(echo $APPEND | awk -v P="$PART " '{sub (/root=[-+=_/a-zA-Z0-9]* /,"root="P);print}')
# Configurar kernel Linux con los parámetros leídos de su GRUB.
@ -72,7 +72,7 @@ case "$TYPE" in
FILE="$(ogGetPath $1 $2 $f 2>/dev/null)"
[ -n "$FILE" ] && LOADER="$f"
done
[ -n "$LOADER" ] || ogRaiseError $OG_ERR_NOTOS "$1 $2 $TYPE" || return $?
[ -n "$LOADER" ] || ogRaiseError $OG_ERR_NOTOS "$1 $2 ($TYPE)" || return $?
if [ "$winboot" == "kexec" ]; then
# Modo de arranque en caliente (con kexec).
cp $OGLIB/grub4dos/* $MNTDIR # */ (Comentario Doxygen)

View File

@ -28,6 +28,26 @@ fi
}
#/**
# ogGetOsType int_ndisk int_npartition
#@brief Devuelve el tipo del sistema operativo instalado.
#@param int_ndisk nº de orden del disco
#@param int_npartition nº de orden de la partición
#@return OSType - Tipo de sistema operativo.
#@see ogGetOsVersion
#*/ ##
function ogGetOsType ()
{
# Si se solicita, mostrar ayuda.
if [ "$*" == "help" ]; then
ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_npartition" \
"$FUNCNAME 1 2 => Linux"
return
fi
ogGetOsVersion "$@" | cut -sf1 -d:
}
#/**
# ogGetOsVersion int_ndisk int_nfilesys
#@brief Devuelve la versión del sistema operativo instalado en un sistema de archivos.
@ -126,19 +146,22 @@ fi
# Para MacOS: detectar kernel y completar con fichero plist de información del sistema.
if [ -z "$VERSION" ]; then
TYPE="MacOS"
# Kernel de Mac OS.
# Kernel de Mac OS (no debe ser fichero de texto).
FILE="$MNTDIR/mach_kernel"
[ -n "$(file -b $FILE | grep 'Mach-O')" ] && VERSION="Mac OS"
[ -n "$(file -b $FILE | grep 'Mach-O 64-bit')" ] && IS64BIT="$MSG_64BIT"
# Datos de configuración de versión de Mac OS.
FILE="$MNTDIR/System/Library/CoreServices/SystemVersion.plist"
[ -r $FILE ] && VERSION=$(awk -F"[<>]" '
/ProductName/ {getline;s=$3}
/ProductVersion/ {getline;v=$3}
END {print s,v}' $FILE)
# Datos de recuperación de Mac OS.
FILE="$MNTDIR/com.apple.recovery.boot"
[ -r $FILE -a -n "$VERSION" ] && VERSION="$VERSION recovery"
if [ -z "$(file -b $FILE | grep 'text')" ]; then
# Obtener tipo de kernel.
[ -n "$(file -b $FILE | grep 'Mach-O')" ] && VERSION="Mac OS"
[ -n "$(file -b $FILE | grep 'Mach-O 64-bit')" ] && IS64BIT="$MSG_64BIT"
# Datos de configuración de versión de Mac OS.
FILE="$MNTDIR/System/Library/CoreServices/SystemVersion.plist"
[ -r $FILE ] && VERSION=$(awk -F"[<>]" '
/ProductName/ {getline;s=$3}
/ProductVersion/ {getline;v=$3}
END {print s,v}' $FILE)
# Datos de recuperación de Mac OS.
FILE="$MNTDIR/com.apple.recovery.boot"
[ -r $FILE -a -n "$VERSION" ] && VERSION="$VERSION recovery"
fi
fi
# Para FreeBSD: obtener datos del Kernel.
### TODO Revisar solución.
@ -174,27 +197,6 @@ return 0
}
#/**
# ogGetOsType int_ndisk int_npartition
#@brief Devuelve el tipo del sistema operativo instalado.
#@param int_ndisk nº de orden del disco
#@param int_npartition nº de orden de la partición
#@return OSType - Tipo de sistema operativo.
#@note OSType = { Android, BSD, Linux, MacOS, Windows }
#@see ogGetOsVersion
#*/ ##
function ogGetOsType ()
{
# Si se solicita, mostrar ayuda.
if [ "$*" == "help" ]; then
ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_npartition" \
"$FUNCNAME 1 2 => Linux"
return
fi
ogGetOsVersion "$@" | cut -sf1 -d:
}
#/**
# ogListHardwareInfo
#@brief Lista el inventario de hardware de la máquina cliente.