close
Warning:
Failed to sync with repository "ogBrowser-Git": (1366, "Incorrect string value: '\\xF0\\x9F\\x93\\xA6 I...' for column 'message' at row 1"); repository information may be out of date. Look in the Trac log for more information including mitigation strategies.
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 | # createtimage |
|---|
| 4 | #@brief Crea o redimensiona el archivo de la imagen. |
|---|
| 5 | #@param 1 imagen |
|---|
| 6 | #@param 2 extension [ img|diff ] |
|---|
| 7 | #@param 3 tamaño de la imagen en kb. |
|---|
| 8 | #@return |
|---|
| 9 | #@exception OG_ERR_FORMAT # 1 formato incorrecto. |
|---|
| 10 | #@exception OG_ERR_DONTSYNC_IMAGE #71 Imagen no sincronizable (es monolitica) |
|---|
| 11 | #@version 1.0 - Montar 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_ogCreateFileImage \n" \ |
|---|
| 24 | "$MSG_FORMAT: $PROG image [ img|diff ] size_kb \n" \ |
|---|
| 25 | "base -> $PROG Windows7 img 3900000 \n" \ |
|---|
| 26 | "diff -> $PROG Ubuntu12 diff 450000" |
|---|
| 27 | exit 0 |
|---|
| 28 | fi |
|---|
| 29 | |
|---|
| 30 | [ $# -lt 3 ] && echo -e "$PROG: Error: $MSG_ERR_FORMAT \n $MSG_FORMAT: $PROG image [ img | diff ] size_Kb " && exit 1 |
|---|
| 31 | |
|---|
| 32 | if [ "$USER" != "root" ]; then |
|---|
| 33 | echo "$PROG: Error: solo ejecutable por root" >&2 |
|---|
| 34 | exit 1 |
|---|
| 35 | fi |
|---|
| 36 | |
|---|
| 37 | IMGEXT="$2" |
|---|
| 38 | |
|---|
| 39 | # Si existe imagen, Comprobamos que es sincronizable |
|---|
| 40 | IMGFILE="$REPODIR/$1.$IMGEXT" |
|---|
| 41 | if [ -f $IMGFILE ]; then |
|---|
| 42 | if ! file $IMGFILE | grep " BTRFS Filesystem" >/dev/null ; then |
|---|
| 43 | echo "$PROG: Error: $MSG_ERR_DONTSYNC_IMAGE $1 $2" |
|---|
| 44 | exit 71 |
|---|
| 45 | fi |
|---|
| 46 | fi |
|---|
| 47 | |
|---|
| 48 | # El tamaño minimo de la imagen es 300000 para poder formatear en fs btrfs. |
|---|
| 49 | SIZEREQUIRED=$3 |
|---|
| 50 | [ $SIZEREQUIRED -lt 300000 ] && SIZEREQUIRED=300000 |
|---|
| 51 | |
|---|
| 52 | echo CREATE_IMAGE "$1" $IMGEXT $SIZEREQUIRED |
|---|
| 53 | echo -ne CREATE_IMAGE "$1" $IMGEXT $SIZEREQUIRED| /opt/opengnsys/sbin/ogAdmRepoAux |
|---|
| 54 | echo "Los resultado se registran en $REPOLOG. " |
|---|
Note: See
TracBrowser
for help on using the repository browser.