refs #1098 add ogIsFormated()
parent
a5d3d8088d
commit
844ae53c05
|
@ -414,29 +414,28 @@ def ogGetMountPoint(int_ndisk, int_nfilesys):
|
|||
result = subprocess.run(["findmnt", "-n", "-o", "TARGET", PART], capture_output=True, text=True)
|
||||
return result.stdout.strip()
|
||||
|
||||
def ogIsFormated(int_ndisk, int_nfilesys):
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if len(sys.argv) == 3 and sys.argv[2] == "help":
|
||||
ogHelp("ogIsFormated", "ogIsFormated int_ndisk int_nfilesys", "ogIsFormated 1 1")
|
||||
return
|
||||
|
||||
# Error si no se reciben 2 parámetros.
|
||||
if len(sys.argv) != 3:
|
||||
ogRaiseError(OG_ERR_FORMAT)
|
||||
return
|
||||
|
||||
# Obtener partición.
|
||||
PART = ogDiskToDev(int_ndisk, int_nfilesys)
|
||||
#/**
|
||||
# ogIsFormated int_ndisk int_nfilesys
|
||||
#@brief Comprueba si un sistema de archivos está formateado.
|
||||
#@param int_ndisk nº de orden del disco o volumen.
|
||||
#@param int_nfilesys nº de orden del sistema de archivos
|
||||
#@return Código de salida: True - formateado, False - sin formato o error.
|
||||
#*/ ##
|
||||
def ogIsFormated(disk, part):
|
||||
PART = ogDiskToDev(disk, part)
|
||||
if not PART:
|
||||
return
|
||||
|
||||
# Revisar tipo de sistema de archivos.
|
||||
if PART.startswith("/"):
|
||||
result = subprocess.run(["blkid", "-s", "TYPE", PART], capture_output=True, text=True)
|
||||
return bool(result.stdout.strip())
|
||||
out = subprocess.run(["blkid", "-s", "TYPE", PART], capture_output=True, text=True).stdout.strip()
|
||||
if 'swap' in out: return False
|
||||
if '_member' in out: return False
|
||||
return bool(out)
|
||||
else:
|
||||
result = subprocess.run(["zfs", "list", "-Hp", "-o", "canmount", PART], capture_output=True, text=True)
|
||||
return result.stdout.strip() == "on"
|
||||
out = subprocess.run(["zfs", "list", "-Hp", "-o", "canmount", PART], capture_output=True, text=True).stdout.strip()
|
||||
return out == "on"
|
||||
|
||||
def ogIsLocked(int_ndisk, int_nfilesys):
|
||||
return ogIsPartitionLocked(int_ndisk, int_nfilesys)
|
||||
|
|
Loading…
Reference in New Issue