source: server/bin/reduceimage @ d5c3ce2

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 d5c3ce2 was f456755, checked in by irina <irinagomez@…>, 12 years ago

#565 adaptacion diferenciales al cliente 1.0.4., extension diferenciles img.diff

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

  • Property mode set to 100755
File size: 1.8 KB
Line 
1#!/bin/bash
2#/**
3#        reduceimage
4#@brief  Reduce el archivo de la imagen a tamaño datos + 500M
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#@exception OG_ERR_NOTFOUND # 2 Fichero o dispositivo no encontrado
10#@exception OG_ERR_LOCKED          # 4 Partición o fichero bloqueado
11#@exception OG_ERR_DONTSYNC_IMAGE  #71 Imagen no sincronizable (es monolitica)
12#@version 1.0 - Reducir tamaño imagen sincronizable
13#@author  Irina Gomez
14#@date   2013-05-23
15#*/ ##
16BASEDIR=/opt/opengnsys
17REPODIR="$BASEDIR/images"
18REPOLOG=$BASEDIR/log/ogAdmRepo.log
19source $BASEDIR/client/etc/lang.$LANG.conf
20
21PROG="$(basename $0)"
22# Si se solicita, mostrar ayuda.
23if [ "$*" == "help" ]; then
24    echo -e " $PROG: $MSG_HELP_ogReduceImage \n" \
25            "$MSG_FORMAT: $PROG nombre_image [ img|diff ] \n" \
26            "base -> $PROG Windows7 \n" \
27            "diff -> $PROG Ubuntu12 diff"
28   exit 0
29fi
30
31[ $# -lt 1 ] && echo -e "$PROG: Error: $MSG_ERR_FORMAT \n     $MSG_FORMAT: $PROG image [ img | diff ]" && exit 1
32
33if [ "$USER" != "root" ]; then
34        echo "$PROG: Error: solo ejecutable por root" >&2
35        exit 1
36fi
37
38[ "$2" == "" -o "$2" == "img" ] && IMGEXT="img" || IMGEXT="img.diff"
39# Comprobamos que existe imagen y que no este bloqueada
40IMGFILE="$REPODIR/$1.$IMGEXT"
41[ ! -f $IMGFILE ] && echo "$PROG: Error: $MSG_ERR_NOTFOUND $1 $IMGEXT" && exit 2
42[ -f $IMGFILE.lock ] && echo "$PROG: Error: $MSG_ERR_LOCKED $1 $IMGEXT" && exit 4
43
44# Comprobar que la imagen  es sincronizable
45if ! file $IMGFILE | grep -i -e " BTRFS Filesystem " -e " ext4 filesystem " >/dev/null ; then
46        echo "$PROG: Error: $MSG_ERR_DONTSYNC_IMAGE $1 $2"
47        exit 71
48fi
49
50touch $IMGFILE.lock
51echo -ne REDUCE_IMAGE "$1" ${IMGEXT#*\.} | /opt/opengnsys/sbin/ogAdmRepoAux
52echo "Los resultado se registran en $REPOLOG. "
53
54rm $IMGFILE.lock
Note: See TracBrowser for help on using the repository browser.