summaryrefslogtreecommitdiffstats
path: root/client/engine
diff options
context:
space:
mode:
authoralbertogp <albertogp@uma.es>2014-05-28 11:02:44 +0000
committeralbertogp <albertogp@uma.es>2014-05-28 11:02:44 +0000
commit1cbf9e0c52fb98fd9eed2c03982ec5b9bc0ad9a0 (patch)
tree3a1b46f6e4458b9ef6e50ddd7ce161a6ea0ee813 /client/engine
parent9de724362e4be5828a24e0ed9367839c74363e23 (diff)
#541
Integrando cambios en version 1.0 Cambios en ficheros Cache.lib, Disk.lib, FileSystem.lib, Image.lib git-svn-id: https://opengnsys.es/svn/branches/version1.0@4288 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'client/engine')
-rwxr-xr-xclient/engine/Cache.lib56
-rwxr-xr-xclient/engine/Disk.lib1
-rwxr-xr-xclient/engine/FileSystem.lib6
-rwxr-xr-xclient/engine/Image.lib15
4 files changed, 64 insertions, 14 deletions
diff --git a/client/engine/Cache.lib b/client/engine/Cache.lib
index 1a444aed..234a54b2 100755
--- a/client/engine/Cache.lib
+++ b/client/engine/Cache.lib
@@ -182,6 +182,25 @@ PART=$(realpath /dev/disk/by-label/CACHE 2>/dev/null)
PART=${PART:-$(sfdisk -l 2>/dev/null | awk '$6~/ca|a7/ {print $1}')}
PART=${PART%% *}
+# Si Tipo de de Disco es GPT #agp
+TIPODISK=$(ogGetPartitionTableType 1)
+if [ "$TIPODISK" == "GPT" ]; then
+ if [ ! -z $(blkid | grep 'CACHE' | cut -d ':' -f1 ) ]; then ## Si esta creada la etiqueta CACHE
+ PART=$(blkid | grep 'CACHE' | cut -d ':' -f1 )
+ else
+ if [ -z $(sgdisk /dev/sda -p | grep CACHE | cut -d" " -f3) ];then ## Busco el tercer campo si tiene numero
+ PART=$(sgdisk /dev/sda -p | grep CACHE | cut -d" " -f4) ## Si tiene numero la particion < 10
+ else
+ PART=$(sgdisk /dev/sda -p | grep CACHE | cut -d" " -f3-4) ## Si tiene numero la particion > 10
+ fi
+ PART=$(ogDiskToDev 1 $PART)
+ fi
+else
+ # Si no, obtener la 1ª partición marcada como de tipo caché.
+ PART=$(sfdisk -l 2>/dev/null | awk '$6~/ca|a7/ {print $1}')
+fi
+#agp
+
ogDevToDisk $PART 2>/dev/null
}
@@ -210,16 +229,33 @@ if [ "$*" == "help" ]; then
return
fi
-# Error si no hay definida partición de caché.
-DEV=$(ogFindCache) || ogRaiseError $OG_ERR_PARTITION "$MSG_NOCACHE" || return $?
-DEV=$(ogDiskToDev $DEV) || return $?
-
-# Formatear sistema de ficheros.
-ogUnmountCache 2>/dev/null
-mkfs.ext4 -q -F $DEV -L "CACHE" -O extent,large_file 2>/dev/null || ogRaiseError $OG_ERR_PARTITION "CACHE" || return $?
-# Crear estructura básica.
-MNTDIR=$(ogMountCache)
-mkdir -p $MNTDIR/$OGIMG
+TYPEDISK=$(ogGetPartitionTableType 1) #agp
+if [ "$TYPEDISK" == "GPT" ]; then
+ # Error si no hay definida partición de caché.
+ DEV=$(ogFindCache) || ogRaiseError $OG_ERR_PARTITION "$MSG_NOCACHE" || return $?
+ DEV=$(ogDiskToDev $DEV) || return $?
+ # buscamos el nombre de la particion CACHE
+ # si la encuentra formateamos la formateamos
+ if [ `sgdisk /dev/sda -p | grep -o CACHE` == "CACHE" ]; then
+ # Formatear sistema de ficheros.
+ ogUnmountCache 2>/dev/null
+ mkfs.ext4 -q -F $DEV -L "CACHE" -O extent,large_file 2>/dev/null || ogRaiseError $OG_ERR_PARTITION "CACHE" || return $?
+ # Crear estructura básica.
+ MNTDIR=$(ogMountCache)
+ mkdir -p $MNTDIR/$OGIMG
+ fi
+else
+ # Error si no hay definida partición de caché.
+ DEV=$(ogFindCache) || ogRaiseError $OG_ERR_PARTITION "$MSG_NOCACHE" || return $?
+ DEV=$(ogDiskToDev $DEV) || return $?
+ # Formatear sistema de ficheros.
+ ogUnmountCache 2>/dev/null
+ mkfs.ext4 -q -F $DEV -L "CACHE" -O extent,large_file 2>/dev/null || ogRaiseError $OG_ERR_PARTITION "CACHE" || return $?
+ # Crear estructura básica.
+ MNTDIR=$(ogMountCache)
+ mkdir -p $MNTDIR/$OGIMG
+fi
+#agp
}
diff --git a/client/engine/Disk.lib b/client/engine/Disk.lib
index 11fe52ac..88fb132b 100755
--- a/client/engine/Disk.lib
+++ b/client/engine/Disk.lib
@@ -1261,6 +1261,7 @@ case "$PTTYPE" in
FREEBSD) ID=A503 ;;
HFS-BOOT) ID=AB00 ;;
HFS|HFS+) ID=AF00 ;;
+ HFSPLUS) ID=AF00 ;;
HFS-RAID) ID=AF01 ;;
SOLARIS-BOOT) ID=BE00 ;;
SOLARIS) ID=BF00 ;;
diff --git a/client/engine/FileSystem.lib b/client/engine/FileSystem.lib
index 18eea3d7..231d167e 100755
--- a/client/engine/FileSystem.lib
+++ b/client/engine/FileSystem.lib
@@ -63,8 +63,8 @@ case "$TYPE" in
FAT32) PROG="dosfsck"; PARAMS="-a"; CODES=1 ;;
FAT16) PROG="dosfsck"; PARAMS="-a"; CODES=1 ;;
FAT12) PROG="dosfsck"; PARAMS="-a"; CODES=1 ;;
- HFS) PROG="fsck.hfs" ;;
- HFSPLUS) PROG="fsck.hfsplus" ;;
+ HFS) PROG="fsck.hfs"; PARAMS="-f" ;;
+ HFSPLUS) PROG="fsck.hfs"; PARAMS="-f" ;;
UFS) PROG="fsck.ufs" ;;
*) ogRaiseError $OG_ERR_PARTITION "$1, $2, $TYPE"
return $? ;;
@@ -410,6 +410,8 @@ case "$ID" in
VFAT) TYPE="FAT32" ;; # Nota: usar "file -Ls" para detectar.
SWAP) TYPE="LINUX-SWAP" ;;
LVM*) TYPE="LINUX-LVM" ;;
+ HFSPLUS) TYPE="HFSPLUS" ;;
+ HFS) TYPE="HFS" ;;
*RAID*) TYPE="LINUX-RAID" ;;
*_MEMBER) TYPE="${TYPE/_MEMBER/}" ;;
esac
diff --git a/client/engine/Image.lib b/client/engine/Image.lib
index c9c09e5e..f66ab900 100755
--- a/client/engine/Image.lib
+++ b/client/engine/Image.lib
@@ -677,8 +677,19 @@ then
then
TOOLS=PARTCLONE
FS=$(echo $PARTCLONEINFO | awk '{gsub(/\: /,"\n"); print toupper($8);}')
- echo $PARTCLONEINFO | grep GB > /dev/null && SIZEFACTOR=1000000 || SIZEFACTOR=1024
- SIZE=$(echo $PARTCLONEINFO | awk -v FACTOR=$SIZEFACTOR '{gsub(/\: /,"\n"); printf "%d\n", $11*FACTOR;}')
+ if [ "$FS" == "HFS" || "$FS" == "HFSPLUS" || "$FS" == "FAT32" ]; then
+ FSPLUS=$(echo $PARTCLONEINFO | awk '{gsub(/\: /,"\n"); print toupper($9);}')
+ echo $PARTCLONEINFO | grep GB > /dev/null && SIZEFACTOR=1000000 || SIZEFACTOR=1024
+ if [ "$FSPLUS" -eq "PLUS" ]; then
+ FS=$FS$FSPLUS
+ SIZE=$(echo $PARTCLONEINFO | awk -v FACTOR=$SIZEFACTOR '{printf "%d\n", $17*FACTOR;}')
+ else
+ SIZE=$(echo $PARTCLONEINFO | awk -v FACTOR=$SIZEFACTOR '{printf "%d\n", $16*FACTOR;}')
+ fi
+ else
+ echo $PARTCLONEINFO | grep GB > /dev/null && SIZEFACTOR=1000000 || SIZEFACTOR=1024
+ SIZE=$(echo $PARTCLONEINFO | awk -v FACTOR=$SIZEFACTOR '{gsub(/\: /,"\n"); printf "%d\n", $11*FACTOR;}')
+ fi
IMGDETECT="TRUE"
fi
fi