source: client/nfsexport/scripts/restore-image.sh @ 9a2cda1e

918-git-images-111dconfigfileconfigure-oglivegit-imageslgromero-new-oglivemainmaint-cronmount-efivarfsmultivmmultivm-ogboot-installerogClonningEngineogboot-installer-jenkinsoglive-ipv6test-python-scriptsticket-301ticket-50ticket-50-oldticket-577ticket-585ticket-611ticket-612ticket-693ticket-700ubu24tplunification2use-local-agent-oglivevarios-instalacionwebconsole3
Last change on this file since 9a2cda1e was 892606b9, checked in by irina <irinagomez@…>, 16 years ago

Cambios en OpenGNSys Installer

git-svn-id: https://opengnsys.es/svn/trunk@477 a21b9725-9963-47de-94b9-378ad31fedc9

  • Property mode set to 100755
File size: 1.6 KB
RevLine 
[f8f4dfa]1#!/bin/bash
[e42f34e]2# Scirpt de ejemplo para restaurar una imagen.
[f8f4dfa]3# (puede usarse como base para el programa de restauración de imágenes usado por OpenGNSys Admin).
4
[f5432db7]5TIME1=$SECONDS
[f8f4dfa]6PROG="$(basename $0)"
7if [ $# -ne 4 ]; then
[892606b9]8    ogRaiseError $OG_ERR_FORMAT "Formato: $PROG REPO|CACHE imagen ndisco nparticion"
[f8f4dfa]9    exit $?
10fi
11
12# Procesar parámetros de entrada
[c7d9af7]13IMGFILE=$(ogGetPath "$1" "$2.img")
[e42f34e]14if [ "$1" == "CACHE" -o "$1" == "cache" ]; then
[c7d9af7]15    IMGDIR=$(ogGetParentPath "$1" "$2")
16    # Si no existe el directorio de la imagen, crearlo.
[b9a5881]17    if [ -z "$IMGDIR" ]; then
[c7d9af7]18        echo "Creando directorio de imagen \"$1, ${2%/*}\"."
19        ogMakeDir "$1" "${2%/*}" || ogRaiseError $OG_ERR_NOTFOUND "$1, ${2%/*}" || exit $?
20    fi
21    IMGDIR=$(ogGetParentPath "$1" "$2") || ogRaiseError $OG_ERR_NOTFOUND "$1, ${2%/*}" || exit $?
[e42f34e]22    if [ -z "$IMGFILE" ]; then
23        echo "Copiando imagen \"$2\" del repositorio a caché local"
[c7d9af7]24        ogCopyFile "repo" "$2.img" "$IMGDIR" || exit $?
25        IMGFILE=$(ogGetPath "cache" "$2.img")
[e42f34e]26    fi
[c7d9af7]27fi
28if [ -z "$IMGFILE" ]; then
29    ogRaiseError $OG_ERR_NOTFOUND "$1, $2"
30    exit $?
[e42f34e]31fi
[f8f4dfa]32PART=$(ogDiskToDev "$3" "$4") || exit $?
33
34# Restaurar la imagen.
[1c04494]35ogEcho info "$PROG: Origen=$IMGFILE, Destino=$PART"
36ogRestoreImage "$@" || exit $?
[f8f4dfa]37# Restaurar tamaño.
[1c04494]38ogEcho info "$PROG: Extender sistema de archivos."
[f5432db7]39ogExtendFs $3 $4
[1c04494]40# Cambiar nombre en sistemas Windows.
[9fb5086]41if [ "$(ogGetOsType $3 $4)" = "Windows" ]; then
42    HOST=$(ogGetHostname)
43    HOST=${HOST:-"UNKNOWN"}
44    ogEcho info "$PROG: Cambiar nombre Windows a \"$HOST\"."
[f5432db7]45    ogSetWindowsName $3 $4 "$HOST"
[1c04494]46fi
[f5432db7]47TIME=$[SECONDS-TIME1]
48ogEcho info "$PROG: Duración de la operación $[TIME/60]m $[TIME%60]s"
[f8f4dfa]49
Note: See TracBrowser for help on using the repository browser.