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
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_DONTSYNC_IMAGE #71 Imagen no sincronizable (es monolitica) |
---|
11 | #@version 1.0 - Reducir tamaño imagen sincronizable |
---|
12 | #@author Irina Gomez |
---|
13 | #@date 2013-05-23 |
---|
14 | #*/ ## |
---|
15 | BASEDIR=/opt/opengnsys |
---|
16 | REPODIR="$BASEDIR/images" |
---|
17 | REPOLOG=$BASEDIR/log/ogAdmRepo.log |
---|
18 | source $BASEDIR/client/etc/lang.$LANG.conf |
---|
19 | |
---|
20 | PROG="$(basename $0)" |
---|
21 | # Si se solicita, mostrar ayuda. |
---|
22 | if [ "$*" == "help" ]; then |
---|
23 | echo -e " $PROG: $MSG_HELP_ogReduceImage \n" \ |
---|
24 | "$MSG_FORMAT: $PROG nombre_image [ img|diff ] \n" \ |
---|
25 | "base -> $PROG Windows7 \n" \ |
---|
26 | "diff -> $PROG Ubuntu12 diff" |
---|
27 | exit 0 |
---|
28 | fi |
---|
29 | |
---|
30 | [ $# -lt 1 ] && echo -e "$PROG: Error: $MSG_ERR_FORMAT \n $MSG_FORMAT: $PROG image [ img | diff ]" && exit 1 |
---|
31 | |
---|
32 | if [ "$USER" != "root" ]; then |
---|
33 | echo "$PROG: Error: solo ejecutable por root" >&2 |
---|
34 | exit 1 |
---|
35 | fi |
---|
36 | |
---|
37 | [ "$2" == "" ] && IMGEXT="img" || IMGEXT="$2" |
---|
38 | # Comprobamos que existe imagen |
---|
39 | IMGFILE="$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 |
---|
44 | if ! file $IMGFILE | grep " BTRFS Filesystem" >/dev/null ; then |
---|
45 | echo "$PROG: Error: $MSG_ERR_DONTSYNC_IMAGE $1 $2" |
---|
46 | exit 71 |
---|
47 | fi |
---|
48 | echo -ne REDUCE_IMAGE "$1" $IMGEXT | /opt/opengnsys/sbin/ogAdmRepoAux |
---|
49 | echo "Los resultado se registran en $REPOLOG. " |
---|
Note: See
TracBrowser
for help on using the repository browser.