HOWTO: reboot to Windows with one click
This is for anyone who dual boots Fedora and Windows. Since Fedora is my default in GRUB, when I need to reboot into Windows I normally have to wait for the GRUB menu to come up so I can select Windows. I wanted a command that would let me do this directly from Fedora. And since I couldn't find one, I wrote this. Now I have an icon on the Gnome panel that lets me boot to Windows in one click, while leaving the default boot as Fedora.
If you want to try it, here's how: *disclaimer* -- I've run this on my box without problems. It doesn't do anything super smart to tell Gnome to shut down nicely, so make sure you save open files before you run it. Don't sue me, I'm already broke.*/disclaimer* bootdos - the main program Below is the python code for the bootdos program. You'll need to be root (or use sudo) to install it: $ sudo mv bootdos /usr/local/sbin/bootdos $ sudo chmod 0755 /usr/local/sbin/bootdos Code:
#!/usr/bin/python $ sudo /usr/local/sbin/bootdos Configuring PAM The next steps allow us to run the program without using sudo. This is good because we want out clicky icon to run without asking for a password. It's a little complicated to set up, but makes it easy to use. Cut-and-paste the following code to a temp file named 'xx': Code:
USER=<user> $ sudo mv xx /etc/security/console.apps/bootdos $ chmod 0644 /etc/security/console.apps/bootdos Now paste this chunk to another temp file, say 'yy': Code:
#%PAM-1.0 $ sudo chmod 0644 /etc/pam.d/bootdos $ sudo ln -s /usr/bin/consolehelper /usr/local/bin/bootdos Now when we run /usr/local/bin/bootdos as a normal user it will call consolehelper to run /usr/local/sbin/bootdos as root. Phew. (Type 'man consolehelper' to understand more about how this works.) You have these things installed so far: /usr/local/sbin/bootdos -- the main program /usr/local/bin/bootdos -- symlink to consolehelper /etc/security/console.apps/bootdos -- tells consolehelper where the main program is /etc/pam.d/bootdos -- tells PAM to give us root permissions when we run bootdos Last step - make the clicky icon 1) right-click on an empty area of the gnome panel. Doesn't matter where, you can move it later. 2) A menu should appear, select Add to Panel->Launcher... Now in the Create Launcher dialog, 3) Fill in the name field with something like "Boot to Windows" 4) Fill in the command field with: /usr/local/bin/bootdos 5) Click the "No Icon" after the Icon field to browse for an icon. Pick what you like, and OK. 6) Click OK back on the Create Launcher dialog. You're done. You now have a one-click boot-to-windows button. W00t! PS - if you find out there's already some super-easy pre-fabricated way to do all this don't tell me. ;) |
Very cool jspaar! I will try that when I get home tonight. I always hate sitting through reboots.
|
jspaar
Did you know there's already some super-easy pre-fabricated way to do all this? :D No really, it's called rebootin, and it's a perl script that reboots your computer and allows you to select what to boot into on the next boot. |
Quote:
Actually that's pretty cool bash. :p I decided to add the ability to select the next boot as well. It's gui-based instead of command line. [I was going to learn pygtk in order to do it, but zenity saved the day. Zenity's only annoyance is that you have to click the radio buttons, not the title names.] So here's the latest version, for fools like me who don't already have "rebootin": Code:
#!/usr/bin/python |
Here's a slightly updated version. You can specify the default Grub title choice on the command line (or properties page of the panel launcher).
The default title can be a Python regular expression. If you don't put one on the command line, the first non-Fedora title will be selected using this expression: "(?!.*Fedora)". So if you have only Fedora and Windows installed, Windows will be the default selection for your next boot. Code:
#!/usr/bin/python |
This is great jspaar.
I tried it and it works fine. Request: Could you please add the the option to shutdown: Code:
shutdown -h now Thank you very much. Masoud |
Quote:
I'll have to think about adding the shutdown option when I get some time. It wouldn't be complicated. Of course, now that suspend works on my desktop, I hardly ever shutdown anymore :p . For now you could add the shutdown menu to your panel - right click in an empty area of the panel, choose "Add to Panel...", scroll down to "Shut Down" and click. HTH. |
Quote:
I will try that, I do not remeber seeing "Shut Down" on "Add to Panel..." I use FC5. I have seen logout in the menus but not Shutdown. I start Gnome via startx. Anyway thanks for considering that. Masoud. |
jspaar, I installed the RPM you made available at dcheng(dot)members(dot)sonic(dot)net (I'm not able to write URLs here yet) onto my Fedora Core 6 workstation. Thanks for the utility; my USB keyboard doesn't (and will never) work in my GRUB menu, so this is a godsend when it comes to multi-booting.
It didn't work at first. Running bootnext as a non-root user came up with, Quote:
Code:
#%PAM-1.0 jspaar, I intended to send this directly to you, but you seem to have no public contact details. (: |
Brianetta,
Can you tell me what version of bootnext you have installed? You can check like this: Code:
$ rpm -q bootnext Quote:
|
bootnext-0.11-1.fc6
It all works as it should (: Well, bootnext does. Shame about grub. Nothing I do gets grub to use the default mechanism properly. savedefault does nothing at boot time, and in batch mode it seems to ignore --once completely. There is no grub_set_default command, and grub studiously ignored any file called "default" even when default saved is specified. I've given up; I can't multi-boot this machine unless I hook up an additional PS/2 keyboard. |
So jspaar, did you decide against adding shutdown to your menue?
|
Quote:
But I'm curious - are you wanting to set the next boot *and* shutdown (instead of reboot)? Or are you just wishing bootnext could do a shutdown *instead* of setting the next boot? |
Quote:
I use startx to log on gnome, doing so the standard gnome menue only has logout not shutdown. Thanks for listening. |
All times are GMT -5. The time now is 10:44 PM. |