Simple script to list grub os's and boot one.
Posted
#1
(In Topic #882)
Guru

It reads grub.cfg and gets the main entries then lists them.
Double click an os to have it as the next boot os. then after rebooting out of that os it reverts to the default.
Note.
/etc/default/grub file MUST have the default line set to "saved" like this…
GRUB_DEFAULT=saved
if you changed the default to saved from something else then you have to run update-grub
then save this script somewhere, set it's exe flag and launch it.
Code (gambas)
- ' Gambas script file
- Use "gb.gui"
- Use "gb.desktop"
- .Title = "Select OS to boot next boot"
- .Arrangement = Arrange.Vertical
- .Foreground = Color.Magenta
- aLines = GetMainEntries()
- lList.Background = Color.SetAlpha(Color.Cyan, 220)
- .Text = "Reboot after setting. (no confirmation)"
- fForm.Show
- fForm.Hide()
- Shell "reboot"
- Inc iDepth
- Dec iDepth
- Idepth = 0
- bInSub = True
- Return sEntries
1 guest and 0 members have just viewed this.



