Formatos nuevos en hidraPath
git-svn-id: https://opengnsys.es/svn/trunk@51 a21b9725-9963-47de-94b9-378ad31fedc9remotes/github/debian-pkg
parent
a09725e71b
commit
571d9b666b
|
@ -32,13 +32,15 @@ case $# in
|
|||
1) # Error si el parametro no es un digito.
|
||||
[ -n "${1/[1-9]/}" ] && exit $ERRFORMAT
|
||||
DISCO=$(echo $DISCOS | awk -v n=$1 '{print $n}')
|
||||
[ ! -b "$DISCO" ] && exit $ERRNOTFOUND
|
||||
# Error si no es fichero de bloques.
|
||||
[ -b "$DISCO" ] || exit $ERRNOTFOUND
|
||||
echo "$DISCO"
|
||||
;;
|
||||
2) # Error si los 2 parametros no son digitos.
|
||||
[ -n "${1/[1-9]/}" -o -n "${2/[1-9]/}" ] && exit $ERRFORMAT
|
||||
PART=$(echo $DISCOS | awk -v n=$1 '{print $n}')$2
|
||||
[ ! -b "$PART" ] && exit $ERRNOTFOUND
|
||||
# Error si no es fichero de bloques.
|
||||
[ -b "$PART" ] || exit $ERRNOTFOUND
|
||||
echo "$PART"
|
||||
;;
|
||||
*) # Formato erroneo.
|
||||
|
|
|
@ -30,7 +30,7 @@ case "$(hidraTypeFS $1 $2)" in
|
|||
DIR="$(hidraMount $1 $2)" || exit $?
|
||||
cd $DIR
|
||||
# ls -RAQln
|
||||
find . -exec ls -Qdln {} \;
|
||||
find . -ls
|
||||
;;
|
||||
*) exit $ERRPARTITION;;
|
||||
esac
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
# Salida: TamañoKB
|
||||
# Error: 1 - formato incorrecto.
|
||||
# 2 - fichero no encontrado.
|
||||
# Requisitos: partimage, ConnectToRepo (EAC)
|
||||
# Requisitos: partimage, hidraPath
|
||||
# Notas: Solo ejecutable por root
|
||||
# Version: 1.0 - Compatible con EAC: nueva funcion.
|
||||
# Autor: Ramon Gomez, ETSII Univ. Sevilla
|
||||
|
@ -19,8 +19,7 @@ source $(dirname $0)/hidraEnviron
|
|||
[ $# -ne 3 ] && exit $ERRFORMAT
|
||||
|
||||
# Error si no existe el fichero.
|
||||
FICH=$(ConnectToRepo "$1" "${2%/}/" "$3")
|
||||
[ -f "$FICH" ] || exit $ERRNOTFOUND
|
||||
FICH=$(hidraPath "$1" "$2/$3") || exit $ERRNOTFOUND
|
||||
|
||||
# Formato por determinar (por el momento solo el tamano en KB).
|
||||
partimage -B gui=no imginfo "$FICH" 2>&1 | \
|
||||
|
|
|
@ -1,29 +1,42 @@
|
|||
#!/bin/bash
|
||||
# Nombre: CaminoWindows
|
||||
# Descripcion: Traduce a Linux el camino completo de un fichero Windows
|
||||
# (sin contar mayusculas ni minusculas).
|
||||
# Formato: CaminoWindows fichero
|
||||
# Salida: Cadena con el camino para Linux.
|
||||
# (sin contar mayusculas ni minusculas) o de un repositorio.
|
||||
# Formatos: hidraPath fichero
|
||||
# hidraPath iprepo fichero
|
||||
# hidraPath numdisco numparticion fichero
|
||||
# Salida: Cadena con el camino del fichero en Linux.
|
||||
# Error: 1 - mal formato de ejecución.
|
||||
# 2 - no existe el fichero.
|
||||
# Requisitos: grep, sed
|
||||
# Requisitos: grep, sed, hidraDisk, ConnectToRepo (EAC)
|
||||
# Notas: Solo ejecutable por root
|
||||
# La particion de Windows debe estar montada previamente.
|
||||
# Version: 1.0 - Version inicial.
|
||||
# Autor: Ramon Gomez - ETSII, Univ. Sevilla
|
||||
# Fecha: 21/05/2008
|
||||
# Version: 1.1 - 3 formatos de ejecucion.
|
||||
# Autor: Ramon Gomez - ETSII, Univ. Sevilla
|
||||
# Fecha: 19/05/2009
|
||||
|
||||
|
||||
source $(dirname $0)/hidraEnviron
|
||||
|
||||
# Proceso dependiendo del numero de parametros.
|
||||
case $# in
|
||||
1) FICH="$1" ;;
|
||||
2) FICH=$(ConnectToRepo $1 / "$2") ;;
|
||||
3) FICH="$(hidraMount $1 $2)/$3" || exit $ERRNOTFOUND ;;
|
||||
*) exit $ERRFORMAT ;;
|
||||
esac
|
||||
|
||||
# Eliminar "/" duplicados y quitar los "/" inicial y final.
|
||||
FICH="$(echo $1|sed -e 's/\(\/\)*\1/\//g' -e 's/^\///' -e 's/\/$//')"
|
||||
FICH="$(echo $FICH|sed -e 's/\(\/\)*\1/\//g' -e 's/^\///' -e 's/\/$//')"
|
||||
FICHANT=""
|
||||
CAMINO="/"
|
||||
while [ "$FICH" != "$FICHANT" ]; do
|
||||
# Busca el nombre correcto en el directorio actual.
|
||||
cd "$CAMINO"
|
||||
CAMINO="${CAMINO}/$(ls -A | grep -i "^${FICH%%/*}$")" || exit $ERRNOTFOUND
|
||||
CAMINO="${CAMINO}/$(ls -A | grep -i -m1 "^${FICH%%/*}$")" || exit $ERRNOTFOUND
|
||||
FICHANT="$FICH"
|
||||
FICH="${FICH#*/}"
|
||||
done
|
||||
|
|
|
@ -24,10 +24,9 @@ PART="$(hidraDisk $1 $2)" || exit $?
|
|||
hidraIsLocked $1 $2 && exit $ERRLOCKED
|
||||
|
||||
# Error si no existe el fichero de imagen.
|
||||
FICH=$(ConnectToRepo "$3" "${4%/}/" "$5")
|
||||
[ -f "$FICH" ] || exit $ERRNOTFOUND
|
||||
FICH=$(hidraPath "$3" "$4/$5") || exit $ERRNOTFOUND
|
||||
# Error si la imagen no cabe en la particion.
|
||||
[ $(hidraImageSize "$3" "$4" "$5") > $(hidraPartitionSize $1 $2) ] && exit $ERRPARTITION
|
||||
[ $(hidraImageSize "$3" "$4" "$5") -gt $(hidraPartitionSize $1 $2) ] && exit $ERRPARTITION
|
||||
|
||||
# Bloquear la particion mientras se restaurarn los datos.
|
||||
hidraLock $1 $2
|
||||
|
|
Loading…
Reference in New Issue