mirror of
https://github.com/Telecominfraproject/OpenNetworkLinux.git
synced 2025-12-26 01:37:04 +00:00
Convenience tool to set the onie-boot-mode and reboot once into onie.
This commit is contained in:
34
packages/base/all/vendor-config-onl/src/bin/onl-onie-boot-mode
Executable file
34
packages/base/all/vendor-config-onl/src/bin/onl-onie-boot-mode
Executable 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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user