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