refs #1166 add ogIsWritable()
parent
b4b2ab09cb
commit
8ba0913684
|
@ -552,22 +552,18 @@ def ogIsReadonly(disk, par):
|
||||||
options = result.stdout.strip().split(",")
|
options = result.stdout.strip().split(",")
|
||||||
return "ro" in options
|
return "ro" in options
|
||||||
|
|
||||||
def ogIsWritable(int_ndisk, int_nfilesys):
|
|
||||||
|
|
||||||
if len(sys.argv) != 3:
|
#/**
|
||||||
SystemLib.ogRaiseError(
|
# ogIsWritable int_ndisk int_nfilesys
|
||||||
"session",
|
#@brief Comprueba si un sistema de archivos está montado de lectura y escritura.
|
||||||
ogGlobals.OG_ERR_FORMAT,
|
#@param int_ndisk nº de orden del disco
|
||||||
f"Not enough arguments"
|
#@param int_nfilesys nº de orden del sistema de archivos
|
||||||
)
|
#@return Código de salida: 0 - lectura y escritura, 1 - solo lectura o no montado.
|
||||||
return
|
#*/ ##
|
||||||
|
def ogIsWritable (disk, par):
|
||||||
|
PART = DiskLib.ogDiskToDev (disk, par)
|
||||||
|
if not PART: return
|
||||||
|
|
||||||
# Obtener partición.
|
|
||||||
PART = DiskLib.ogDiskToDev(int_ndisk, int_nfilesys)
|
|
||||||
if not PART:
|
|
||||||
return
|
|
||||||
|
|
||||||
# Comprobar si la partición está montada en modo de escritura.
|
|
||||||
result = subprocess.run(["findmnt", "-n", "-o", "OPTIONS", PART], capture_output=True, text=True)
|
result = subprocess.run(["findmnt", "-n", "-o", "OPTIONS", PART], capture_output=True, text=True)
|
||||||
options = result.stdout.strip().split(",")
|
options = result.stdout.strip().split(",")
|
||||||
return "rw" in options
|
return "rw" in options
|
||||||
|
|
Loading…
Reference in New Issue