diff options
author | ramon <ramongomez@us.es> | 2015-05-28 11:00:51 +0000 |
---|---|---|
committer | ramon <ramongomez@us.es> | 2015-05-28 11:00:51 +0000 |
commit | dfcc55abd5e8d8794a46835be68651b72128fb64 (patch) | |
tree | 1eb41050aa46ce66c774ebaf454eb35c286a4bdd | |
parent | 12603f81e2d7da233fb60fdc641283dbbae27ef9 (diff) |
Versión 1.1: Integrar últimos cambios.
git-svn-id: https://opengnsys.es/svn/branches/version1.1@4638 a21b9725-9963-47de-94b9-378ad31fedc9
-rwxr-xr-x | client/engine/Protocol.lib | 42 | ||||
-rwxr-xr-x | client/engine/Registry.lib | 16 | ||||
-rwxr-xr-x | client/engine/Rsync.lib | 16 | ||||
-rwxr-xr-x | repoman/bin/torrent-creator | 2 |
4 files changed, 40 insertions, 36 deletions
diff --git a/client/engine/Protocol.lib b/client/engine/Protocol.lib index 8c0b4c61..36ef1fba 100755 --- a/client/engine/Protocol.lib +++ b/client/engine/Protocol.lib @@ -993,7 +993,7 @@ ctorrent -t `basename $SOURCE` -u http://$IPTORRENT:6969/announce -s $SOURCE.tor #@version 0.1 - Integracion para OpenGNSys. #@author Antonio J. Doblas Viso. Universidad de Malaga #@date -#@version 1.5 - gestiona ficheros hash full.sum (TORRENT) y .sum (MULTICAST) +#@version 1.6 - gestiona ficheros hash full.sum (TORRENT) y .sum (MULTICAST) #@author Antonio J. Doblas Viso. Universidad de Malaga #@date #*/ ## @@ -1006,18 +1006,18 @@ ERROR=0 # Si se solicita, mostrar ayuda. if [ "$*" == "help" ]; then - ogHelp "$FUNCNAME $FUNCNAME [ str_repo] [ [Relative_path_image] " \ - "$FUNCNAME REPO /PS1_PH1.img" \ - "$FUNCNAME REPO /ogclient.sqfs" + ogHelp "$FUNCNAME" "$FUNCNAME str_repo relative_path_image [protocol|FULL]" \ + "$FUNCNAME REPO /PS1_PH1.img UNICAST" \ + "$FUNCNAME REPO /ogclient.sqfs FULL" return fi #Control de la cache -ogFindCache || return $(ogRaiseError $OG_ERR_NOTCACHE; echo $?) +ogFindCache &>/dev/null || return $(ogRaiseError $OG_ERR_NOTCACHE; echo $?) #Control de parametros: ahora admite tres. -[ $# > "3" ] || return $(ogRaiseError $OG_ERR_NOTFOUND " $1 $2"; echo $?) +[ $# -ge 2 ] || return $(ogRaiseError $OG_ERR_FORMAT "$MSG_FORMAT: $PROG str_repo relative_path_image [protocol|FULL]"; echo $?) ogCheckStringInGroup "$1" "REPO repo" || return $(ogRaiseError $OG_ERR_NOTFOUND " $1 $2"; echo $?) FILESOURCE=`ogGetPath $1 $2` || return $(ogRaiseError $OG_ERR_NOTFOUND " $1 $2"; echo $?) @@ -1044,8 +1044,8 @@ fi ## En este punto la imagen en el repo y en la cache se llaman igual, #echo "paso 4. Obtener los md5 del fichero imagen en la cacha segun PROTOCOLO $3" -case "$3" in - full|FULL|torrent|TORRENT) +case "${3^^}" in + FULL|TORRENT) #Buscamos MD5 en el REPO SOURCE if [ -f $FILESOURCE.full.sum ] then @@ -1070,18 +1070,20 @@ case "$3" in # Generamos el MD5 (little) en la CACHE [ ! -f $FILETARGET.sum ] && ogCalculateChecksum $FILETARGET > $FILETARGET.sum MD5TARGET=$(cat $FILETARGET.sum) - #Generamos o copiamos MD5 (full) en la CAHCHE para posteriores usos con Torrent - if [ ! -f $FILETARGET.full.sum -a $FILETARGE.sum ] - then - if [ ! -f $FILESOURCE.full.sum ] - then - #.full.sum en REPO realizamos COPIA - cp $FILESOURCE.full.sum $FILETARGET.full.sum - else - # .full.sum no en REPO LO GENERAMOS - ogCalculateFullChecksum $FILETARGET > $FILETARGET.full.sum - fi - fi + #Generamos o copiamos MD5 (full) en la CACHE para posteriores usos con Torrent + # Si no existe el full.sum y si existe el .sum es porque el upateCACHE multicast o unicast ha sido correcto. + if [ ! -f $FILETARGET.full.sum -a $FILETARGET.sum ] + then + if [ -f $FILESOURCE.full.sum ] + then + #Existe el .full.sum en REPO realizamos COPIA + cp $FILESOURCE.full.sum $FILETARGET.full.sum + else + #No existe .full.sum no en REPO LO GENERAMOS en la cache: situacion dificil que ocurra + ogCalculateFullChecksum $FILETARGET > $FILETARGET.full.sum + fi + fi + esac #echo "Paso 5. comparar los md5" diff --git a/client/engine/Registry.lib b/client/engine/Registry.lib index 1a6045f2..a46404d0 100755 --- a/client/engine/Registry.lib +++ b/client/engine/Registry.lib @@ -94,12 +94,12 @@ fi [ $# == 3 -o $# == 4 ] || ogRaiseError $OG_ERR_FORMAT || return $? # Camino del fichero de registro. FILE=$(ogGetHivePath "$1" "$2") || return $? -case "$4" in - string|STRING|"") TYPE=1 ;; - binary|BINARY) TYPE=3 ;; - dword|DWORD) TYPE=4 ;; - *) ogRaiseError $OG_ERR_OUTOFLIMIT "$4" - return $? ;; +case "${4^^}" in + STRING|"") TYPE=1 ;; + BINARY) TYPE=3 ;; + DWORD) TYPE=4 ;; + *) ogRaiseError $OG_ERR_OUTOFLIMIT "$4" + return $? ;; esac # Devolver el dato del valor de registro. @@ -222,7 +222,7 @@ local FILE FILENT FILEXP # Si se solicita, mostrar ayuda. if [ "$*" == "help" ]; then - ogHelp "$FUNCNAME" "$FUNCNAME path_mountpoint str_hive" + ogHelp "$FUNCNAME" "$FUNCNAME path_mountpoint str_hive" \ "$FUNCNAME /mnt/sda1 SOFTWARE => /mnt/sda1/WINDOWS/System32/config/SOFTWARE" return fi @@ -388,7 +388,7 @@ local FILE # Si se solicita, mostrar ayuda. if [ "$*" == "help" ]; then - ogHelp "$FUNCNAME" "$FUNCNAME path_mountpoint str_hive str_valuename str_data" + ogHelp "$FUNCNAME" "$FUNCNAME path_mountpoint str_hive str_valuename str_data" \ "$FUNCNAME /mnt/sda1 SOFTWARE '\Microsoft\NewKey\Value1' 1" return fi diff --git a/client/engine/Rsync.lib b/client/engine/Rsync.lib index 70f5bbcc..a2889dac 100755 --- a/client/engine/Rsync.lib +++ b/client/engine/Rsync.lib @@ -95,8 +95,9 @@ if [ "$1" == "CACHE" -o "$1" == "cache" ]; then fi fi else - echo " dd if=/dev/zero of=$IMGFILE bs=1024 count=$SIZEREQUIRED" - dd if=/dev/zero of="$IMGFILE" bs=1024 count=$SIZEREQUIRED 2>&1 | tee -a $OGLOGCOMMAND + touch "$IMGFILE" + echo " truncate --size=>$SIZEREQUIRED k $IMGFILE" + truncate --size=">$SIZEREQUIRED"k "$IMGFILE" &> $OGLOGCOMMAND #Formateamos imagen losetup $LOOPDEVICE $IMGFILE # FS de la imagen segun la configuracion y la version del kernel: < 3.7 ext4, si >= btrfs @@ -135,8 +136,9 @@ function ogCreateInfoImage () { #@param 3 Repositorio [ REPO | CACHE ] (opcional en las completas) #@param 4 Nombre Imagen Basica (opcional en las completas) #@param 5 Tipo imagen [ img | diff ] +#@version 1.0.6 rsync opcion W (whole) para que sea más rápido #*/ -local IMGTYPE IMGDIRAUX DIRMOUNT DESTRSYNC PASSWORD OPTRSYNC USERRSYNC ORIG FSTYPE PART DIREMPTY IMGLIST IMGINFO IMGACL KERNELVERSION +local IMGTYPE IMGDIRAUX DIRMOUNT DESTRSYNC PASSWORD USERRSYNC ORIG FSTYPE PART DIREMPTY IMGLIST IMGINFO IMGACL KERNELVERSION # Ayuda o menos de 5 parametros y la imagen no es basica if [ "$*" == "help" -o $# -lt 5 -a "$3" != "img" ]; then ogHelp "$FUNCNAME" : "$MSG_HELP_ogCreateInfoImage" \ @@ -200,15 +202,15 @@ echo "#$IMGFS:NO:$FSTYPE:$SIZEDATA" > $IMGINFO if [ "$IMGTYPE" == "img" ]; then # Imagen Basica - echo " rsync -aHAXvn --delete $ORIG/ $DIREMPTY >> $IMGINFO" - rsync -aHAXvn --delete $ORIG/ $DIREMPTY>> $IMGINFO + echo " rsync -aHAXWvn --delete $ORIG/ $DIREMPTY >> $IMGINFO" + rsync -aHAXWvn --delete $ORIG/ $DIREMPTY>> $IMGINFO sed -i -e s/"^sent.*.bytes\/sec"//g -e s/^total.*.speedup.*.$//g -e s/"sending.*.list"//g $IMGINFO sed -i '/^\.\//d' $IMGINFO else # Imagen Diferencial - echo " rsync -aHAXvn$OPTRSYNC --delete $ORIG/ $DESTRSYNC a $IMGLIST" - rsync -aHAXvn$OPTRSYNC $PASSWORD --delete "$ORIG/" "$DESTRSYNC" >> $IMGLIST + echo " rsync -aHAXWvn --delete $ORIG/ $DESTRSYNC a $IMGLIST" + rsync -aHAXWvn $PASSWORD --delete "$ORIG/" "$DESTRSYNC" >> $IMGLIST sed -i -e s/"^sent.*.bytes\/sec"//g -e s/^total.*.speedup.*.$//g -e s/"sending.*.list"//g $IMGLIST sed -i '/^\.\//d' $IMGLIST diff --git a/repoman/bin/torrent-creator b/repoman/bin/torrent-creator index 5f951813..1ede98c5 100755 --- a/repoman/bin/torrent-creator +++ b/repoman/bin/torrent-creator @@ -36,7 +36,7 @@ for IMG in *.{img,pgz,diff}; do SUMFILE="$IMG.sum" #MD5 completo de todo el fichero imagen SUMFULLFILE="$IMG.full.sum" - if [ -f "$TORRENT" ]; then + if [ -f "$TORRENT" -a -f "$SUMFULLFILE" ]; then FILESIZE="$(ls -l $IMG | awk '{print $5}')" read -e TORRFILE TORRSIZE <<<"$(ctorrent -x $TORRENT 2>/dev/null | awk '$1~/<1>/ {print $2,$3}')" [ "$(basename $IMG)" = "$TORRFILE" -a "[$FILESIZE]" = "$TORRSIZE" ] && continue |