diff options
-rwxr-xr-x | client/engine/Image.lib | 14 | ||||
-rwxr-xr-x | client/engine/PostConf.lib | 6 | ||||
-rwxr-xr-x | client/engine/PostConfEAC.lib | 9 | ||||
-rwxr-xr-x | client/engine/Protocol.lib | 6 | ||||
-rwxr-xr-x | client/shared/scripts/createDiffImage | 3 | ||||
-rwxr-xr-x | client/shared/scripts/deployImage | 3 | ||||
-rwxr-xr-x | client/shared/scripts/restoreBaseImage | 3 | ||||
-rwxr-xr-x | client/shared/scripts/restoreDiffImage | 3 | ||||
-rwxr-xr-x | client/shared/scripts/updateCache | 6 |
9 files changed, 31 insertions, 22 deletions
diff --git a/client/engine/Image.lib b/client/engine/Image.lib index 13d234ec..092befed 100755 --- a/client/engine/Image.lib +++ b/client/engine/Image.lib @@ -824,7 +824,7 @@ fi [ $# == 3 ] || ogRaiseError $OG_ERR_FORMAT || return $? # Procesar parámetros. DISK=$(ogDiskToDev "$3") || return $? -IMGFILE=$(ogGetPath "$1" "$2.mbr") || return $? +IMGFILE=$(ogGetPath "$1" "$2.mbr") [ -r "$IMGFILE" ] || ogRaiseError $OG_ERR_NOTFOUND "$IMGFILE" || return $? # Restaurar imagen del MBR. @@ -860,7 +860,7 @@ fi [ $# == 3 ] || ogRaiseError $OG_ERR_FORMAT || return $? # Procesar parámetros. DISK=$(ogDiskToDev "$3") || return $? -IMGFILE=$(ogGetPath "$1" "$2.mbr") || return $? +IMGFILE=$(ogGetPath "$1" "$2.mbr") [ -r "$IMGFILE" ] || ogRaiseError $OG_ERR_NOTFOUND "$IMGFILE" || return $? # Restaurar imagen del MBR. @@ -1014,7 +1014,7 @@ if [ "$*" == "help" ]; then fi # Error si no se reciben 2 parámetros. [ $# == 2 ] || ogRaiseError $OG_ERR_FORMAT || return $? -IMGFILE=$(ogGetPath "$1" "$2.img") || return $? +IMGFILE=$(ogGetPath "$1" "$2.img") [ -r "$IMGFILE" ] || ogRaiseError $OG_ERR_NOTFOUND "$IMGFILE" || return $? ogGetImageInfo $IMGFILE | awk -F: '{print $1}' } @@ -1031,7 +1031,7 @@ if [ "$*" == "help" ]; then fi # Error si no se reciben 2 parámetros. [ $# == 2 ] || ogRaiseError $OG_ERR_FORMAT || return $? -IMGFILE=$(ogGetPath "$1" "$2.img") || return $? +IMGFILE=$(ogGetPath "$1" "$2.img") [ -r "$IMGFILE" ] || ogRaiseError $OG_ERR_NOTFOUND "$IMGFILE" || return $? ogGetImageInfo $IMGFILE | awk -F: '{print $2}' } @@ -1048,7 +1048,7 @@ if [ "$*" == "help" ]; then fi # Error si no se reciben 2 parámetros. [ $# == 2 ] || ogRaiseError $OG_ERR_FORMAT || return $? -IMGFILE=$(ogGetPath "$1" "$2.img") || return $? +IMGFILE=$(ogGetPath "$1" "$2.img") [ -r "$IMGFILE" ] || ogRaiseError $OG_ERR_NOTFOUND "$IMGFILE" || return $? ogGetImageInfo $IMGFILE | awk -F: '{print $3}' } @@ -1068,7 +1068,7 @@ fi # Error si no se reciben 2 parámetros. [ $# == 2 ] || ogRaiseError $OG_ERR_FORMAT || return $? # Error si el fichero de imagen no es accesible. -IMGFILE=$(ogGetPath "$1" "$2.img") || return $? +IMGFILE=$(ogGetPath "$1" "$2.img") [ -r "$IMGFILE" ] || ogRaiseError $OG_ERR_NOTFOUND "$IMGFILE" || return $? # Devuelve el tamaño de la imagen en KB. @@ -1141,7 +1141,7 @@ fi [ $# == 3 ] || ogRaiseError $OG_ERR_FORMAT || return $? # Procesar parámetros. DISK=$(ogDiskToDev "$3") || return $? -IMGFILE=$(ogGetPath "$1" "$2.gpt") || return $? +IMGFILE=$(ogGetPath "$1" "$2.gpt") [ -r "$IMGFILE" ] || ogRaiseError $OG_ERR_NOTFOUND "$IMGFILE" || return $? # Restaurar tabla GPT del disco. diff --git a/client/engine/PostConf.lib b/client/engine/PostConf.lib index 4f760255..1f04532f 100755 --- a/client/engine/PostConf.lib +++ b/client/engine/PostConf.lib @@ -42,9 +42,9 @@ case "$(ogGetOsType $1 $2)" in ;; Windows) # Borrar ficheros de hibernación y paginación de Windows. - ogGetPath $1 $2 pagefile.sys &>/dev/null && ogDeleteFile $1 $2 pagefile.sys - ogGetPath $1 $2 hiberfil.sys &>/dev/null && ogDeleteFile $1 $2 hiberfil.sys - ogGetPath $1 $2 swapfile.sys &>/dev/null && ogDeleteFile $1 $2 swapfile.sys + [ -n "$(ogGetPath $1 $2 pagefile.sys)" ] && ogDeleteFile $1 $2 pagefile.sys + [ -n "$(ogGetPath $1 $2 hiberfil.sys)" ] && ogDeleteFile $1 $2 hiberfil.sys + [ -n "$(ogGetPath $1 $2 swapfile.sys)" ] && ogDeleteFile $1 $2 swapfile.sys ;; esac diff --git a/client/engine/PostConfEAC.lib b/client/engine/PostConfEAC.lib index 6826620d..d34864d1 100755 --- a/client/engine/PostConfEAC.lib +++ b/client/engine/PostConfEAC.lib @@ -47,9 +47,12 @@ else return $(ogRaiseError $OG_ERR_NOTOS "version windows no detectada"; echo $?) fi -hiveSAM=$(ogGetPath $DISK $PART /${SYSTEMROOT}/system32/config/SAM) && export hiveSAM || return $(ogRaiseError $OG_ERR_NOTOS " hive SAM no detectada"; echo $?) -hiveSYSTEM=$(ogGetPath $DISK $PART /${SYSTEMROOT}/system32/config/system) && export hiveSYSTEM || return $(ogRaiseError $OG_ERR_NOTOS "hive SYSTEM no detectada"; echo $?) -hiveSOFTWARE=$(ogGetPath $DISK $PART /${SYSTEMROOT}/system32/config/software) && export hiveSOFTWARE || return $(ogRaiseError $OG_ERR_NOTOS "hive SOFTWARE no detectada"; echo $?) +hiveSAM=$(ogGetPath $DISK $PART /${SYSTEMROOT}/system32/config/SAM) +[ -n "$hiveSAM" ] && export hiveSAM || return $(ogRaiseError $OG_ERR_NOTOS " hive SAM no detectada"; echo $?) +hiveSYSTEM=$(ogGetPath $DISK $PART /${SYSTEMROOT}/system32/config/system) +[ -n "$hiveSYSTEM" ] && export hiveSYSTEM || return $(ogRaiseError $OG_ERR_NOTOS "hive SYSTEM no detectada"; echo $?) +hiveSOFTWARE=$(ogGetPath $DISK $PART /${SYSTEMROOT}/system32/config/software) +[ -n "$hiveSOFTWARE" ] && export hiveSOFTWARE || return $(ogRaiseError $OG_ERR_NOTOS "hive SOFTWARE no detectada"; echo $?) export TEMPhive=/tmp/tmpregistry # segunda fase, carga de los hive de usuarios windows. diff --git a/client/engine/Protocol.lib b/client/engine/Protocol.lib index 49a83d73..786dba87 100755 --- a/client/engine/Protocol.lib +++ b/client/engine/Protocol.lib @@ -293,7 +293,7 @@ esac [ $# == "$ARG" ] || ogRaiseError $OG_ERR_FORMAT || return $? # Comprobar fichero origen -ogGetPath $SOURCE &> /dev/null || ogRaiseError $OG_ERR_NOTFOUND " device or file $DEVICE not found" || return $? +[ -n "$(ogGetPath $SOURCE)" ] || ogRaiseError $OG_ERR_NOTFOUND " device or file $DEVICE not found" || return $? SESSION=${!ARG} @@ -410,7 +410,7 @@ then fi #3er param check - que puede ser un dispositvo o un fichero. -#ogGetPath "$3" > /dev/null || ogRaiseError $OG_ERR_NOTFOUND " device or file $3" || PERROR=9 #return $? +# [ -n "$(ogGetPath $3)" ] || ogRaiseError $OG_ERR_NOTFOUND " device or file $3" || PERROR=9 #return $? DEVICE=$3 #4 y 5 param check . solo si es sobre particiones. @@ -565,7 +565,7 @@ esac [ $# == "$ARG" ] || ogRaiseError $OG_ERR_FORMAT || return $? # Comprobar fichero origen -ogGetPath $SOURCE &> /dev/null || ogRaiseError $OG_ERR_NOTFOUND " device or file $DEVICE not found" || return $? +[ -n "$(ogGetPath $SOURCE)" ] || ogRaiseError $OG_ERR_NOTFOUND " device or file $DEVICE not found" || return $? # eliminamos ficheros antiguos de log #rm $LOGFILE diff --git a/client/shared/scripts/createDiffImage b/client/shared/scripts/createDiffImage index d5f897be..79ee9726 100755 --- a/client/shared/scripts/createDiffImage +++ b/client/shared/scripts/createDiffImage @@ -76,7 +76,8 @@ ogIsImageLocked "$3" "$5.$DIFFEXT" && exit $(ogRaiseError session $OG_ERR_LOCKED ogIsLocked "$1" "$2" && exit $(ogRaiseError session $OG_ERR_LOCKED "$1 $2"; echo $?) # Comprobar si la imagen completa existe. -IMGFILE="$(ogGetPath "$3" "$4.$IMGEXT")" || exit $(ogRaiseError session $OG_ERR_NOTFOUND "$3 $4.$IMGEXT"; echo $?) +IMGFILE="$(ogGetPath "$3" "$4.$IMGEXT")" +[ -n "$IMGFILE" ] || exit $(ogRaiseError session $OG_ERR_NOTFOUND "$3 $4.$IMGEXT"; echo $?) # Comprobar que la imagen completa es sincronizable ogIsSyncImage "$3" "$4" "img" || exit $(ogRaiseError session $OG_ERR_DONTSYNC_IMAGE "$3 $4"; echo $?) diff --git a/client/shared/scripts/deployImage b/client/shared/scripts/deployImage index 51847110..824da2af 100755 --- a/client/shared/scripts/deployImage +++ b/client/shared/scripts/deployImage @@ -97,7 +97,8 @@ else fi #Informacioin previa de la imagen -IMGOS=$(ogGetImageInfo `ogGetPath $MODE $IMGNAME.img`) || exit $(ogRaiseError session $OG_ERR_NOTFOUND "$REPO $2"; echo $?) +IMGOS=$(ogGetImageInfo `ogGetPath $MODE $IMGNAME.img`) +[ -n "$IMGOS" ] || exit $(ogRaiseError session $OG_ERR_NOTFOUND "$REPO $2"; echo $?) IMGSIZE=$(ls -s `ogGetPath $MODE $IMGNAME.img`| cut -f1 -d" ") ogEcho log session "[1] REPO=$REPO IMG-FILE=$IMGNAME.img SIZE=$IMGSIZE (KB) METADATA=$IMGOS" diff --git a/client/shared/scripts/restoreBaseImage b/client/shared/scripts/restoreBaseImage index 2d7e46de..0b291518 100755 --- a/client/shared/scripts/restoreBaseImage +++ b/client/shared/scripts/restoreBaseImage @@ -58,7 +58,8 @@ fi [ -z $OGENGINECONFIGURATE ] && source /opt/opengnsys/etc/engine.cfg # Procesar parámetros de entrada -REPOFILE="$(ogGetPath "REPO" "$2.$IMGEXT")" || exit $(ogRaiseError session $OG_ERR_NOTFOUND "REPO, $2.$IMGEXT"; echo $?) +REPOFILE="$(ogGetPath "REPO" "$2.$IMGEXT")" +[ -n "$REPOFILE" ] || exit $(ogRaiseError session $OG_ERR_NOTFOUND "REPO, $2.$IMGEXT"; echo $?) # Comprobar que es sincronizable (con REPO) ogIsSyncImage REPO "$2" $IMGEXT || exit $(ogRaiseError session $OG_ERR_DONTSYNC_IMAGE "$1 $2"; echo $?) diff --git a/client/shared/scripts/restoreDiffImage b/client/shared/scripts/restoreDiffImage index bf333bd8..7d16ef90 100755 --- a/client/shared/scripts/restoreDiffImage +++ b/client/shared/scripts/restoreDiffImage @@ -59,7 +59,8 @@ ogEcho log session "[1] $MSG_SCRIPTS_START $0 $*" # Procesar parámetros de entrada DIFFTYPE="diff" DIFFEXT="img.diff" -REPODIFFFILE="$(ogGetPath "REPO" "$3.$DIFFEXT")" || exit $(ogRaiseError session $OG_ERR_NOTFOUND "REPO $3.$DIFFEXT";echo $?) +REPODIFFFILE="$(ogGetPath "REPO" "$3.$DIFFEXT")" +[ -n "$REPODIFFFILE" ] || exit $(ogRaiseError session $OG_ERR_NOTFOUND "REPO $3.$DIFFEXT";echo $?) # Comprobamos si la imagen o la particion estan bloqueada: ogIsImageLocked "$1" "$3.$DIFFEXT" && exit $(ogRaiseError session $OG_ERR_LOCKED "$1 $3.$DIFFEXT";echo $?) diff --git a/client/shared/scripts/updateCache b/client/shared/scripts/updateCache index 7c3f4534..0632365f 100755 --- a/client/shared/scripts/updateCache +++ b/client/shared/scripts/updateCache @@ -85,7 +85,8 @@ if ! $(ogFindCache >/dev/null); then fi # comprobar si la imagen existe (.img, .img.diff o directorio) -REPOFILE=$(ogGetPath "REPO" "/$2") || exit $(ogRaiseError session $OG_ERR_NOTFOUND "REPO /$2"; echo $?) +REPOFILE=$(ogGetPath "REPO" "/$2") +[ -n "$REPOFILE" ] || exit $(ogRaiseError session $OG_ERR_NOTFOUND "REPO /$2"; echo $?) ogEcho log session "$MSG_SCRIPTS_UPDATECACHE_DOUPDATE" # Distingo si es monolitica o sincronizable @@ -93,7 +94,8 @@ file "$REPOFILE" | grep -i -e " BTRFS Filesystem " -e " ext4 filesystem " -e " d if [ $? == 0 ]; then IMGSYNC=TRUE # Para imagen sincronizada, si hay imagen en cache siempre protocolo = rsync. - CACHEFILE="$(ogGetPath "CACHE" "/$2")" && PROTOCOLO="RSYNC" + CACHEFILE="$(ogGetPath "CACHE" "/$2")" + [ -n "$CACHEFILE" ] && PROTOCOLO="RSYNC" # Si es sincronizada tipo directorio siempre protocolo = rsync. [ -d $REPOFILE ] && PROTOCOLO="RSYNC" && IMGTYPE="dir" |