From 3e3cfdbcd926418b4d7cfdd923418fe1f1bfc8fe Mon Sep 17 00:00:00 2001 From: ramon Date: Thu, 21 Jan 2016 10:49:26 +0000 Subject: [PATCH] =?UTF-8?q?#696=20#726:=20Funci=C3=B3n=20{{{ogIsFormated}}?= =?UTF-8?q?}=20hace=20la=20comprobaci=C3=B3n=20de=20formateo=20sin=20monta?= =?UTF-8?q?r=20el=20sistema=20de=20archivos;=20evitar=20mostrar=20errores?= =?UTF-8?q?=20en=20funciones=20{{{ogIs...}}}?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://opengnsys.es/svn/branches/version1.1@4780 a21b9725-9963-47de-94b9-378ad31fedc9 --- client/engine/FileSystem.lib | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/client/engine/FileSystem.lib b/client/engine/FileSystem.lib index 9d37e3df..acd2b3c0 100755 --- a/client/engine/FileSystem.lib +++ b/client/engine/FileSystem.lib @@ -477,11 +477,14 @@ findmnt -n -o TARGET $PART #@version 1.0.5 - Dejar de usar "parted". #@author Ramon Gomez, ETSII Universidad de Sevilla #@date 2012-09-04 +#@version 1.1.0 - Comprobar sin montar el sistema de ficheros. +#@author Ramon Gomez, ETSII Universidad de Sevilla +#@date 2016-01-21 #*/ ## function ogIsFormated () { # Variables locales -local DISK +local PART if [ "$*" == "help" ]; then ogHelp "$FUNCNAME" "$FUNCNAME int_ndisk int_nfilesys" \ "if $FUNCNAME 1 1; then ... ; fi" @@ -489,8 +492,16 @@ if [ "$*" == "help" ]; then fi # Falso, en caso de error. [ $# == 2 ] || return 1 +PART="$(ogDiskToDev $1 $2 2>/dev/null)" || return 1 -test -n "$(ogMount "$1" "$2" 2>/dev/null)" +# Revisar tipo de sistema de ficheros. +if [[ "$PART" =~ ^/ ]]; then + # Sistemas de ficheros genéricos. + test -n "$(blkid -s TYPE $PART | egrep -vi "swap|_member")" +else + # ZFS. + test "$(zfs list -Hp -o canmount $PART 2>/dev/null)" = "on" +fi } @@ -521,9 +532,7 @@ if [ "$*" == "help" ]; then fi # Falso, en caso de error. [ $# == 2 ] || return 1 - -# Obtener partición. -PART="$(ogDiskToDev $1 $2)" || return 1 +PART="$(ogDiskToDev $1 $2 2>/dev/null)" || return 1 # Comprobar existencia del fichero de bloqueo. LOCKFILE="/var/lock/lock${PART//\//-}" @@ -582,9 +591,7 @@ if [ "$*" == "help" ]; then fi # Falso, en caso de error. [ $# == 2 ] || return 1 - -# Obtener partición. -PART="$(ogDiskToDev $1 $2)" || return 1 +PART="$(ogDiskToDev $1 $2 2>/dev/null)" || return 1 test -n "$(findmnt -n -o OPTIONS $PART | awk 'BEGIN {RS=","} /^ro$/ {print}')" } @@ -613,9 +620,7 @@ if [ "$*" == "help" ]; then fi # Falso, en caso de error. [ $# == 2 ] || return 1 - -# Obtener partición. -PART="$(ogDiskToDev $1 $2)" || return 1 +PART="$(ogDiskToDev $1 $2 2>/dev/null)" || return 1 test -n "$(findmnt -n -o OPTIONS $PART | awk 'BEGIN {RS=","} /^rw$/ {print}')" }