source: server/bin/createfileimage @ 9dba4c18

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 9dba4c18 was 288b716, checked in by irina <irinagomez@…>, 12 years ago

#565 correccion de comentarios de los comandos para las imagenes sincronizables

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

  • Property mode set to 100755
File size: 1.6 KB
Line 
1#!/bin/bash
2#/**
3#       createtimage
4#@brief  Crea o redimensiona el archivo de la imagen.
5#@param 1 imagen
6#@param 2 extension [ img|diff ]
7#@param 3 tamaño de la imagen en kb.
8#@return 
9#@exception OG_ERR_FORMAT     # 1 formato incorrecto.
10#@exception OG_ERR_DONTSYNC_IMAGE  #71 Imagen no sincronizable (es monolitica)
11#@version 1.0 - Montar imagen sincronizable
12#@author  Irina Gomez
13#@date   2013-05-23
14#*/ ##
15BASEDIR=/opt/opengnsys
16REPODIR="$BASEDIR/images"
17REPOLOG=$BASEDIR/log/ogAdmRepo.log
18source $BASEDIR/client/etc/lang.$LANG.conf
19
20PROG="$(basename $0)"
21# Si se solicita, mostrar ayuda.
22if [ "$*" == "help" ]; then
23    echo -e " $PROG: $MSG_HELP_ogCreateFileImage \n" \
24            "$MSG_FORMAT: $PROG image [ img|diff ] size_kb \n" \
25            "base -> $PROG Windows7 img 3900000 \n" \
26            "diff -> $PROG Ubuntu12 diff 450000"
27   exit 0
28fi
29
30[ $# -lt 3 ] && echo -e "$PROG: Error: $MSG_ERR_FORMAT \n     $MSG_FORMAT: $PROG image [ img | diff ]  size_Kb "  && exit 1
31
32if [ "$USER" != "root" ]; then
33        echo "$PROG: Error: solo ejecutable por root" >&2
34        exit 1
35fi
36
37IMGEXT="$2"
38
39# Si existe imagen, Comprobamos que  es sincronizable
40IMGFILE="$REPODIR/$1.$IMGEXT"
41if [ -f $IMGFILE ]; then
42   if ! file $IMGFILE | grep " BTRFS Filesystem" >/dev/null ; then
43        echo "$PROG: Error: $MSG_ERR_DONTSYNC_IMAGE $1 $2"
44        exit 71
45   fi
46fi
47
48# El tamaño minimo de la imagen es 300000 para poder formatear en fs btrfs.
49SIZEREQUIRED=$3
50[ $SIZEREQUIRED -lt 300000 ] && SIZEREQUIRED=300000
51
52echo  CREATE_IMAGE "$1" $IMGEXT $SIZEREQUIRED
53echo -ne CREATE_IMAGE "$1" $IMGEXT $SIZEREQUIRED| /opt/opengnsys/sbin/ogAdmRepoAux
54echo "Los resultado se registran en $REPOLOG. "
Note: See TracBrowser for help on using the repository browser.