Versión 1.0.4, #526: Corregida errata en función {{{ogCreateGptPartitionTable}}}, generando error si se declara partición extendida.

git-svn-id: https://opengnsys.es/svn/branches/version1.0@3146 a21b9725-9963-47de-94b9-378ad31fedc9
remotes/github/debian-pkg
ramon 2012-06-06 09:12:59 +00:00
parent 4b4b0e070b
commit 499bf463a0
1 changed files with 7 additions and 4 deletions

View File

@ -178,7 +178,7 @@ SECTORS=$(ogGetLastSector $1)
[ "$ND" = "${CACHEPART% *}" ] && CACHESIZE=$(ogGetCacheSize 2>/dev/null | awk '{print $0*2}')
[ -n "$CACHESIZE" ] && SECTORS=$[SECTORS-CACHESIZE]
# Si el disco es GPT empieza en el sector 2048 por defecto, pero podria cambiarse
ALIGN=`sgdisk -D $DISK`
ALIGN=$(sgdisk -D $DISK 2>/dev/null)
START=$ALIGN
PART=1
@ -194,9 +194,12 @@ while [ $# -gt 0 ]; do
TYPE="${1%%:*}"
SIZE="${1#*:}"
# Error si la partición es extendida (no válida en discos GPT).
[ "$TYPE" == "EXTENDED" ] || ogRaiseError $OG_ERR_PARTITION "EXTENDED" || return $?
if [ "$TYPE" == "EXTENDED" ]; then
ogRaiseError $OG_ERR_PARTITION "EXTENDED"
return $?
fi
# Comprobar si existe la particion actual, capturamos su tamaño para ver si cambio o no
PARTSIZE=$(ogGetPartitionSize $ND $PART)
PARTSIZE=$(ogGetPartitionSize $ND $PART 2>/dev/null)
# En sgdisk no se pueden redimensionar las particiones, es necesario borrarlas y volver a crealas
[ $PARTSIZE ] && DELOPTIONS="$DELOPTIONS -d$PART"
# Creamos la particion
@ -228,7 +231,7 @@ ogUnmountAll $ND 2>/dev/null
ogCreatePartitionTable $ND
# Definir particiones y notificar al kernel.
# Borramos primero las particiones y luego creamos las nuevas
sgdisk $DELOPTIONS $OPTIONS $DISK && partprobe $DISK
sgdisk $DELOPTIONS $OPTIONS $DISK 2>/dev/null && partprobe $DISK
[ -n "$CACHESIZE" ] && ogMountCache 2>/dev/null
}