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_PARTITION tipo de partición no reconocido.
|
||||
#*/ ##
|
||||
def ogUnhidePartition(*args):
|
||||
# Variables locales
|
||||
PART = None
|
||||
TYPE = None
|
||||
NEWTYPE = None
|
||||
def ogUnhidePartition (disk, par):
|
||||
PART = ogDiskToDev (disk, par)
|
||||
if not PART: return None
|
||||
|
||||
# Si se solicita, mostrar ayuda.
|
||||
if len(args) == 1 and args[0] == "help":
|
||||
SystemLib.ogHelp('ogUnhidePartition', 'ogUnhidePartition int_ndisk int_npartition', 'ogUnhidePartition 1 1')
|
||||
return
|
||||
|
||||
# Error si no se reciben 2 parámetros.
|
||||
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"
|
||||
TYPE = ogGetPartitionType (disk, par)
|
||||
if 'HNTFS' == TYPE: NEWTYPE = 'NTFS'
|
||||
elif 'HFAT32' == TYPE: NEWTYPE = 'FAT32'
|
||||
elif 'HFAT16' == TYPE: NEWTYPE = 'FAT16'
|
||||
elif 'HFAT12' == TYPE: NEWTYPE = 'FAT12'
|
||||
elif 'WIN-RESERV' == TYPE: NEWTYPE = 'WINDOWS'
|
||||
else:
|
||||
SystemLib.ogRaiseError(OG_ERR_PARTITION, TYPE)
|
||||
return
|
||||
SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_PARTITION, TYPE)
|
||||
return None
|
||||
|
||||
# Cambiar tipo de partición.
|
||||
ogSetPartitionType(args[0], args[1], NEWTYPE)
|
||||
return
|
||||
ogSetPartitionType (disk, par, NEWTYPE)
|
||||
|
||||
|
||||
#/**
|
||||
|
|
|
@ -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