diff options
-rwxr-xr-x | client/engine/Disk.lib | 4 | ||||
-rwxr-xr-x | client/engine/File.lib | 27 | ||||
-rwxr-xr-x | client/engine/FileSystem.lib | 33 | ||||
-rwxr-xr-x | client/engine/Image.lib | 6 |
4 files changed, 44 insertions, 26 deletions
diff --git a/client/engine/Disk.lib b/client/engine/Disk.lib index 6aecf2da..6b642b38 100755 --- a/client/engine/Disk.lib +++ b/client/engine/Disk.lib @@ -319,7 +319,7 @@ local DISK # Si se solicita, mostrar ayuda. if [ "$*" == "help" ]; then - ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk" \ "$FUNCNAME 1 => 244198584" + ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk" "$FUNCNAME 1 => 244198584" return fi # Error si no se recibe 1 parámetro. @@ -469,7 +469,7 @@ esac #/** # ogGetPartitionType int_ndisk int_npartition #@brief Muestra el tipo de una particion determinada. -#@note Alias de la función ogGetFsType +#@see ogGetFsType #*/ ## function ogGetPartitionType () { diff --git a/client/engine/File.lib b/client/engine/File.lib index e9c03439..cb258b39 100755 --- a/client/engine/File.lib +++ b/client/engine/File.lib @@ -27,7 +27,7 @@ function ogCalculateChecksum () local FILE if [ "$*" == "help" ]; then ogHelp "$FUNCNAME" "$FUNCNAME [ str_repo | int_ndisk int_npartition ] path_filepath" \ - "$FUNCNAME REPO ubuntu.img ==> ef899299caf8b517ce36f1157a93d8bf" + "$FUNCNAME REPO ubuntu.img ==> ef899299caf8b517ce36f1157a93d8bf" return fi @@ -53,7 +53,7 @@ function ogCompareChecksumFiles () local ARGS SOURCE TARGET if [ "$*" == "help" ]; then ogHelp "$FUNCNAME" "$FUNCNAME [ str_repo | int_ndisk int_npartition ] path_filepath" \ - "if $FUNCNAME REPO ubuntu.img CACHE ubuntu.img; then ... fi" + "if $FUNCNAME REPO ubuntu.img CACHE ubuntu.img; then ...; fi" return fi @@ -89,6 +89,11 @@ function ogCopyFile () { # Variables locales. local ARGS SOURCE TARGET +if [ "$*" == "help" ]; then + ogHelp "$FUNCNAME" "$FUNCNAME [ str_repo | int_ndisk int_npartition ] path_source [ str_repo | int_ndisk int_npartition ] path_target" \ + "$FUNCNAME REPO newfile.txt 1 2 /tmp/newfile.txt" + return +fi ARGS="$@" case "$1" in @@ -123,6 +128,12 @@ function ogDeleteFile () { # Variables locales. local FILE +if [ "$*" == "help" ]; then + ogHelp "$FUNCNAME" "$FUNCNAME [ str_repo | int_ndisk int_npartition ] path_file" \ + "$FUNCNAME 1 2 /tmp/newfile.txt" + return +fi + # Comprobar que existe el fichero y borrarlo. FILE="$(ogGetPath "$@")" [ -n "$FILE" ] || ogRaiseError $OG_ERR_NOTFOUND "$*" || return $? @@ -142,6 +153,12 @@ function ogDeleteTree () { # Variables locales. local DIR +if [ "$*" == "help" ]; then + ogHelp "$FUNCNAME" "$FUNCNAME [ str_repo | int_ndisk int_npartition ] path_dir" \ + "$FUNCNAME 1 2 /tmp/newdir" + return +fi + # Comprobar que existe el directorio y borrarlo con su contenido. DIR="$(ogGetPath "$@")" [ -n "$DIR" ] || ogRaiseError $OG_ERR_NOTFOUND "$*" || return $? @@ -342,6 +359,12 @@ ogCalculateChecksum "$FILE" > "$FILE.sum" function ogMakeDir () { local PARENT DIR +if [ "$*" == "help" ]; then + ogHelp "$FUNCNAME" "$FUNCNAME [ str_repo | int_ndisk int_npartition ] path_dir" \ + "$FUNCNAME 1 2 /tmp/newdir" + return +fi + PARENT="$(ogGetParentPath "$@")" || return $? DIR="$(basename "${!#}")" mkdir -p "$PARENT/$DIR" || ogRaiseError $OG_ERR_NOTFOUND "$*" || return $? diff --git a/client/engine/FileSystem.lib b/client/engine/FileSystem.lib index e453d809..5c69e089 100755 --- a/client/engine/FileSystem.lib +++ b/client/engine/FileSystem.lib @@ -31,7 +31,13 @@ function ogCheckFs () { # Variables locales. -local PART TYPE PROG PARAMS CODES +local PART TYPE PROG PARAMS CODES ERRCODE +# Si se solicita, mostrar ayuda. +if [ "$*" == "help" ]; then + ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_npartition" \ + "$FUNCNAME 1 1" + return +fi # Error si no se reciben 2 parámetros. [ $# == 2 ] || ogRaiseError $OG_ERR_FORMAT || return $? @@ -98,7 +104,7 @@ return $ERRCODE function ogExtendFs () { # Variables locales. -local PART PROG PARAMS +local PART TYPE PROG PARAMS ERRCODE # Si se solicita, mostrar ayuda. if [ "$*" == "help" ]; then @@ -288,11 +294,10 @@ return $ERRCODE #@author Ramon Gomez, ETSII Universidad de Sevilla #@date 2009-07-21 #*/ ## -function ogGetFsType () { - +function ogGetFsType () +{ # Variables locales. -local ID TYPE - +local DISK ID TYPE # Si se solicita, mostrar ayuda. if [ "$*" == "help" ]; then ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_npartition" \ @@ -336,7 +341,7 @@ case "$ID" in fd) TYPE="LINUX-RAID" ;; *) TYPE="UNKNOWN" ;; esac -echo $TYPE +echo "$TYPE" } @@ -601,13 +606,8 @@ if [ -z "$MNTDIR" ]; then $MOUNT $PARAMS $PART $MNTDIR 2>/dev/null || \ $MOUNT $PARAMS $PART $MNTDIR -o force,remove_hiberfile 2>/dev/null || \ ogRaiseError $OG_ERR_PARTITION "$1, $2, $TYPE" || return $? - # linea temporal durante desarrollo para poder usar el cliente completo nfs y testeas nuevas herramientas. - if grep -q nfsroot /proc/cmdline; then - echo "$PART $MNTDIR" >> /etc/mtab - fi - # fin linea temporal. fi -echo $MNTDIR +echo "$MNTDIR" } @@ -698,8 +698,6 @@ case "$(ogGetFsType $1 $2)" in *) ogRaiseError $OG_ERR_PARTITION "$1,$2" return $? ;; esac -#/// Mostrar nuevo tamaño en KB. -#echo $[SIZE*1024] ogGetFsSize $1 $2 } @@ -857,11 +855,6 @@ if [ -n "$MNTDIR" ]; then # Desmontar y borrar punto de montaje. umount $PART 2>/dev/null || ogEcho warning "$FUNCNAME: $MSG_DONTUNMOUNT: \"$1, $2\"" rmdir $MNTDIR 2>/dev/null || rm -f $MNTDIR 2>/dev/null - # linea temporal durante desarrollo para testear nuevas herramientas con el cliente completo nfs - if grep -q nfsroot /proc/cmdline; then - grep -v $PART /etc/mtab > /var/tmp/mtab.temporal && cp /var/tmp/mtab.temporal /var/tmp/mtab && rm /var/tmp/mtab.temporal - fi - # fin linea temporal. else ogEcho warning "$MSG_DONTMOUNT: \"$1,$2\"" fi diff --git a/client/engine/Image.lib b/client/engine/Image.lib index 7934525e..0a0867f2 100755 --- a/client/engine/Image.lib +++ b/client/engine/Image.lib @@ -382,6 +382,7 @@ IMGFILE="$IMGDIR/$(basename "$3").mbr" dd if="$DISK" of="$IMGFILE" bs=446 count=1 || ogRaiseError $OG_ERR_IMAGE "$1 $IMGFILE" || return $? } + #/** # ogIsImageLocked [str_repo] path_image #@brief Comprueba si una imagen está bloqueada para uso exclusivo. @@ -481,7 +482,7 @@ touch $IMGDIR/$(basename "${!#}").lock function ogRestoreImage () { # Variables locales -local PART PARTSIZE IMGFILE IMGTYPE IMGSIZE FSTYPE +local PART PARTSIZE IMGFILE IMGTYPE IMGSIZE FSTYPE PROGRAM ERRCODE # Si se solicita, mostrar ayuda. if [ "$*" == "help" ]; then @@ -662,7 +663,8 @@ rm -f $(ogGetPath $@.lock) #@date 2010/02/08 #*/ ## -function ogGetImageInfo () { +function ogGetImageInfo () +{ # Si se solicita, mostrar ayuda. if [ "$*" == "help" ]; then ogHelp "$FUNCNAME" "$FUNCNAME filename " \ |