#!/usr/bin/python3

import sys
import argparse
from SystemLib import ogHelp
from BootLib import ogGrubSecurity

parser = argparse.ArgumentParser (add_help=False)
parser.add_argument ('disk')
parser.add_argument ('par')
parser.add_argument ('user', nargs='?', default='root')
parser.add_argument ('passwd', nargs='?', default='')

if 2 == len (sys.argv) and 'help' == sys.argv[1]:
    #parser.print_help() sale en inglés aunque la locale indique otra cosa
    ogHelp ('ogGrubSecurity', 'ogGrubSecurity int_ndiskSecondStage int_partitionSecondStage  [USER] [PASSWORD]', ['ogGrubSecurity 1 1', 'ogGrubSecurity 1 2 user clave'])
    sys.exit (0)

args = parser.parse_args()
ret = ogGrubSecurity (args.disk, args.par, args.user, args.passwd)

if ret is not None:
    if   ret == True: sys.exit (0)
    elif ret == False: sys.exit (1)
    else: print (ret)
