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
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 | |
---|
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 |
---|
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 |
---|
24 | PART=$(ogDiskToDev "$3" "$4") || exit $? |
---|
25 | |
---|
26 | # Restaurar la imagen. |
---|
27 | ogEcho info "$PROG: Origen=$IMGFILE, Destino=$PART" |
---|
28 | ogRestoreImage "$@" || exit $? |
---|
29 | # Restaurar tamaño. |
---|
30 | ogEcho info "$PROG: Extender sistema de archivos." |
---|
31 | ogExtendFs $1 $2 |
---|
32 | # Cambiar nombre en sistemas Windows. |
---|
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" |
---|
38 | fi |
---|
39 | |
---|
Note: See
TracBrowser
for help on using the repository browser.