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

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 9fb5086 was 9fb5086, checked in by ramon <ramongomez@…>, 16 years ago

Corrección caminos en scripts de instalación; función en pruebas ogGetHostname.

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

  • Property mode set to 100755
File size: 1.2 KB
Line 
1#!/bin/bash
2# Scirpt de ejemplo para restaurar una imagen.
3# (puede usarse como base para el programa de restauración de imágenes usado por OpenGNSys Admin).
4
5PROG="$(basename $0)"
6if [ $# -ne 4 ]; then
7    ogRaiseError $OG_ERR_FORMAT "Formato: $PROG ndisco nparticion REPO|CACHE imagen"
8    exit $?
9fi
10
11# Procesar parámetros de entrada
12if [ "$1" == "CACHE" -o "$1" == "cache" ]; then
13    # Si la imagen no está en la caché, copiarla del repositorio.
14    IMGDIR=$(ogGetParentPath "$1" "$2") || exit $?
15    IMGFILE=$(ogGetPath "$1" "$2")
16    if [ -z "$IMGFILE" ]; then
17        echo "Copiando imagen \"$2\" del repositorio a caché local"
18        ogCopyFile "repo" "$2" "$IMGDIR" || exit $?
19        IMGFILE=$(ogGetPath "cache" "$2") || exit $?
20    fi
21else
22    IMGFILE=$(ogGetPath "$1" "$2") || exit $?
23fi
24PART=$(ogDiskToDev "$3" "$4") || exit $?
25
26# Restaurar la imagen.
27ogEcho info "$PROG: Origen=$IMGFILE, Destino=$PART"
28ogRestoreImage "$@" || exit $?
29# Restaurar tamaño.
30ogEcho info "$PROG: Extender sistema de archivos."
31ogExtendFs $1 $2
32# Cambiar nombre en sistemas Windows.
33if [ "$(ogGetOsType $3 $4)" = "Windows" ]; then
34    HOST=$(ogGetHostname)
35    HOST=${HOST:-"UNKNOWN"}
36    ogEcho info "$PROG: Cambiar nombre Windows a \"$HOST\"."
37    ogSetWindowsName "$HOST"
38fi
39
Note: See TracBrowser for help on using the repository browser.