refs #1652 add ogBootMbrGeneric
parent
08cff2ce0d
commit
370915fc01
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import sys
|
||||
import argparse
|
||||
from SystemLib import ogHelp
|
||||
from BootLib import ogBootMbrGeneric
|
||||
|
||||
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 ('ogBootMbrGeneric', 'ogBootMbrGeneric int_ndisk', ['ogBootMbrGeneric 1'])
|
||||
sys.exit (0)
|
||||
|
||||
args = parser.parse_args()
|
||||
ret = ogBootMbrGeneric (args.disk)
|
||||
|
||||
if ret is not None:
|
||||
if ret == True: sys.exit (0)
|
||||
elif ret == False: sys.exit (1)
|
||||
else: print (ret)
|
|
@ -133,6 +133,17 @@ def ogBootMbrXP (disk):
|
|||
#@exception OG_ERR_NOTFOUND Tipo de partición desconocido o no se puede montar.
|
||||
#*/ ##
|
||||
|
||||
def ogBootMbrGeneric (disk):
|
||||
DISK = DiskLib.ogDiskToDev (disk)
|
||||
if not DISK: return None
|
||||
subprocess.run (['ms-sys', '-z', '-f', DISK])
|
||||
subprocess.run (['ms-sys', '-s', '-f', DISK])
|
||||
|
||||
# Firma necesaria para Windows equipos UEFI
|
||||
with open ('/proc/sys/kernel/random/uuid', 'r') as fd:
|
||||
kernel_random_uuid = fd.read().split ('-')[0]
|
||||
signature = f'0x{kernel_random_uuid}'
|
||||
subprocess.run (['ms-sys', '-S', signature, DISK])
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue