From bca8be69c81c5c873f3abadc997ec99fcb4092ad Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Thu, 17 Nov 2016 19:31:01 +0000 Subject: [PATCH] Convenience tool to set the onie-boot-mode and reboot once into onie. --- .../src/bin/onl-onie-boot-mode | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 packages/base/all/vendor-config-onl/src/bin/onl-onie-boot-mode diff --git a/packages/base/all/vendor-config-onl/src/bin/onl-onie-boot-mode b/packages/base/all/vendor-config-onl/src/bin/onl-onie-boot-mode new file mode 100755 index 00000000..a8283a2d --- /dev/null +++ b/packages/base/all/vendor-config-onl/src/bin/onl-onie-boot-mode @@ -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 + + + + + + + + +