refs #1501 add ogListLogicalPartitions
parent
00da7454ec
commit
941ace29bb
|
@ -1087,7 +1087,7 @@ def ogListPartitions (disk):
|
||||||
SIZE = ogGetPartitionSize (disk, PART) or 0
|
SIZE = ogGetPartitionSize (disk, PART) or 0
|
||||||
p.append (f'{TYPE}:{SIZE}')
|
p.append (f'{TYPE}:{SIZE}')
|
||||||
|
|
||||||
return ' '.join (p)
|
return p
|
||||||
|
|
||||||
|
|
||||||
#/**
|
#/**
|
||||||
|
@ -1126,24 +1126,14 @@ def ogListPrimaryPartitions(*args):
|
||||||
#@param int_ndisk nº de orden del disco
|
#@param int_ndisk nº de orden del disco
|
||||||
#@see ogListPartitions
|
#@see ogListPartitions
|
||||||
#*/ ##
|
#*/ ##
|
||||||
def ogListLogicalPartitions(*args):
|
def ogListLogicalPartitions (disk):
|
||||||
# Variables locales
|
PTTYPE = ogGetPartitionTableType (disk)
|
||||||
PTTYPE = None
|
if not PTTYPE: return None
|
||||||
PARTS = None
|
|
||||||
|
|
||||||
# Si se solicita, mostrar ayuda.
|
PARTS = ogListPartitions (disk)
|
||||||
if len(args) == 1 and args[0] == "help":
|
if not PARTS: return None
|
||||||
SystemLib.ogHelp('ogListLogicalPartitions', 'ogListLogicalPartitions int_ndisk', 'ogListLogicalPartitions 1 => LINUX-SWAP:999998')
|
|
||||||
return
|
|
||||||
|
|
||||||
PTTYPE = ogGetPartitionTableType(args[0])
|
return PARTS[4:]
|
||||||
if PTTYPE is None:
|
|
||||||
return
|
|
||||||
PARTS = ogListPartitions(*args)
|
|
||||||
if PARTS is None:
|
|
||||||
return
|
|
||||||
|
|
||||||
return PARTS.split(" ")[4:]
|
|
||||||
|
|
||||||
|
|
||||||
#/**
|
#/**
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import argparse
|
||||||
|
from SystemLib import ogHelp
|
||||||
|
from DiskLib import ogListLogicalPartitions
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser (add_help=False)
|
||||||
|
parser.add_argument ('disk')
|
||||||
|
|
||||||
|
if 2 == len (sys.argv) and 'help' == sys.argv[1]:
|
||||||
|
#parser.print_help() sale en inglés aunque la locale indique otra cosa
|
||||||
|
ogHelp ('ogListLogicalPartitions', 'ogListLogicalPartitions int_ndisk', ['ogListLogicalPartitions 1'])
|
||||||
|
sys.exit (0)
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
ret = ogListLogicalPartitions (args.disk)
|
||||||
|
|
||||||
|
if ret is not None:
|
||||||
|
if ret == True: sys.exit (0)
|
||||||
|
elif ret == False: sys.exit (1)
|
||||||
|
else: print (' '.join (ret))
|
|
@ -19,4 +19,4 @@ ret = ogListPartitions (args.disk)
|
||||||
if ret is not None:
|
if ret is not None:
|
||||||
if ret == True: sys.exit (0)
|
if ret == True: sys.exit (0)
|
||||||
elif ret == False: sys.exit (1)
|
elif ret == False: sys.exit (1)
|
||||||
else: print (ret)
|
else: print (' '.join (ret))
|
||||||
|
|
Loading…
Reference in New Issue