[RELEASE] Reboot2oOS - Reboot once to another OS.

  Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
teeedubb Offline
Donor
Posts: 2,525
Joined: Mar 2010
Reputation: 61
Location: Down Under
Post: #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 ubuntu 12.04/GRUB 1.99 + 13.10/2.00, but it will probably work with any distro that uses GRUB. Changes/updates to GRUB can break this addon. 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\resources\reboot2oos.sh
Code:
GRUB_DEFAULT=
GRUB_REBOOT=
The numbers following the above options correspond to your GRUB menu entries and they start from 0, so in the included file my GRUB_DEFAULT= entry (6) is the main OS (Ubuntu) and is the 7th entry in the GRUB menu. GRUB_REBOOT=, the OS I wish to reboot once into (5) is the 6th GRUB menu entry.

From your Ubuntu install (Or whatever OS you choose to use for GRUB) you need to 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, update GRUB, set the default boot entry and test it out:
Code:
chmod +x ~/.xbmc/addons/script.reboot2oos/reboot2oos.sh
sudo update-grub
sudo grub-set-default 6 #change number to Ubuntu (or primary boot choice) GRUB menu entry number
sudo reboot

You should now be back in Ubuntu (or what ever GRUB entry you selected as default). Now select 'Games' under Programs to use the addon and reboot once to the OS of your choice.

DOWNLOAD v 0.1.8

My Add-ons, only available for XBMC:
Steam Launcher|Music Party Mode|Reboot2oOS|Triple J Radio
(This post was last modified: 2013-12-31 08:03 by teeedubb.)
find quote
bam80 Offline
Junior Member
Posts: 18
Joined: Dec 2011
Reputation: 0
Post: #2
Coool!
I wish that Chromium OS has Reboot button now Wink
find quote
phear Offline
Member
Posts: 70
Joined: Oct 2010
Reputation: 1
Post: #3
This is great.

Using hyperspin in windows for games and Ubuntu for xbmc.
So this is perfect and will test tonight.
find quote
teeedubb Offline
Donor
Posts: 2,525
Joined: Mar 2010
Reputation: 61
Location: Down Under
Post: #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:

Code:
#!/bin/bash
REBOOT_TO="osprober-chain-6A6C4AD16C4A9829" #win7
DEFAULT_OS="gnulinux-simple-5c99d0a0-eb2f-456c-b8f3-51a6037d2850" #ubuntu, shold be 1st entry

###

GRUB_DEFAULT=$(sed -n '/menuentry/s/.*\(["'\''].*["'\'']\).*/\1/p' /boot/grub/grub.cfg |grep -F "$DEFAULT_OS" | tail -n1 |cut -c2- | rev | cut -c2- | rev)
MENU_ENTRY=$(sed -n '/menuentry/s/.*\(["'\''].*["'\'']\).*/\1/p' /boot/grub/grub.cfg |grep -F "$REBOOT_TO" | tail -n1 |cut -c2- | rev | cut -c2- | rev)
echo grub-default $GRUB_DEFAULT
echo menu-entry $MENU_ENTRY
sudo grub-set-default $GRUB_DEFAULT
sudo grub-reboot $MENU_ENTRY
sudo reboot

Line 2 + 3 need to be edited to suit your system. To get a compatible list of os's to reboot to, use the command

Code:
sed -n '/menuentry/s/.*\(["'\''].*["'\'']\).*/\1/p' /boot/grub/grub.cfg

My Add-ons, only available for XBMC:
Steam Launcher|Music Party Mode|Reboot2oOS|Triple J Radio
(This post was last modified: 2014-08-09 23:05 by teeedubb.)
find quote
tripkip Offline
Fan
Posts: 422
Joined: Aug 2010
Reputation: 2
Location: Belgium
Post: #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.

[Image: all-thin-banner.jpg]


find quote
teeedubb Offline
Donor
Posts: 2,525
Joined: Mar 2010
Reputation: 61
Location: Down Under
Post: #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

My Add-ons, only available for XBMC:
Steam Launcher|Music Party Mode|Reboot2oOS|Triple J Radio
find quote