31 lines
		
	
	
		
			915 B
		
	
	
	
		
			Python
		
	
	
		
			Executable File
		
	
			
		
		
	
	
			31 lines
		
	
	
		
			915 B
		
	
	
	
		
			Python
		
	
	
		
			Executable File
		
	
#!/usr/bin/python3
 | 
						|
 | 
						|
import sys
 | 
						|
import argparse
 | 
						|
from SystemLib import ogHelp
 | 
						|
from ImageLib import ogLockImage
 | 
						|
 | 
						|
if 2 == len (sys.argv) and 'help' == sys.argv[1]:
 | 
						|
    #parser.print_help() sale en inglés aunque la locale indique otra cosa
 | 
						|
    ogHelp ('ogLockImage', 'ogLockImage [str_repo] path_image', ['ogLockImage /opt/opengnsys/images/aula1/win7.img', 'ogLockImage REPO /aula1/win7.img'])
 | 
						|
    sys.exit (0)
 | 
						|
 | 
						|
parser = argparse.ArgumentParser (add_help=False)
 | 
						|
if 2 == len (sys.argv):
 | 
						|
    parser.add_argument ('file')
 | 
						|
elif 3 == len (sys.argv):
 | 
						|
    parser.add_argument ('container')
 | 
						|
    parser.add_argument ('file')
 | 
						|
 | 
						|
args = parser.parse_args()
 | 
						|
 | 
						|
if 2 == len (sys.argv):
 | 
						|
    ret = ogLockImage (imgfile=args.file)
 | 
						|
elif 3 == len (sys.argv):
 | 
						|
    ret = ogLockImage (container=args.container, imgfile=args.file)
 | 
						|
 | 
						|
if ret is not None:
 | 
						|
    if   ret == True: sys.exit (0)
 | 
						|
    elif ret == False: sys.exit (1)
 | 
						|
    else: print (ret)
 |