[RELEASE] Reboot2oOS - Reboot once to another OS.
#1
This addon will reboot your linux pc once into another OS of your choice then boot back into linux. It uses GRUB so a working multi-boot setup with GRUB is required. It has been tested with GRUB 1.99 + 2.00, but it will probably work with any distro that uses GRUB. Manual editing of system files and files contained within the addon zip is required to get this addon working (edit icon.png preferably before installation):

script.reboot2oos\addon.xml
Code:
name=
Edit the name= tag to your liking. I currently have it named Games because I reboot into windows to play games and emulators.

script.reboot2oos\default.py
Code:
if dialog.yesno("Reboot to windows...", "XBMC needs to reboot for Games"):
This is the message that is contained in the Yes/No dialog

script.reboot2oos\icon.png
The addon icon can be changed based on your needs. It is currently a Atari 2600 joystick as I reboot into windows to play games.

script.reboot2oos\reboot2oos.sh
Code:
REBOOT_TO=
DEFAULT_OS=
The entries following the above options correspond to your GRUB menu entries - REBOOT_TO= is the OS you want to reboot once to, DEFAULT_OS= is your default OS.
You can get a listing of OS's recognised by GRUB with the following command:
Code:
sed -n '/menuentry/s/.*\(["'\''].*["'\'']\).*/\1/p' /boot/grub/grub.cfg


After installing the addon edit /etc/default/grub and change the line
Code:
GRUB_DEFAULT=
to
Code:
GRUB_DEFAULT=saved
then exit and now you need to edit the sudoers file so the commands that require root can run without a password:
Code:
sudo visudo
At the end of the file after #includedir /etc/sudoers.d add (note you need to edit the username, mine is xbmc):
Code:
%xbmc ALL = NOPASSWD: /sbin/reboot, /usr/sbin/grub-set-default, /usr/sbin/grub-reboot

Now time to make the reboot2oos.sh script executable and update GRUB:
Code:
chmod +x ~/.xbmc/addons/script.reboot2oos/reboot2oos.sh
sudo update-grub

Now select 'Games' under Programs to use the addon and reboot once to the OS of your choice.

DOWNLOAD
Reply
#2
Coool!
I wish that Chromium OS has Reboot button now Wink
Reply
#3
This is great.

Using hyperspin in windows for games and Ubuntu for xbmc.
So this is perfect and will test tonight.
Reply
#4
Here is a new version of resboot2oos.sh that Ive been using, which should make os selection more robust - it uses disks uuid's + other info to select the os to reboot to, instead of the grub menu order, so it should still work after changes to the menu order. Replace the entire contents of the file with:

EDIT: script now in addon
Reply
#5
Hi teeedubb,

Thanks for the tip on the OpenELEC forums on your Reboot2oOS addon.
If I understand it correctly, this will not change the default grub entry? (Because I want OE to stay as my default OS and switch to Win8 with this addon, thus after reboot come back into OE automatically.
Platforms: macOS - iOS - OSMC
co-author: Red Bull TV add-on
Reply
#6
It sets the default boot device each time it runs and it can be set to any grub entry For oe you need this version
http://openelec.tv/forum/128-addons/6235...another-os
Reply
#7
Hi,

do you also have this new version available for Ubuntu XBMC?

I used 0.1.8 before, but now using 14.04LTS this is not working any more.

Thanks Nimanic
Reply
#8
The current version should still work with 14.04, although I have been using the script above for a while now which is more robust. Try with that one and post the output of when you run the reboot2oos.sh script from the command line (comment out the 'sudo reboot' line to prevent reboots while testing).
Reply
#9
Updated addon in first post to include new reboot2oos.sh script, plus cleaned up included docs.
Reply
#10
Hi,

form the consol the script is working and restarting the PC.

Out of XBMC the script fails (little window bottom right), but a video which is runing is stoped.

My system is a fresh installed XBMCUbuntu 13.2 based on 14.0LTS.

any idea what i might have missed?
Reply
#11
Did you make the script executable?

chmod +x ~/.xbmc/addons/script.reboot2oos/reboot2oos.sh

If that doesn't work post your xbmc.log file of when the error occurs.
Reply
#12
Hi,
I downloaded your addon, and had a look at the reboot script.
I have a few comments based on my own experience, and about what I read from this blog
http://askubuntu.com/questions/18170/how...rom-ubuntu
as well as from reading Grub2 documentation.

At first, if you simply change /etc/default/grub as you suggest
GRUB_DEFAULT=0 and modify it to GRUB_DEFAULT=saved
this doesn't mean that Grub will boot from the last saved entry.

Saving an OS can be achieved by running sudo grub-set-default if GRUB_DEFAULT=saved is set in /etc/default/grub. It may also be saved if GRUB_SAVEDEFAULT=true is also set in /etc/default/grub. In this case, the default OS remains until a new OS is manually selected from the GRUB 2 menu or the grub-set-default command is executed.

Otherwise, if you simply set GRUB_DEFAULT=saved and issue a command grub-reboot x
the entry x will be used once only, then the next time grub will reboot the default entry.

This makes the script much simpler, and you don't need to give grub-set-default the possibility to run as root.

What I did with my script was to search for the windows entry in /boot/grub/grub.cfg
by using the command
grep -i 'windows' /boot/grub/grub.cfg|cut -d"'" -f2
this gives you a string like
Windows 7 (loader) (on /dev/sda1)
then I wrote my script as
#!/bin/bash
sudo grub-reboot "Windows 7 (loader) (on /dev/sda1)"
sudo reboot


It works for me, I'm willing to try my script within your addon.
Reply
#13
Hi,
I tried and it works perfect with the following:
1. Install your app

2. Apply the changes as you describe apart from vi visudo that is going to be
Code:
%xbmc ALL = NOPASSWD: /sbin/reboot, /usr/sbin/grub-reboot

3. Replace reboot2oos.sh that you provide with mine
Code:
#!/bin/bash
sudo grub-reboot "Windows 7 (loader) (on /dev/sda1)"
sudo reboot
where the string is obtained by issuing the command
Code:
grep -i 'windows' /boot/grub/grub.cfg|cut -d"'" -f2

Thanks for the great job!
Reply
#14
Cool glad you got it working. The DEFAULT_OS entry isnt necessary, though I think I left it in there as a precautionary measure - it doesnt hurt, plus its been a few years since I set this up, there might have been another reason too.
Reply
#15
V0.3.0 in First post:

default.py is now helix compatible - back up your old script as it can be used with this version - They WILL be overwritten with this update.
Reply

Logout Mark Read Team Forum Stats Members Help
[RELEASE] Reboot2oOS - Reboot once to another OS.2