Convenience tool to set the onie-boot-mode and reboot once into onie.

This commit is contained in:
Jeffrey Townsend
2016-11-17 19:31:01 +00:00
parent 877fff69e0
commit bca8be69c8

View File

@@ -0,0 +1,34 @@
#!/usr/bin/python
############################################################
import sys
import platform
import argparse
import onl.grub
if platform.machine() != 'x86_64':
sys.stderr.write("This command can only be used on GRUB-based X86_64 architectures.")
sys.exit(1)
ap = argparse.ArgumentParser("onl-onie-boot-mode")
ap.add_argument("mode", choices=onl.grub.ONIE_BOOT_MODES)
ap.add_argument("--onie-only", action='store_true', help="Do not set ONIE boot menu option.")
ops = ap.parse_args()
onl.grub.onie_boot_mode_set(ops.mode)
if not ops.onie_only:
onl.grub.boot_onie()
print "The system will boot into ONIE %s mode at the next restart." % ops.mode
else:
print "Mode %s will be selected the next time the system boots into ONIE." % ops.mode