refs #1166 add ogIsWritable()
parent
b4b2ab09cb
commit
8ba0913684
|
@ -552,22 +552,18 @@ def ogIsReadonly(disk, par):
|
|||
options = result.stdout.strip().split(",")
|
||||
return "ro" in options
|
||||
|
||||
def ogIsWritable(int_ndisk, int_nfilesys):
|
||||
|
||||
if len(sys.argv) != 3:
|
||||
SystemLib.ogRaiseError(
|
||||
"session",
|
||||
ogGlobals.OG_ERR_FORMAT,
|
||||
f"Not enough arguments"
|
||||
)
|
||||
return
|
||||
#/**
|
||||
# ogIsWritable int_ndisk int_nfilesys
|
||||
#@brief Comprueba si un sistema de archivos está montado de lectura y escritura.
|
||||
#@param int_ndisk nº de orden del disco
|
||||
#@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.
|
||||
#*/ ##
|
||||
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)
|
||||
options = result.stdout.strip().split(",")
|
||||
return "rw" in options
|
||||
|
|
Loading…
Reference in New Issue