source: client/nfsexport/scripts/createImage @ 8850d1b

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 8850d1b was 6d3f526, checked in by ramon <ramongomez@…>, 15 years ago

Corregir errata en ogCreatePartitions solucioando pérdida del parámetro disco (Close #257).
Modificar script createImage para chequear el sistema de archivos.

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

  • Property mode set to 100755
File size: 1.5 KB
Line 
1#!/bin/bash
2# create-image.sh - Scirpt de ejemplo para crear una imagen de un sistema de archivos.
3# (puede usarse como base para el programa de creación de imágenes usado por OpenGNSys Admin).
4
5TIME1=$SECONDS
6PROG="$(basename $0)"
7if [ $# -ne 4 ]; then
8    ogRaiseError $OG_ERR_FORMAT "$MSG_FORMAT: $PROG ndisco nparticion REPO|CACHE imagen"
9    exit $?
10fi
11
12# Si el repositorio es CACHE comprobamos que exista
13if [ "$3" == "CACHE" -o "$3" == "cache" ]; then
14    if ! $(ogFindCache >/dev/null); then
15        ogRaiseError $OG_ERR_NOTFOUND "CACHE"
16        exit $?
17    fi
18fi
19
20# Obtener información de los parámetros de entrada.
21PART=$(ogDiskToDev "$1" "$2") || exit $?
22IMGDIR=$(ogGetParentPath "$3" "/$4")
23# Si no existe, crear subdirectorio de la imagen.
24if [ $? != 0 ]; then
25    echo "[5] Crear subdirectorio de la imagen \"$3 $(dirname "$4")."
26    ogMakeDir "$3" $(dirname "/$4")
27    IMGDIR=$(ogGetParentPath "$3" "/$4") || exit $?
28fi
29IMGFILE=$IMGDIR/$(basename "/$4").pgz
30# Renombrar el fichero de imagen si ya existe.
31if [ -f "$IMGFILE" ]; then
32    echo "[10] Renombrar \"$IMGFILE\" por \"$IMGFILE.ant\"."
33    mv "$IMGFILE" "$IMGFILE.ant"
34    mv "$IMGFILE.torrent" "$IMGFILE.torrent.ant" 2>/dev/null
35fi
36# Mostrar información.
37echo "[15] $PROG: Origen=$PART, Destino=$IMGFILE"
38
39# Comprobar consistencia del sistema de archivos.
40echo "[20] Comprobar sistema de archivos."
41ogCheckFs $1 $2
42
43# Crear la imagen.
44echo "[30] Crear imagen."
45ogCreateImage $1 "$2" $3 $4 || exit $?
46
47TIME=$[SECONDS-TIME1]
48echo "[100] Duracion de la operacion $[TIME/60]m $[TIME%60]s"
49
Note: See TracBrowser for help on using the repository browser.