[914d834] | 1 | #!/bin/bash |
---|
| 2 | |
---|
[eb9424f] | 3 | #/** |
---|
| 4 | # cloneremoteFromMaster |
---|
| 5 | #@brief Restaura una particion o imagen sobre las particiones de equipos cliente remotos |
---|
| 6 | #@param 1 str_origen admite dirección IP del equipo Master. |
---|
| 7 | #@param 2 str_origen admite int_disk str_REPO|str_CACHE |
---|
| 8 | #@param 3 str_origen admite int partorigen stre_imagen |
---|
| 9 | #@param 4 str_sesion multicast|unicast |
---|
[914d834] | 10 | #@param $5 int_disco_destino |
---|
| 11 | #@param $6 init_particion_destino |
---|
[eb9424f] | 12 | #@param $7 str_tool_clone |
---|
| 13 | #@param $8 str_tool_compresor |
---|
[914d834] | 14 | #@param ejemplo: cloneRemoteFromMaster 172.17.36.11 1 1 9000:full-duplex:239.194.17.36:70M:50:100 1 1 partclone lzop |
---|
| 15 | #@param ejemplo: cloneRemoteFromMaster 172.17.36.11 REPO /imagen1 9000:full-duplex:239.194.17.36:70M:50:100 1 1 partclone lzop |
---|
| 16 | #@param ejemplo: cloneRemoteFromMaster 172.17.36.11 CACHE /imagen1 9000:full-duplex:239.194.17.36:70M:50:100 1 1 partclone lzop |
---|
[eb9424f] | 17 | #@return |
---|
| 18 | #@exception OG_ERR_FORMAT formato incorrecto. |
---|
| 19 | #@exception $OG_ERR_IMGSIZEPARTITION=30 #Imagen demasiado pequeña para ser clonada |
---|
| 20 | #@exception OG_ERR_REDUCEFS=17 #error al reducir sistema de archivos. |
---|
| 21 | #@exception OG_ERR_EXTENDFS=18 #errror al expandir el sistema de archivos. |
---|
| 22 | #@exception OG_ERR_UCASTSYNTAXT=50 # Error en la generación de sintaxis de transferenica unicast |
---|
| 23 | #@exception OG_ERR_UCASTSENDPARTITION=51 # Error en envio UNICAST de una particion |
---|
| 24 | #@exception OG_ERR_UCASTSENDFILE=52 # Error en envio UNICAST de un fichero |
---|
| 25 | #@exception OG_ERR_UCASTRECEIVERPARTITION=53 #Error en la recepcion UNICAST de una particion |
---|
| 26 | #@exception OG_ERR_UCASTRECEIVERFILE=54 #Error en la recepcion UNICAST de un fichero |
---|
| 27 | #@exception OG_ERR_MCASTSYNTAXT=55 # Error en la generacion de sintaxis de transferenica Multicast. |
---|
| 28 | #@exception OG_ERR_MCASTSENDFILE=56 # Error en envio MULTICAST de un fichero |
---|
| 29 | #@exception OG_ERR_MCASTRECEIVERFILE=57 #Error en la recepcion MULTICAST de un fichero |
---|
| 30 | #@exception OG_ERR_MCASTSENDPARTITION=58 # Error en envio MULTICAST de una particion |
---|
| 31 | #@exception OG_ERR_MCASTRECEIVERPARTITION=59 # Error en la recepcion MULTICAST de una particion |
---|
| 32 | #@exception OG_ERR_PROTOCOLJOINMASTER=60 # Error en la conexion de una sesion UNICAST|MULTICAST con el MASTER |
---|
| 33 | #@note |
---|
| 34 | #@todo: |
---|
| 35 | #@version 0.9.1 - integración con OpenGnsys |
---|
| 36 | #@author Antonio J. Doblas Viso. Universidad de Malaga. |
---|
| 37 | #@date 2009/03/17 |
---|
| 38 | #@version 0.9.2 - adaptacion a OpenGnsys |
---|
| 39 | #@author Antonio J. Doblas Viso. Universidad de Malaga. |
---|
| 40 | #@date 2010/07/27 |
---|
| 41 | #@version 0.1.0 - gestion unicast |
---|
| 42 | #@author Antonio J. Doblas Viso. Universidad de Malaga. |
---|
| 43 | #@date 2011/01/26 |
---|
| 44 | #@version 1.0 - control de errores para el ogAdmServer |
---|
| 45 | #@author Antonio J. Doblas Viso. Universidad de Malaga. |
---|
| 46 | #@date 2011/04/24 |
---|
[14ca521d] | 47 | #@version 1.0 - Uso de parted para controlar tamaño particion destino. Requiere Formateo FS previo -parted usa FS para el tamanyo". |
---|
| 48 | #@author Antonio J. Doblas Viso. Universidad de Malaga. |
---|
| 49 | #@date 2011/04/24 |
---|
[5d52d47] | 50 | #@version 1.0.1 - Se elimina la operación de reducir la particion. |
---|
| 51 | #@author Antonio J. Doblas Viso. Universidad de Malaga. |
---|
| 52 | #@date 2011/05/16 |
---|
[44eeffb] | 53 | #@version 1.0.3 - se integra con httpd-log. |
---|
| 54 | #@version 1.0.3 - Habilita el uso de la variable OGWINREDUCE=TRUE|TRUE para reducir el sistema de archivos a enviar |
---|
| 55 | #@author Antonio J. Doblas Viso. Universidad de Malaga. |
---|
| 56 | #@date 2011/12/22 |
---|
[1a2fa9d8] | 57 | #@version 1.0.6 - Uso de la funcion ogExecuteAndLog |
---|
| 58 | #@author Antonio J. Doblas Viso. Universidad de Malaga. |
---|
| 59 | #@date 2012/02/12 |
---|
[eb9424f] | 60 | #*/ ## |
---|
[914d834] | 61 | |
---|
[445ed28] | 62 | #test 1. cliente sin particiones. Detectado TODO: crear estrucutras de particiones |
---|
| 63 | #test 2. cliente con particion mas pequeña. Detectado. |
---|
| 64 | #test 3. cleinte con particion destinio no formateado. Detectado. |
---|
| 65 | #test 4. cliente con particion destino ocupado por el usuario pwd . FALLO. |
---|
| 66 | #test 5. master sin origen particion. |
---|
| 67 | #test 6. master sin origen fichero. |
---|
| 68 | |
---|
[1a2fa9d8] | 69 | TIME1=$SECONDS |
---|
| 70 | PROG="$(basename $0)" |
---|
[445ed28] | 71 | |
---|
| 72 | trap "pkill faucet; exit 1" 0 1 2 3 6 9 14 15 |
---|
[914d834] | 73 | |
---|
[1a2fa9d8] | 74 | #AYUDA |
---|
[445ed28] | 75 | if [ $# -lt 1 -o "$1" == "help" ]; then |
---|
[1a2fa9d8] | 76 | echo "cloneRemoteFromMaster ipmaster disk init [MULTICAST|UNICAST] session disk part tool comp" |
---|
| 77 | exit 1 |
---|
[914d834] | 78 | fi |
---|
| 79 | |
---|
[1a2fa9d8] | 80 | #ERROR |
---|
| 81 | if [ $# -lt 6 ]; then |
---|
| 82 | ogRaiseError session $OG_ERR_FORMAT "$MSG_FORMAT: $PROG ipMaster SOURCE_disco SOURCE_particion [MULTICAST|UNICAST] SESSION TARGET_disk TARGET_partition" |
---|
[914d834] | 83 | exit $? |
---|
| 84 | fi |
---|
| 85 | |
---|
[1a2fa9d8] | 86 | #Load engine configurator from engine.cfg file. |
---|
| 87 | #Carga el configurador del engine desde el fichero engine.cfg |
---|
| 88 | # Valores por defecto: #IMGPROG="partclone" ; #IMGCOMP="lzop" ; #IMGEXT="img" #IMGREDUCE="TRUE" |
---|
| 89 | [ -z $OGENGINECONFIGURATE ] && source /opt/opengnsys/etc/engine.cfg |
---|
| 90 | |
---|
| 91 | # Clear temporary file used as log track by httpdlog |
---|
| 92 | # Limpia los ficheros temporales usados como log de seguimiento para httpdlog |
---|
| 93 | echo " " > $OGLOGCOMMAND |
---|
| 94 | |
---|
| 95 | ogEcho log session "[1] $MSG_SCRIPTS_START $0 $*" |
---|
| 96 | |
---|
| 97 | # Procesar parámetros de entrada |
---|
[eb9424f] | 98 | HOSTIP=`ogGetIpAddress` |
---|
[914d834] | 99 | if [ -z "$HOSTIP" ] |
---|
| 100 | then |
---|
[eb9424f] | 101 | source /tmp/net-eth* |
---|
[914d834] | 102 | HOSTIP=`ogGetIpAddress` |
---|
| 103 | fi |
---|
[fe10bff] | 104 | MASTERIP="$1" |
---|
| 105 | PROTOCOL="$4" |
---|
| 106 | case "${PROTOCOL^^}" in |
---|
| 107 | MULTICAST) |
---|
[62ccd9b] | 108 | SESSIONMCASTSERVER=$5 |
---|
| 109 | SESSIONMCASTCLIENT=`echo $5 | awk -F: '{print $1}'` |
---|
| 110 | ;; |
---|
[fe10bff] | 111 | UNICAST) |
---|
[62ccd9b] | 112 | SESSIONUCASTSERVER=$5 |
---|
[fe10bff] | 113 | SESSIONUCASTCLIENT=`echo $5 | awk -F: '{print $1}'`:$MASTERIP |
---|
| 114 | ;; |
---|
| 115 | *) |
---|
| 116 | exit $(ogRaiseError $OG_ERR_FORMAT "Protocolo $PROTOCOL no soportado en esta operacion"; echo $?) |
---|
| 117 | ;; |
---|
[62ccd9b] | 118 | esac |
---|
[914d834] | 119 | # contenedor destino (disco particion) |
---|
[fe10bff] | 120 | DISKTARGET="$6" |
---|
| 121 | PARTTARGET="$7" |
---|
[914d834] | 122 | #herramienta de compresión. |
---|
[fe10bff] | 123 | TOOLCLONE="$8" |
---|
| 124 | COMPRESOR="$9" |
---|
[914d834] | 125 | |
---|
[eb9424f] | 126 | pkill faucet |
---|
[914d834] | 127 | |
---|
[eb9424f] | 128 | # Preparando Instrucción según sea Master o Client |
---|
[914d834] | 129 | case $MASTERIP in |
---|
| 130 | $HOSTIP) |
---|
[1a2fa9d8] | 131 | ogEcho log session "[1] Equipo Master preparando el origen de los datos a enviar" |
---|
[eb9424f] | 132 | ogGetPath $2 $3.img &>/dev/null; RC=$?; |
---|
| 133 | ogDiskToDev $2 $3 &>/dev/null; RETVAL=$?; |
---|
| 134 | |
---|
| 135 | if [ "$RC" == "0" ]; then |
---|
| 136 | IMG=$(ogGetPath $2 $3.img); MODEMASTER=SENDFILE |
---|
| 137 | elif [ "$RETVAL" == "0" ]; then |
---|
| 138 | DISKSOURCE=$2; PARTSOURCE=$3; MODEMASTER=SENDPARTITION |
---|
[914d834] | 139 | else |
---|
[eb9424f] | 140 | ogRaiseError $OG_ERR_NOTFOUND "$2 $3"; exit $? |
---|
| 141 | fi |
---|
| 142 | echo $MODEMASTER |
---|
[445ed28] | 143 | # Preparando instrucción del Master segun $MODEMASTER{SENDPARTITION SENDFILE} |
---|
[914d834] | 144 | case "$MODEMASTER" in |
---|
| 145 | SENDPARTITION) |
---|
[fe10bff] | 146 | ogEcho log session "[5] Master en modo $MODEMASTER: informacion inicial a los clientes-slaves" |
---|
[445ed28] | 147 | if ps aux | grep -v grep | grep "faucet 4000" |
---|
| 148 | then |
---|
| 149 | ogRaiseError $OG_ERR_NOTFOUND "MASTER: puerto en uso: 118"; exit $? |
---|
| 150 | else |
---|
| 151 | faucet 4000 --out echo "WORKING" & |
---|
| 152 | fi |
---|
[fe10bff] | 153 | ogEcho log session "[10]: Desmontando DISK:$DISKSOURCE PARTITION:$PARTSOURCE" |
---|
[445ed28] | 154 | ogUnmount $2 $3 || exit $(ogRaiseError $OG_ERR_LOCKED "no se puede desmontar $2 $3 l124"; echo $?) |
---|
[914d834] | 155 | #Obtener tamaño de la partición. |
---|
[445ed28] | 156 | SIZE=$(ogGetPartitionSize $2 $3) || exit $(ogRaiseError $OG_ERR_REDUCEFS "Error al detectar tamaño partcion $2 $3 l127"; echo $?) |
---|
[44eeffb] | 157 | |
---|
[fe10bff] | 158 | if [ "$OGWINREDUCE" == "TRUE" ] |
---|
[44eeffb] | 159 | then |
---|
[fe10bff] | 160 | ogEcho log session "[15]: Calculando la reduccion del sistema de archivos DISK:$DISKSOURCE PARTITION:$PARTSOURCE SIZE:$SIZE" |
---|
| 161 | ogReduceFs $2 $3 || exit $(ogRaiseError $OG_ERR_REDUCEFS "Error al reducir el FS $2 $3 l129"; echo $?) |
---|
[44eeffb] | 162 | fi |
---|
| 163 | |
---|
[445ed28] | 164 | REDSIZE=$(ogGetFsSize $2 $3) || exit $(ogRaiseError $OG_ERR_REDUCEFS "Error al detectar el nuevo FS $2 $3 l130"; echo $?) |
---|
[44eeffb] | 165 | TIMEAUX=$[SECONDS-TIME1] |
---|
[fe10bff] | 166 | ogEcho log session "[20]: Preparada para enviar el sistema de archivos: Tamaño datos: $REDSIZE origne: $DISKSOURCE $PARTSOURCE" |
---|
| 167 | ogEcho log session " tiempo de reducción del sistema de archivos: $[TIMEAUX/60]m $[TIMEAUX%60]s" |
---|
[44eeffb] | 168 | |
---|
[5d52d47] | 169 | #if [ $REDSIZE -lt $SIZE ]; then |
---|
| 170 | # echo "[24] Redimensionar partición a $REDSIZE KB." |
---|
| 171 | # ogSetPartitionSize $2 $3 $REDSIZE |
---|
| 172 | #fi |
---|
[44eeffb] | 173 | |
---|
[fe10bff] | 174 | ogEcho log session "[25] Master en Modo $MODEMASTER: informacion de transferencia a los clientes-slaves $PROTOCOL $TOOLCLONE $COMPRESOR $REDSIZE" |
---|
[eb9424f] | 175 | pkill faucet |
---|
[445ed28] | 176 | if ps aux | grep -v grep | grep "faucet 4000" |
---|
| 177 | then |
---|
| 178 | ogRaiseError $OG_ERR_NOTFOUND "MASTER: puerto en uso: 140"; exit $? |
---|
| 179 | else |
---|
| 180 | faucet 4000 --out echo "READY $TOOLCLONE $COMPRESOR $REDSIZE" & |
---|
| 181 | fi |
---|
[fe10bff] | 182 | case "${PROTOCOL^^}" in |
---|
| 183 | MULTICAST) |
---|
[1a2fa9d8] | 184 | ogEcho log session "[29] Transferencia Multicast: ogMcastSendPartition $DISKSOURCE $PARTSOURCE $SESSIONMCASTSERVER $TOOLCLONE $COMPRESOR " |
---|
| 185 | ogExecAndLog session "ogMcastSendPartition" "$DISKSOURCE" "$PARTSOURCE" "$SESSIONMCASTSERVER" "$TOOLCLONE" "$COMPRESOR" || RETVAL=$? |
---|
[62ccd9b] | 186 | ;; |
---|
[fe10bff] | 187 | UNICAST) |
---|
[62ccd9b] | 188 | sleep 60 |
---|
[1a2fa9d8] | 189 | ogEcho log session "[29] Transferencia Unicast: ogUcastSendPartition $DISKSOURCE $PARTSOURCE $SESSIONUCASTSERVER $TOOLCLONE $COMPRESOR" |
---|
| 190 | ogExecAndLog session "ogUcastSendPartition" "$DISKSOURCE" "$PARTSOURCE" "$SESSIONUCASTSERVER" "$TOOLCLONE" "$COMPRESOR" || RETVAL=$? |
---|
[62ccd9b] | 191 | ;; |
---|
[fe10bff] | 192 | esac |
---|
[62ccd9b] | 193 | |
---|
[5d52d47] | 194 | #if [ $REDSIZE -lt $SIZE ]; then |
---|
| 195 | # echo "[85] Redimensionar partición a $SIZE KB." |
---|
| 196 | # ogSetPartitionSize $2 $3 $SIZE |
---|
[fe10bff] | 197 | ogEcho log session "[90] Extender sistema de archivos." |
---|
[914d834] | 198 | ogExtendFs $2 $3 |
---|
[5d52d47] | 199 | #fi |
---|
[914d834] | 200 | pkill faucet |
---|
[445ed28] | 201 | if [ $RETVAL == 0 ] |
---|
| 202 | then |
---|
| 203 | exit 0 |
---|
| 204 | else |
---|
| 205 | exit $(ogRaiseError $OG_ERR_MCASTSENDPARTITION "Error al enviar la particion $2 $3 con protocolo $PROTOCOL l167"; echo $?) |
---|
| 206 | fi |
---|
[fe10bff] | 207 | |
---|
[914d834] | 208 | ;; |
---|
[eb9424f] | 209 | SENDFILE) |
---|
[fe10bff] | 210 | ogEcho log session "[5] Master en modo $MODEMASTER: informacion inicial a los clientes-slaves" |
---|
| 211 | ogEcho log session "[10]: Preparando Imagen: $IMG" |
---|
[445ed28] | 212 | TOOLCLONE=$(ogGetImageProgram $2 $3) || exit $(ogRaiseError $OG_ERR_LOCKED "TOOLCLONE no detectado l174"; echo $?) |
---|
[5d52d47] | 213 | COMPRESOR=$(ogGetImageCompressor $2 $3) || exit $(ogRaiseError $OG_ERR_LOCKED "COMPRESOR NO DETECTADO l175"; echo $?) |
---|
| 214 | REDSIZE=$(ogGetImageSize $2 $3) || exit $(ogRaiseError $OG_ERR_LOCKED "REDSIZE NO DETECTADO l176"; echo $?) |
---|
[fe10bff] | 215 | ogEcho log session "[25] Master en Modo $MODEMASTER" |
---|
| 216 | ogEcho log "Informacion de transferencia a los clientes-slaves $PROTOCOL $TOOLCLONE $COMPRESOR $REDSIZE" |
---|
[445ed28] | 217 | if ps aux | grep -v grep | grep "faucet 4000" |
---|
| 218 | then |
---|
| 219 | ogRaiseError $OG_ERR_NOTFOUND "MASTER: puerto en uso: 140"; exit $? |
---|
| 220 | else |
---|
| 221 | faucet 4000 --out echo "READY $TOOLCLONE $COMPRESOR $REDSIZE" & |
---|
[fe10bff] | 222 | fi |
---|
| 223 | case "${PROTOCOL^^}" in |
---|
| 224 | MULTICAST) |
---|
[eb9424f] | 225 | echo "[29] ogMcastSendFile $2 $3.img $SESSIONMCASTSERVER " |
---|
| 226 | ogMcastSendFile $2 $3.img $SESSIONMCASTSERVER || RETVAL=$? |
---|
| 227 | ;; |
---|
[fe10bff] | 228 | UNICAST) |
---|
[eb9424f] | 229 | sleep 60 |
---|
| 230 | echo "[29] ogUcastSendFile $2 $3.img $SESSIONUCASTSERVER" |
---|
| 231 | ogUcastSendFile $2 $3.img $SESSIONUCASTSERVER || RETVAL=$? |
---|
| 232 | ;; |
---|
| 233 | esac |
---|
[914d834] | 234 | pkill faucet |
---|
[445ed28] | 235 | if [ $RETVAL == 0 ] |
---|
| 236 | then |
---|
| 237 | exit 0 |
---|
| 238 | else |
---|
[fe10bff] | 239 | exit $(ogRaiseError $OG_ERR_MCASTSENDFILE "Error al enviar la image $2 $3.img con protocolo $PROTOCOL l200"; echo $?) |
---|
[445ed28] | 240 | fi |
---|
[eb9424f] | 241 | ;; |
---|
[914d834] | 242 | esac |
---|
[eb9424f] | 243 | # FIN Preparando instrucción del Master segun $MODEMASTER{SENDPARTITION SENDFILE} |
---|
[914d834] | 244 | ;; |
---|
[44eeffb] | 245 | *) |
---|
[fe10bff] | 246 | ogEcho log session "[1] Equipo -Client- preparando para recibir datos $PROTOCOL" |
---|
[445ed28] | 247 | ogDiskToDev $DISKTARGET $PARTTARGET &>/dev/null || exit $(ogRaiseError $OG_ERR_LOCKED "El cliente no tiene esas particiones $DISKTARGET $PARTTARGET l211"; echo $?) |
---|
[7e4db2f] | 248 | # TODO: si el cliente no está en la lista de clientes UNICAST salir. |
---|
[fe10bff] | 249 | case "${PROTOCOL^^}" in |
---|
| 250 | UNICAST) |
---|
[445ed28] | 251 | echo "$SESSIONUCASTSERVER" | grep $HOSTIP || exit $(ogRaiseError $OG_ERR_PROTOCOLJOINMASTER "Este cliente no pertence a la sesion UNICAST l214"; echo $?) |
---|
| 252 | ;; |
---|
[7e4db2f] | 253 | esac |
---|
[fe10bff] | 254 | ogEcho log session "[2] Desmontando particion destino" |
---|
[445ed28] | 255 | ogUnmount $DISKTARGET $PARTTARGET || exit $(ogRaiseError $OG_ERR_LOCKED "no se puede desmontar la particion destino $2 $3 l218"; echo $?) |
---|
[fe10bff] | 256 | ogEcho log session "[25] Buscando informacion extra sobre la clonacion con el master $MASTERIP: " |
---|
[eb9424f] | 257 | sleep 10 |
---|
| 258 | TIMEWAITMASTER=120 |
---|
| 259 | TIMEWAITING=0 |
---|
| 260 | GETINFO="NONE" |
---|
| 261 | while [ "${GETINFO}" != "OK" ] |
---|
[914d834] | 262 | do |
---|
| 263 | INFOEXTRA=`hose $MASTERIP 4000 --in cat 2>/dev/null` |
---|
[eb9424f] | 264 | sleep 10; echo -n "." |
---|
[44eeffb] | 265 | #echo comienza el timeout $TIMEWAITMASTER para abortar |
---|
[eb9424f] | 266 | [ -z "$INFOEXTRA" ] && let TIMEWAITMASTER=$TIMEWAITMASTER-10 |
---|
[445ed28] | 267 | [ "$TIMEWAITMASTER" -gt "0" ] || exit $(ogRaiseError $OG_ERR_PROTOCOLJOINMASTER " l230 "; echo $?) |
---|
[eb9424f] | 268 | #Si primer parametro desde el server es READY, salimos del bucle |
---|
| 269 | GETINFO=$(echo $INFOEXTRA | awk '{print $1}') |
---|
[fe10bff] | 270 | [ "$GETINFO" == "READY" ] && GETINFO="OK" |
---|
[914d834] | 271 | done |
---|
[eb9424f] | 272 | echo $INFOEXTRA |
---|
| 273 | TOOLCLONE=$(echo $INFOEXTRA | awk '{print $2}') |
---|
| 274 | COMPRESOR=$(echo $INFOEXTRA | awk '{print $3}') |
---|
| 275 | SIZEIMAGE=$(echo $INFOEXTRA | awk '{print $4}') |
---|
[fe10bff] | 276 | ogEcho log "$INFOEXTRA = herramienta= $TOOLCLONE compresor= $COMPRESOR size= $SIZEIMAGE" |
---|
[445ed28] | 277 | ogMount $DISKTARGET $PARTTARGET || ogFormat $DISKTARGET $PARTTARGET |
---|
[1a2fa9d8] | 278 | #SIZEPARTTARGET=$(parted `ogDiskToDev $DISKTARGET $PARTTARGET` unit kB print | grep Disk | awk -F" " '{print $3}' | tr -d kB); |
---|
| 279 | SIZEPARTTARGET=$(ogGetPartitionSize $DISKTARGET $PARTTARGET ) |
---|
[fe10bff] | 280 | ogEcho log session "[28] comprobando que el tamaño de la imagen $SIZEIMAGE es menor que el de la particion destino $SIZEPARTTARGET" |
---|
[14ca521d] | 281 | # comprobamos que el tamaño de a imagen es menor que la del cliente. |
---|
[914d834] | 282 | if [ "$SIZEIMAGE" -lt "$SIZEPARTTARGET" ] |
---|
[44eeffb] | 283 | then |
---|
[fe10bff] | 284 | ogEcho log session "[30] Iniciando Cliente $PROTOCOL " |
---|
| 285 | case "${PROTOCOL^^}" in |
---|
| 286 | MULTICAST) |
---|
| 287 | ogEcho log session "ogMcastReceiverPartition $DISKTARGET $PARTTARGET $SESSIONMCASTCLIENT $TOOLCLONE $COMPRESOR" |
---|
[1a2fa9d8] | 288 | ogExecAndLog command "ogMcastReceiverPartition" "$DISKTARGET" "$PARTTARGET" "$SESSIONMCASTCLIENT" "$TOOLCLONE" "$COMPRESOR" || exit $(ogRaiseError $OG_ERR_MCASTRECEIVERPARTITION " l251 "; echo $?) |
---|
[445ed28] | 289 | ;; |
---|
[fe10bff] | 290 | UNICAST) |
---|
| 291 | ogEcho log session "ogUcastReceiverPartition $DISKTARGET $PARTTARGET $SESSIONUCASTCLIENT $TOOLCLONE $COMPRESOR" |
---|
[1a2fa9d8] | 292 | ogExecAndLog command "ogUcastReceiverPartition" "$DISKTARGET" "$PARTTARGET" "$SESSIONUCASTCLIENT" "$TOOLCLONE" "$COMPRESOR" || exit $(ogRaiseError $OG_ERR_UCASTRECEIVERPARTITION " l230 "; echo $?) |
---|
[62ccd9b] | 293 | ;; |
---|
[445ed28] | 294 | esac |
---|
[4976431] | 295 | if which configureOsCustom &>/dev/null; then |
---|
| 296 | ogEcho log session "[90] configureOsCustom $DISKTARGET $PARTTARGET" |
---|
[501e543] | 297 | # Si $2 = num_disk las varibles REPO IMGNAME estan vacias |
---|
| 298 | ! [[ $2 =~ ^[0-9]+$ ]] && REPO="$2" && IMGNAME="$3" |
---|
| 299 | configureOsCustom $DISKTARGET $PARTTARGET $REPO $IMGNAME |
---|
[4976431] | 300 | else |
---|
| 301 | ogEcho log session "[90] $MSG_SCRIPTS_OS_CONFIGURE $DISKTARGET $PARTTARGET" |
---|
| 302 | configureOs $DISKTARGET $PARTTARGET |
---|
| 303 | fi |
---|
| 304 | |
---|
[914d834] | 305 | else |
---|
[eb9424f] | 306 | # Si el tamaño de los datos recibidos es más grande que la particion destino |
---|
[14ca521d] | 307 | ogRaiseError $OG_ERR_IMGSIZEPARTITION "ERROR tamanio particion= $SIZEPARTTARGET menor que la imagen= $SIZEIMAGE"; exit $? |
---|
[914d834] | 308 | fi |
---|
| 309 | ;; |
---|
| 310 | esac |
---|
| 311 | TIME=$[SECONDS-TIME1] |
---|
[fe10bff] | 312 | ogEcho log session "[100] Duración de la operación $[TIME/60]m $[TIME%60]s" |
---|
[914d834] | 313 | |
---|