source: client/nfsexport/scripts/restore-image.sh @ 1c04494

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

Correcciones en scripts; metafunción ogGetOsType.

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

  • Property mode set to 100755
File size: 1.2 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
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
[e42f34e]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
[f8f4dfa]24PART=$(ogDiskToDev "$3" "$4") || exit $?
25
26# Restaurar la imagen.
[1c04494]27ogEcho info "$PROG: Origen=$IMGFILE, Destino=$PART"
28ogRestoreImage "$@" || exit $?
[f8f4dfa]29# Restaurar tamaño.
[1c04494]30ogEcho info "$PROG: Extender sistema de archivos."
[f8f4dfa]31ogExtendFs $1 $2
[1c04494]32# Cambiar nombre en sistemas Windows.
33if [ "$(ogGetOsType  $3 $4)" = "Windows" ]; then
34    ogEcho info "$PROG: Cambiar nombre Windows."
35    # ogSetWindowsName "$(ogGetHostname)"
36fi
[f8f4dfa]37
Note: See TracBrowser for help on using the repository browser.