refs #1512 add ogUnhidePartition
parent
158c25f43e
commit
d71e261829
|
@ -1381,45 +1381,21 @@ def ogTypeToId (type, pttype='MSDOS'):
|
||||||
#@exception OG_ERR_NOTFOUND disco o particion no detectado (no es un dispositivo).
|
#@exception OG_ERR_NOTFOUND disco o particion no detectado (no es un dispositivo).
|
||||||
#@exception OG_ERR_PARTITION tipo de partición no reconocido.
|
#@exception OG_ERR_PARTITION tipo de partición no reconocido.
|
||||||
#*/ ##
|
#*/ ##
|
||||||
def ogUnhidePartition(*args):
|
def ogUnhidePartition (disk, par):
|
||||||
# Variables locales
|
PART = ogDiskToDev (disk, par)
|
||||||
PART = None
|
if not PART: return None
|
||||||
TYPE = None
|
|
||||||
NEWTYPE = None
|
|
||||||
|
|
||||||
# Si se solicita, mostrar ayuda.
|
TYPE = ogGetPartitionType (disk, par)
|
||||||
if len(args) == 1 and args[0] == "help":
|
if 'HNTFS' == TYPE: NEWTYPE = 'NTFS'
|
||||||
SystemLib.ogHelp('ogUnhidePartition', 'ogUnhidePartition int_ndisk int_npartition', 'ogUnhidePartition 1 1')
|
elif 'HFAT32' == TYPE: NEWTYPE = 'FAT32'
|
||||||
return
|
elif 'HFAT16' == TYPE: NEWTYPE = 'FAT16'
|
||||||
|
elif 'HFAT12' == TYPE: NEWTYPE = 'FAT12'
|
||||||
# Error si no se reciben 2 parámetros.
|
elif 'WIN-RESERV' == TYPE: NEWTYPE = 'WINDOWS'
|
||||||
if len(args) != 2:
|
|
||||||
SystemLib.ogRaiseError(OG_ERR_FORMAT)
|
|
||||||
return
|
|
||||||
|
|
||||||
PART = ogDiskToDev(args[0], args[1])
|
|
||||||
if PART is None:
|
|
||||||
return
|
|
||||||
|
|
||||||
# Obtener tipo de partición.
|
|
||||||
TYPE = ogGetPartitionType(args[0], args[1])
|
|
||||||
if TYPE == "HNTFS":
|
|
||||||
NEWTYPE = "NTFS"
|
|
||||||
elif TYPE == "HFAT32":
|
|
||||||
NEWTYPE = "FAT32"
|
|
||||||
elif TYPE == "HFAT16":
|
|
||||||
NEWTYPE = "FAT16"
|
|
||||||
elif TYPE == "HFAT12":
|
|
||||||
NEWTYPE = "FAT12"
|
|
||||||
elif TYPE == "WIN-RESERV":
|
|
||||||
NEWTYPE = "WINDOWS"
|
|
||||||
else:
|
else:
|
||||||
SystemLib.ogRaiseError(OG_ERR_PARTITION, TYPE)
|
SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_PARTITION, TYPE)
|
||||||
return
|
return None
|
||||||
|
|
||||||
# Cambiar tipo de partición.
|
ogSetPartitionType (disk, par, NEWTYPE)
|
||||||
ogSetPartitionType(args[0], args[1], NEWTYPE)
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
#/**
|
#/**
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import argparse
|
||||||
|
from SystemLib import ogHelp
|
||||||
|
from DiskLib import ogUnhidePartition
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser (add_help=False)
|
||||||
|
parser.add_argument ('disk')
|
||||||
|
parser.add_argument ('par')
|
||||||
|
|
||||||
|
if 2 == len (sys.argv) and 'help' == sys.argv[1]:
|
||||||
|
#parser.print_help() sale en inglés aunque la locale indique otra cosa
|
||||||
|
ogHelp ('ogUnhidePartition', 'ogUnhidePartition int_ndisk int_npartition', ['ogUnhidePartition 1 1'])
|
||||||
|
sys.exit (0)
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
ret = ogUnhidePartition (args.disk, args.par)
|
||||||
|
|
||||||
|
if ret is not None:
|
||||||
|
if ret == True: sys.exit (0)
|
||||||
|
elif ret == False: sys.exit (1)
|
||||||
|
else: print (ret)
|
Loading…
Reference in New Issue