diff options
author | irina <irinagomez@us.es> | 2016-06-28 11:12:14 +0000 |
---|---|---|
committer | irina <irinagomez@us.es> | 2016-06-28 11:12:14 +0000 |
commit | 16f28b7b67dac9b5e18b74e8c0333c3bf0e0b802 (patch) | |
tree | 7a37061bbb170fdcc1f8aed98c9bb73f25ea0790 /client/engine/Cache.lib | |
parent | 2bd7547aa335fb698084f34ce533a6a619612658 (diff) |
#724 ogCreateCache: se modifica la función para adaptarla a los cambios del comando sfdisk. initCache: se resuelve errata cuando no había cache intentaba borrarla.
git-svn-id: https://opengnsys.es/svn/branches/version1.1@4969 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'client/engine/Cache.lib')
-rwxr-xr-x | client/engine/Cache.lib | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/client/engine/Cache.lib b/client/engine/Cache.lib index 4463cc54..b0afb2d4 100755 --- a/client/engine/Cache.lib +++ b/client/engine/Cache.lib @@ -39,7 +39,7 @@ function ogCreateCache () { # Variables locales. -local FINDCACHE NDSK SIZECACHE PART DISK START END ENDPREVPART SIZE MINSIZE MAXSIZE PTTYPE ID +local FINDCACHE NDSK SIZECACHE PART DISK START END ENDPREVPART SIZE MINSIZE MAXSIZE PTTYPE ID TMPFILE # Si se solicita, mostrar ayuda. if [ "$*" == "help" ]; then ogHelp "$FUNCNAME" "$FUNCNAME [int_ndisk [int_npart]] int_partsize" \ @@ -74,6 +74,7 @@ case $# in ;; esac +TMPFILE=/tmp/sfdisk$$ DISK=$(ogDiskToDev $NDSK) || return $? END=$[$(ogGetLastSector $NDSK 2>/dev/null)] # Sector final del disco. SIZE=$[$SIZECACHE*2] # Tamaño en sectores de 512 B. @@ -111,7 +112,13 @@ case "$(ogGetPartitionTableType $NDSK)" in parted -s $DISK print &>/dev/null || fdisk $DISK <<< "w" # Definir particiones y notificar al kernel. ID=$(ogTypeToId CACHE MSDOS) - sfdisk -f $DISK -uS -N$PART <<<"$START,$SIZE,$ID" 2>/dev/null && partprobe + # Salvamos la configuración de las particiones e incluimos la cache. + trap "rm -f $TMPFILE" 1 2 3 9 15 + sfdisk --dump $DISK | grep -v $DISK$PART > $TMPFILE + echo "$DISK$PART : start= $START, size= $SIZE, type=$ID" >> $TMPFILE + # Guardamos nueva configuración en el disco. + sfdisk --no-reread $DISK < $TMPFILE && partprobe + rm -f $TMPFILE ;; esac } |