source: admin/Interface/CrearImagen @ 91ff67b

Last change on this file since 91ff67b was de687e3, checked in by ramon <ramongomez@…>, 10 years ago

#673: Integrar código de la versión 1.0.6 en rama principal.

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

  • Property mode set to 100755
File size: 2.7 KB
RevLine 
[3ec149c]1#!/bin/bash
2
[f6c1d2b]3#___________________________________________________
[3ec149c]4#
5# PARAMETROS RECIBIDOS DESDE EL CLIENTE:
[f6c1d2b]6# $1 Número de disco
7# $2 Número de particion
8# $3 Nombre canónico de la imagen (sin extensión)
9# $4 Dirección del repositorio (REPO, por defecto)
10#___________________________________________________
[914d834]11
[ecd8d9a]12
13#$OG_ERR_NOTEXEC    Si no es llamada por OG client
14#$OG_ERR_LOCKED=4    Si la particion está bloqueada.
15
16
17#Codigos de error del scripts createImage
18#@exception OG_ERR_FORMAT     # 1 formato incorrecto.
19#@exception OG_ERR_PARTITION  # 3 Error en partición de disco o en su sistema de archivos
20#@exception OG_ERR_IMAGE      # 5 Error en funcion ogCreateImage o ogRestoreImage.
21#@exception OG_ERR_NOTWRITE   # 14 error de escritura
22#@exception OG_ERR_NOTCACHE   # 15 si cache no existe 15
23#@exception OG_ERR_CACHESIZE  # 16 si espacio de la cache local o remota no tiene espacio 16
24#@exception OG_ERR_REDUCEFS   # 17 error al reducir sistema de archivos.
25#@exception OG_ERR_EXTENDFS   # 18 Errror al expandir el sistema de archivos.
26
27
28#Códigos de error de la funcion ogCreateImage
29
30
[71643c0]31
[91aaf03]32TIME1=$SECONDS
[ecd8d9a]33
[91aaf03]34#Load engine configurator from engine.cfg file.
35#Carga el configurador del engine desde el fichero engine.cfg
36[ -z $OGENGINECONFIGURATE ] && source /opt/opengnsys/etc/engine.cfg
[914d834]37
[91aaf03]38# Clear temporary file used as log track by httpdlog
39# Limpia los ficheros temporales usados como log de seguimiento para httpdlog
40echo " " > $OGLOGSESSION; echo " " > $OGLOGCOMMAND; echo " " > ${OGLOGCOMMAND}.tmp
[71643c0]41
[91aaf03]42# Registro de inicio de ejecución
[1602040]43ogEcho log session "$MSG_INTERFACE_START $0 $*"
[71643c0]44
[f6c1d2b]45# Solo ejecutable por OpenGnSys Client.
46PATH=$PATH:$(dirname $0)
47PROG=$(basename $0)
48CALLER=$(ogGetCaller)
49if [ "$CALLER" != "ogAdmClient" ]; then
50        ogRaiseError $OG_ERR_NOTEXEC "$CALLER -> $PROG"
51        exit $?
[914d834]52fi
53
[f6c1d2b]54# Valor por defecto para el repositorio.
[16ac86e]55REPO=${4:-"REPO"}
56[ "$REPO" == "$(ogGetRepoIp)" ] && REPO="REPO"
57[ "$REPO" == "$(ogGetIpAddress)" ] && REPO="CACHE"
[ecd8d9a]58[ "$REPO" == "CACHE" ] && REPO="CACHE"
59
60# Si el destino es REPO y el cliente no está en modo "admin"; activar repositorio para escritura,
61if [ "$REPO" == "REPO" -a "$boot" != "admin"  ]
62then
63        CambiarAcceso admin &>> $OGLOGFILE
64        RETVAL=$?
65        [ $RETVAL -gt 0 ] && exit $RETVAL       
66fi
67
[de687e3]68# Si existe, ejecuta script personalizado "createImageCustom"; si no, llama al genérico "createImage".
69if which createImageCustom &>/dev/null; then
70        createImageCustom "$1" "$2" "$REPO" /"$3" &>> $OGLOGCOMMAND
[d9d1720]71else
[71643c0]72        createImage "$1" "$2" "$REPO" /"$3" &>> $OGLOGCOMMAND
[d9d1720]73fi
[f6c1d2b]74RETVAL=$?
[ecd8d9a]75
[de687e3]76# Cambiar acceso a modo usuario, si es necesario.
[ecd8d9a]77[ "$REPO" == "REPO" -a "$boot" != "admin" ] && CambiarAcceso user
78
[91aaf03]79# Registro de fin de ejecución
[1602040]80ogEcho log session "$MSG_INTERFACE_END $RETVAL"
[ecd8d9a]81
[f6c1d2b]82exit $RETVAL
[d9d1720]83
Note: See TracBrowser for help on using the repository browser.