source: repoman/bin/reduceimage @ 3b8ef0d

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 3b8ef0d 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: 2.0 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
19# Cargamos los mensajes en el idioma del sistema.
20# Comprobamos que el fichero de idioma existe. Si no "es_ES" por defecto.
21ls $BASEDIR/client/etc/lang.$LANG.conf &>/dev/null
22[ $? -eq 0 ] || LANG="es_ES"
23source $BASEDIR/client/etc/lang.$LANG.conf
24
25PROG="$(basename $0)"
26# Si se solicita, mostrar ayuda.
27if [ "$*" == "help" ]; then
28    echo -e " $PROG: $MSG_HELP_ogReduceImage \n" \
29            "$MSG_FORMAT: $PROG nombre_image [ img|diff ] \n" \
30            "base -> $PROG Windows7 \n" \
31            "diff -> $PROG Ubuntu12 diff"
32   exit 0
33fi
34
35[ $# -lt 1 ] && echo -e "$PROG: Error: $MSG_ERR_FORMAT \n     $MSG_FORMAT: $PROG image [ img | diff ]" && exit 1
36
37if [ "$USER" != "root" ]; then
38        echo "$PROG: Error: solo ejecutable por root" >&2
39        exit 1
40fi
41
42[ "$2" == "" -o "$2" == "img" ] && IMGEXT="img" || IMGEXT="img.diff"
43# Comprobamos que existe imagen y que no este bloqueada
44IMGFILE="$REPODIR/$1.$IMGEXT"
45[ ! -f $IMGFILE ] && echo "$PROG: Error: $MSG_ERR_NOTFOUND $1 $IMGEXT" && exit 2
46[ -f $IMGFILE.lock ] && echo "$PROG: Error: $MSG_ERR_LOCKED $1 $IMGEXT" && exit 4
47
48# Comprobar que la imagen  es sincronizable
49if ! file $IMGFILE | grep -i -e " BTRFS Filesystem " -e " ext4 filesystem " >/dev/null ; then
50        echo "$PROG: Error: $MSG_ERR_DONTSYNC_IMAGE $1 $2"
51        exit 71
52fi
53
54touch $IMGFILE.lock
55echo -ne REDUCE_IMAGE "$1" ${IMGEXT#*\.} | /opt/opengnsys/sbin/ogAdmRepoAux
56echo "Los resultado se registran en $REPOLOG. "
57
58rm $IMGFILE.lock
Note: See TracBrowser for help on using the repository browser.