refs #1651 add ogGetBootMbr

pull/5/head
Natalia Serrano 2025-03-06 14:27:54 +01:00
parent 370915fc01
commit bb2e4a4e7f
2 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,22 @@
#!/usr/bin/python3
import sys
import argparse
from SystemLib import ogHelp
from BootLib import ogGetBootMbr
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 ('ogGetBootMbr', 'ogGetBootMbr int_ndisk', ['ogGetBootMbr 1'])
sys.exit (0)
args = parser.parse_args()
ret = ogGetBootMbr (args.disk)
if ret is not None:
if ret == True: sys.exit (0)
elif ret == False: sys.exit (1)
else: print (ret)

View File

@ -187,6 +187,10 @@ fix_first_sector=yes
#@exception OG_ERR_FORMAT Formato incorrecto.
#@exception OG_ERR_NOTFOUND Dispositivo de disco no encontrado.
#*/ ##
def ogGetBootMbr (disk):
DISK = DiskLib.ogDiskToDev (disk)
if not DISK: return None
subprocess.run (['ms-sys', '-f', DISK])
#/**
# ogWindowsBootParameters int_ndisk int_parition