summaryrefslogtreecommitdiffstats
path: root/client/engine
diff options
context:
space:
mode:
Diffstat (limited to 'client/engine')
-rwxr-xr-xclient/engine/Boot.lib7
-rwxr-xr-xclient/engine/Cache.lib12
-rwxr-xr-xclient/engine/Disk.lib34
-rwxr-xr-xclient/engine/FileSystem.lib5
-rwxr-xr-xclient/engine/Image.lib12
5 files changed, 53 insertions, 17 deletions
diff --git a/client/engine/Boot.lib b/client/engine/Boot.lib
index 109c3048..78e16ccb 100755
--- a/client/engine/Boot.lib
+++ b/client/engine/Boot.lib
@@ -480,7 +480,10 @@ FILE=/tmp/temp$$
VERSION=$(ogGetOsVersion $1 $2)
-if echo "$VERSION" | grep "Windows 8.1"
+if echo "$VERSION" | grep "Windows 10"
+then
+ WINVER="Windows 10"
+elif echo "$VERSION" | grep "Windows 8.1"
then
WINVER="Windows 8.1"
elif echo "$VERSION" | grep "Windows 8"
@@ -1022,7 +1025,7 @@ ogGrubAddOgclient () {
# Error si no existe el kernel y el initrd en la cache.
# Falta crear nuevo codigo de error.
- [ -r $OGCAC/boot/ogvmlinuz -a -r $OGCAC/boot/oginitrd.img ] || return $(ogRaiseError log session OG_ERR_NOTFOUND "CACHE: ogvmlinuz, oginitrd.img" 1>&2; echo ?)
+ [ -r $OGCAC/boot/ogvmlinuz -a -r $OGCAC/boot/oginitrd.img ] || return $(ogRaiseError log session $OG_ERR_NOTFOUND "CACHE: ogvmlinuz, oginitrd.img" 1>&2; echo $?)
# Archivo de configuracion del grub
DIRMOUNT=$(ogMount $1 $2)
diff --git a/client/engine/Cache.lib b/client/engine/Cache.lib
index ce1fc38b..626cab6f 100755
--- a/client/engine/Cache.lib
+++ b/client/engine/Cache.lib
@@ -35,7 +35,7 @@
function ogCreateCache ()
{
# Variables locales.
-local FINDCACHE NDSK SIZECACHE PART DISK START END ENDPREVPART SIZE MINSIZE MAXSIZE PTTYPE ID
+local FINDCACHE NDSK SIZECACHE IOSIZE PART DISK START END ENDPREVPART SIZE MINSIZE MAXSIZE PTTYPE ID
# Si se solicita, mostrar ayuda.
if [ "$*" == "help" ]; then
ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_partsize" "$FUNCNAME 1 10000000"
@@ -65,7 +65,15 @@ PART=4
DISK=$(ogDiskToDev $NDSK) || return $?
END=$[$(ogGetLastSector $NDSK 2>/dev/null)] # Sector final del disco.
SIZE=$[$SIZECACHE*2] # Tamaño en sectores de 512 B.
-START=$[END-SIZE+1]
+###### agp ############
+IOSIZE=$(fdisk -l $DISK | grep I/O | cut -d ":" -f2 | cut -d "/" -f1 | cut -d " " -f2)
+if [[ $IOSIZE = 4096 ]]; then
+ END=$[$END-8192]
+ START=$[END-SIZE-8192]
+else
+ START=$[END-SIZE+1]
+fi
+###### agp ############
ENDPREVPART=$[$(ogGetLastSector $NDSK $[PART-1] 2>/dev/null)]
# Error si tamaño no está entre límites permitidos o si se solapa con la partición anterior.
MINSIZE=25000 # Error de formateo si tamaño < 50 MB.
diff --git a/client/engine/Disk.lib b/client/engine/Disk.lib
index adb9cb01..4ff545a3 100755
--- a/client/engine/Disk.lib
+++ b/client/engine/Disk.lib
@@ -44,7 +44,7 @@ timeout -k 5s -s KILL 3s $(which parted) "$@"
function ogCreatePartitions ()
{
# Variables locales.
-local ND DISK PTTYPE PART SECTORS START SIZE TYPE CACHEPART CACHESIZE EXTSTART EXTSIZE tmpsfdisk
+local ND DISK PTTYPE PART SECTORS START SIZE TYPE CACHEPART CACHESIZE IOSIZE EXTSTART EXTSIZE tmpsfdisk
# Si se solicita, mostrar ayuda.
if [ "$*" == "help" ]; then
ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk str_parttype:int_partsize ..." \
@@ -72,7 +72,20 @@ CACHEPART=$(ogFindCache 2>/dev/null)
[ "$ND" = "${CACHEPART% *}" ] && CACHESIZE=$(ogGetCacheSize 2>/dev/null | awk '{print $0*2}')
[ -n "$CACHESIZE" ] && SECTORS=$[SECTORS-CACHESIZE]
# Sector de inicio (la partición 1 empieza en el sector 63).
-START=63
+########## agp ###########
+iodisco=$(ogDiskToDev $1)
+IOSIZE=$(fdisk -l $iodisco | grep I/O | cut -d ":" -f2 | cut -d "/" -f1 | cut -d " " -f2)
+if [[ $IOSIZE = 4096 ]]; then
+ START=4096
+else
+ START=63
+fi
+########## agp ###########
+
+
+
+
+
PART=1
# Fichero temporal de entrada para "sfdisk"
@@ -257,6 +270,9 @@ sgdisk $DELOPTIONS $OPTIONS $DISK 2>/dev/null && partprobe $DISK
#@version 1.0.4 - Primera versión compatible con OpenGnSys.
#@author Universidad de Huelva
#@date 2012/03/06
+#@version 1.0.6a - Adaptar creación de nueva tabla MSDOS.
+#@author Ramon Gomez, ETSII Universidad de Sevilla
+#@date 2016/01/29
#*/ ##
function ogCreatePartitionTable ()
{
@@ -308,7 +324,8 @@ case "$CREATE" in
if [ "$PTTYPE" == "GPT" ]; then
sgdisk -Z $DISK
fi
- fdisk $DISK <<< "w"
+ # Crear y borrar una partición para que la tabla se genere bien.
+ echo -e "o\nn\np\n\n\n\nd\n\nw" | fdisk $DISK
partprobe $DISK 2>/dev/null
;;
esac
@@ -592,7 +609,7 @@ echo $TYPE
function ogGetLastSector ()
{
# Variables locales
-local DISK PART PTTYPE LASTSECTOR SECTORS CYLS
+local DISK PART PTTYPE LASTSECTOR SECTORS CYLS IOSIZE
# Si se solicita, mostrar ayuda.
if [ "$*" == "help" ]; then
ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk [int_npart]" \
@@ -626,7 +643,14 @@ case "$PTTYPE" in
if [ $# == 1 ]; then
SECTORS=$(awk -v D=${DISK#/dev/} '{if ($4==D) {print $3*2}}' /proc/partitions)
CYLS=$(sfdisk -g $DISK | cut -f2 -d" ")
- LASTSECTOR=$[SECTORS/CYLS*CYLS-1]
+ ########## agp ###########
+ IOSIZE=$(fdisk -l $DISK | grep I/O | cut -d ":" -f2 | cut -d "/" -f1 | cut -d " " -f2)
+ if [[ $IOSIZE = 4096 ]]; then
+ LASTSECTOR=$[SECTORS-512]
+ else
+ LASTSECTOR=$[SECTORS/CYLS*CYLS-1]
+ fi
+ ########## agp ###########
else
LASTSECTOR=$(sfdisk -uS -l $DISK 2>/dev/null | \
awk -v P="$PART" '{if ($1==P) {if ($2=="*") print $4; else print $3} }')
diff --git a/client/engine/FileSystem.lib b/client/engine/FileSystem.lib
index 257c5a23..73fd44bc 100755
--- a/client/engine/FileSystem.lib
+++ b/client/engine/FileSystem.lib
@@ -468,7 +468,7 @@ findmnt -n -o TARGET $PART
function ogIsFormated ()
{
# Variables locales
-local DISK
+local PART
if [ "$*" == "help" ]; then
ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_nfilesys" \
"if $FUNCNAME 1 1; then ... ; fi"
@@ -476,8 +476,9 @@ if [ "$*" == "help" ]; then
fi
# Falso, en caso de error.
[ $# == 2 ] || return 1
+PART="$(ogDiskToDev $1 $2 2>/dev/null)" || return 1
-test -n "$(ogMount "$1" "$2" 2>/dev/null)"
+test -n "$(blkid -s TYPE $PART | egrep -vi "swap|_member")"
}
diff --git a/client/engine/Image.lib b/client/engine/Image.lib
index 5e799968..7940b4f5 100755
--- a/client/engine/Image.lib
+++ b/client/engine/Image.lib
@@ -627,7 +627,7 @@ fi
# Procesar parámetros.
DISK=$(ogDiskToDev "$3") || return $?
IMGFILE=$(ogGetPath "$1" "$2.mbr") || return $?
-[ -r "$IMGFILE" ] || ogRaiseError OG_ERR_NOTFOUND "$IMGFILE" || return $?
+[ -r "$IMGFILE" ] || ogRaiseError $OG_ERR_NOTFOUND "$IMGFILE" || return $?
# Restaurar imagen del MBR.
dd if="$IMGFILE" of="$DISK" bs=512 count=1 || ogRaiseError $OG_ERR_IMAGE "$1 $IMGFILE" || return $?
@@ -663,7 +663,7 @@ fi
# Procesar parámetros.
DISK=$(ogDiskToDev "$3") || return $?
IMGFILE=$(ogGetPath "$1" "$2.mbr") || return $?
-[ -r "$IMGFILE" ] || ogRaiseError OG_ERR_NOTFOUND "$IMGFILE" || return $?
+[ -r "$IMGFILE" ] || ogRaiseError $OG_ERR_NOTFOUND "$IMGFILE" || return $?
# Restaurar imagen del MBR.
dd if="$IMGFILE" of="$DISK" bs=446 count=1 || ogRaiseError $OG_ERR_IMAGE "$1 $IMGFILE" || return $?
@@ -802,7 +802,7 @@ function ogGetImageProgram ()
{
local IMGFILE
IMGFILE=$(ogGetPath "$1" "$2.img") || return $?
-[ -r "$IMGFILE" ] || ogRaiseError OG_ERR_NOTFOUND "$IMGFILE" || return $?
+[ -r "$IMGFILE" ] || ogRaiseError $OG_ERR_NOTFOUND "$IMGFILE" || return $?
ogGetImageInfo $IMGFILE | awk -F: '{print $1}'
}
@@ -811,7 +811,7 @@ function ogGetImageCompressor ()
{
local IMGFILE
IMGFILE=$(ogGetPath "$1" "$2.img") || return $?
-[ -r "$IMGFILE" ] || ogRaiseError OG_ERR_NOTFOUND "$IMGFILE" || return $?
+[ -r "$IMGFILE" ] || ogRaiseError $OG_ERR_NOTFOUND "$IMGFILE" || return $?
ogGetImageInfo $IMGFILE | awk -F: '{print $2}'
}
@@ -819,7 +819,7 @@ function ogGetImageType ()
{
local IMGFILE
IMGFILE=$(ogGetPath "$1" "$2.img") || return $?
-[ -r "$IMGFILE" ] || ogRaiseError OG_ERR_NOTFOUND "$IMGFILE" || return $?
+[ -r "$IMGFILE" ] || ogRaiseError $OG_ERR_NOTFOUND "$IMGFILE" || return $?
#partimage -B gui=no imginfo "$IMGFILE" 2>&1 | \
# awk '/^Filesystem/ {sub(/\.\.+/," "); sub(/fs$/,""); print toupper($2);}'
ogGetImageInfo $IMGFILE | awk -F: '{print $3}'
@@ -841,7 +841,7 @@ fi
[ $# == 2 ] || ogRaiseError $OG_ERR_FORMAT || return $?
# Error si el fichero de imagen no es accesible.
IMGFILE=$(ogGetPath "$1" "$2.img") || return $?
-[ -r "$IMGFILE" ] || ogRaiseError OG_ERR_NOTFOUND "$IMGFILE" || return $?
+[ -r "$IMGFILE" ] || ogRaiseError $OG_ERR_NOTFOUND "$IMGFILE" || return $?
# Devuelve el tamaño de la imagen en KB.
#partimage -B gui=no imginfo "$IMGFILE" 2>&1 | \