source: server/bin/mountimage @ 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.8 KB
Line 
1#!/bin/bash
2#/**
3#        mountimage
4#@brief  Monta imagen sincronizable en el repositorio con permisos de escritura
5#@param 1 imagen
6#@param 2 extension [ img|diff ] opcional, por defecto img
7#@return  Directorio de montaje de la imagen.
8#@exception OG_ERR_FORMAT     # 1 formato incorrecto.
9#@exception OG_ERR_NOTFOUND # 2 Fichero o dispositivo no encontrado
10#@exception OG_ERR_DONTSYNC_IMAGE  #71 Imagen no sincronizable (es monolitica)
11#@exception OG_ERR_DONTMOUNT_IMAGE # 70 Error al montar una imagen sincronizada
12#@version 1.0 - Montar imagen sincronizable
13#@author  Irina Gomez
14#@date   2013-05-23
15#*/ ##
16BASEDIR=/opt/opengnsys
17REPODIR="$BASEDIR/images"
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_ogMountImage \n" \
24            "$MSG_FORMAT: $PROG nombre_image [ img|diff ] \n" \
25            "base -> $PROG Windows7 \n" \
26            "diff -> $PROG Ubuntu12 diff"
27   exit 0
28fi
29
30[ $# -lt 1 ] && echo -e "$PROG: Error: $MSG_ERR_FORMAT \n     $MSG_FORMAT: $PROG image [ img | diff ]" && exit 1
31
32if [ "$USER" != "root" ]; then
33        echo "$PROG: Error: solo ejecutable por root" >&2
34        exit 1
35fi
36
37[ "$2" == "" ] && IMGEXT="img" || IMGEXT="$2"
38# Comprobamos que existe imagen
39IMGFILE="$REPODIR/$1.$IMGEXT"
40[ ! -f $IMGFILE ] && echo "$PROG: Error: $MSG_ERR_NOTFOUND $1 $IMGEXT" && exit 2
41
42
43# Comprobar que la imagen  es sincronizable
44if ! file $IMGFILE | grep " BTRFS Filesystem" >/dev/null ; then
45        echo "$PROG: Error: $MSG_ERR_DONTSYNC_IMAGE $1 $2"
46        exit 71
47fi
48
49MOUNTDIR="$REPODIR/mount/$1"
50[ "$IMGEXT" == "diff" ] && MOUNTDIR="$MOUNTDIR.$IMGEXT"
51mkdir -p "$MOUNTDIR"
52mount -o compress=lzo  "$IMGFILE" "$MOUNTDIR"
53[ "$?" == "0" ] || ( echo "$MSG_ERR_DONTMOUNT_IMAGE  $1 $2" ; exit 70)
54echo  "$MOUNTDIR"
55
Note: See TracBrowser for help on using the repository browser.