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
Rev | Line | |
---|
[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 | |
---|
| 5 | PROG="$(basename $0)" |
---|
| 6 | if [ $# -ne 4 ]; then |
---|
| 7 | ogRaiseError $OG_ERR_FORMAT "Formato: $PROG ndisco nparticion REPO|CACHE imagen" |
---|
| 8 | exit $? |
---|
| 9 | fi |
---|
| 10 | |
---|
| 11 | # Procesar parámetros de entrada |
---|
[e42f34e] | 12 | if [ "$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 |
---|
| 21 | else |
---|
| 22 | IMGFILE=$(ogGetPath "$1" "$2") || exit $? |
---|
| 23 | fi |
---|
[f8f4dfa] | 24 | PART=$(ogDiskToDev "$3" "$4") || exit $? |
---|
| 25 | |
---|
| 26 | # Restaurar la imagen. |
---|
[1c04494] | 27 | ogEcho info "$PROG: Origen=$IMGFILE, Destino=$PART" |
---|
| 28 | ogRestoreImage "$@" || exit $? |
---|
[f8f4dfa] | 29 | # Restaurar tamaño. |
---|
[1c04494] | 30 | ogEcho info "$PROG: Extender sistema de archivos." |
---|
[f8f4dfa] | 31 | ogExtendFs $1 $2 |
---|
[1c04494] | 32 | # Cambiar nombre en sistemas Windows. |
---|
[9fb5086] | 33 | if [ "$(ogGetOsType $3 $4)" = "Windows" ]; then |
---|
| 34 | HOST=$(ogGetHostname) |
---|
| 35 | HOST=${HOST:-"UNKNOWN"} |
---|
| 36 | ogEcho info "$PROG: Cambiar nombre Windows a \"$HOST\"." |
---|
| 37 | ogSetWindowsName "$HOST" |
---|
[1c04494] | 38 | fi |
---|
[f8f4dfa] | 39 | |
---|
Note: See
TracBrowser
for help on using the repository browser.