source: admin/Interface/CrearImagen @ cead9e3

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 cead9e3 was 4ceafc1, checked in by irina <irinagomez@…>, 9 years ago

#679 Varios repos: crear imagen permite elegir el repositorio de destino de la imagen

git-svn-id: https://opengnsys.es/svn/branches/version1.1@4745 a21b9725-9963-47de-94b9-378ad31fedc9

  • Property mode set to 100755
File size: 2.9 KB
Line 
1#!/bin/bash
2
3#___________________________________________________
4#
5# PARAMETROS RECIBIDOS DESDE EL CLIENTE:
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#___________________________________________________
11
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
31
32TIME1=$SECONDS
33
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
37
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
41
42# Registro de inicio de ejecución
43ogEcho log session "$MSG_INTERFACE_START $0 $*"
44
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 $?
52fi
53
54# Valor por defecto para el repositorio.
55REPO=${4:-"REPO"}
56[ "$REPO" == "$(ogGetIpAddress)" ] && REPO="CACHE"
57# Si es una ip y es distinta a la del recurso samba cambiamos de REPO.
58ogCheckIpAddress $REPO
59if [ $? == 0 -o $REPO == "REPO" ] ; then
60        # Si falla el cambio -> salimos con error repositorio no valido
61        ogChangeRepo $REPO || exit $(ogRaiseError $OG_ERR_NOTFOUND '$REPO'; echo $?)
62        REPO="REPO"
63fi
64
65# Si el destino es REPO y el cliente no está en modo "admin"; activar repositorio para escritura,
66if [ "$REPO" == "REPO" -a "$boot" != "admin"  ]
67then
68        CambiarAcceso admin &>> $OGLOGFILE
69        RETVAL=$?
70        [ $RETVAL -gt 0 ] && exit $RETVAL       
71fi
72
73ogEcho  createImage "$1" "$2" "$4" /"$3"
74# Si existe, ejecuta script personalizado "createImageCustom"; si no, llama al genérico "createImage".
75if which createImageCustom &>/dev/null; then
76        createImageCustom "$1" "$2" "$4" /"$3" &>> $OGLOGCOMMAND
77else
78        createImage "$1" "$2" "$4" /"$3" &>> $OGLOGCOMMAND
79fi
80RETVAL=$?
81
82# Cambiar acceso a modo usuario, si es necesario.
83[ "$REPO" == "REPO" -a "$boot" != "admin" ] && CambiarAcceso user
84
85# Registro de fin de ejecución
86ogEcho log session "$MSG_INTERFACE_END $RETVAL"
87
88exit $RETVAL
89
Note: See TracBrowser for help on using the repository browser.