source: repoman/bin/unmountimage

qndtest
Last change on this file was 744ecd6, checked in by irina <irinagomez@…>, 7 years ago

#770 Script de servidor sincronizadas: si no existe fichero de idioma toma por defecto el castellano.

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

  • Property mode set to 100755
File size: 1.5 KB
Line 
1#!/bin/bash
2#/**
3#        unmountimage
4#@brief  Desmonta imagen sincronizable
5#@param 1 imagen
6#@param 2 extension [ img|diff ] opcional, por defecto img
7#@return 
8#@exception OG_ERR_FORMAT     # 1 formato incorrecto.
9#@version 1.0 - Desmontar imagen sincronizable
10#@author  Irina Gomez
11#@date   2013-05-23
12#*/ ##
13BASEDIR=/opt/opengnsys
14REPODIR="$BASEDIR/images"
15REPOLOG=$BASEDIR/log/ogAdmRepo.log
16# Cargamos los mensajes en el idioma del sistema.
17# Comprobamos que el fichero de idioma existe. Si no "es_ES" por defecto.
18ls $BASEDIR/client/etc/lang.$LANG.conf &>/dev/null
19[ $? -eq 0 ] || LANG="es_ES"
20
21source $BASEDIR/client/etc/lang.$LANG.conf
22
23PROG="$(basename $0)"
24# Si se solicita, mostrar ayuda.
25if [ "$*" == "help" ]; then
26    echo -e " $PROG: $MSG_HELP_ogUnmountImage \n" \
27            "$MSG_FORMAT: $PROG nombre_image [ img|diff ] \n" \
28            "base -> $PROG Windows7 \n" \
29            "diff -> $PROG Ubuntu12 diff"
30   exit 0
31fi
32
33[ $# -lt 1 ] && echo -e "$PROG: Error: $MSG_ERR_FORMAT \n     $MSG_FORMAT: $PROG image [ img | diff ]" && exit 1
34
35if [ "$USER" != "root" ]; then
36        echo "$PROG: Error: solo ejecutable por root" >&2
37        exit 1
38fi
39
40# Comprobamos que imagen la imagen esta montada
41MOUNTDIR="$REPODIR/mount/$1"
42if [ "$2" == "diff" ]; then
43        IMGEXT="diff"
44        MOUNTDIR="$MOUNTDIR.diff"
45else
46        IMGEXT="img" 
47fi
48# Si la imaen no está montada me salgo
49df |grep "$MOUNTDIR$"  2>&1 >/dev/null || exit 0
50
51echo -ne UMOUNT_IMAGE "$1" $IMGEXT | /opt/opengnsys/sbin/ogAdmRepoAux
52echo "Los resultado se registran en $REPOLOG. "
Note: See TracBrowser for help on using the repository browser.