There is something I really miss in Sabayon (in KDE4)

Discuss all artwork and development - Suggestions needed

Moderator: Moderators

User avatar
Fitzcarraldo
Sagely Hen
Posts: 8186
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom
Contact:

Re: There is something I really miss in Sabayon (in KDE4)

Post by Fitzcarraldo » Sun Nov 07, 2010 23:10

beli0135 wrote:I know I have seen a grub command for direct entry, just forgot where and which. I also know it works like a flag (probably with file which is deleted automaticly)
You are probably thinking of the Grub Legacy command grubonce:

Code: Select all

grubonce <n>
Its Grub2 equivalent is grub-reboot:

Code: Select all

grub-reboot <n>
In that case the quick-and-dirty example script would be:

Code: Select all

#!/bin/bash
select CHOICE in Sabayon Sabayon_Safe_Mode Windows_Recovery Windows Shutdown Cancel
do
  case "$CHOICE" in
      "Sabayon")
          echo "Rebooting to Sabayon"
          sudo /sbin/grub-reboot 0
          sudo shutdown -r now
          ;;
      "Sabayon_Safe_Mode")
          echo "Rebooting to Sabayon Safe Mode"
          sudo /sbin/grub-reboot 1
          sudo shutdown -r now
          ;;
      "Windows_Recovery")
          echo "Rebooting to Windows 7 Factory Restore Partition"
          sudo /sbin/grub-reboot 2
          sudo shutdown -r now
          ;;
      "Windows")
          echo "Rebooting to Windows 7"
          sudo /sbin/grub-reboot 3
          sudo shutdown -r now
          ;;
      "Shutdown")
          echo "Shutting down"
          sudo shutdown -h now
          ;;
      "Cancel")
          echo "Cancel"
          exit
          ;;
  esac
done
Unlike grubonce, grub-reboot does not display the list of OSs if run without a parameter. However the Grub2 developer Colin Watson made grub-reboot accept an OS name to make it easier: grub-reboot needs to display name of operating system that will be booted.

beli0135
Simple Hen
Posts: 72
Joined: Tue Aug 22, 2006 17:37
Location: Belgrade
Contact:

Re: There is something I really miss in Sabayon (in KDE4)

Post by beli0135 » Mon Nov 08, 2010 12:29

Oh yes, That might do!
Thanks!
Emil Beli
Blog: http://www.beli.ws/blog/

User avatar
Fitzcarraldo
Sagely Hen
Posts: 8186
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom
Contact:

Re: There is something I really miss in Sabayon (in KDE4)

Post by Fitzcarraldo » Sat Nov 13, 2010 13:04

Having the Grub2 menu entries hard-coded in the Bash script was bugging me. Here is a much better script to do the job:

Code: Select all

#!/bin/bash
echo
echo "== SELECT WHICH OS TO BOOT =="
echo
sudo mount /dev/sda3 /boot &>/dev/null # Remove this line if you do not have a separate boot partition.
echo
sudo cat /boot/grub/grub.cfg | grep menuentry | awk -F\" '{print N++,$(NF-1)}'
echo
read -p "Enter number (q to abort) and press ENTER: " CHOICE
if [ "$CHOICE" != "q" ] ; then
  sudo grub-reboot $CHOICE
  sudo shutdown -r now
fi
In this script, the Grub2 menu entries are read directly from the grub.cfg file instead of being hard-coded in the script. Therefore this script would work as-is on anyone's installation. Here's what it outputs on my laptop, for example:

Code: Select all


== SELECT WHICH OS TO BOOT ==

Password: 

0 Sabayon GNU/Linux, with Linux x86_64-2.6.36-sabayon
1 Sabayon GNU/Linux, with Linux x86_64-2.6.36-sabayon (recovery mode)
2 Sabayon GNU/Linux, with Linux x86_64-2.6.35-sabayon
3 Sabayon GNU/Linux, with Linux x86_64-2.6.35-sabayon (recovery mode)
4 Windows 7 (loader) (on /dev/sda1)
5 Windows 7 (loader) (on /dev/sda2)

Enter number (q to abort) and press ENTER: 

beli0135
Simple Hen
Posts: 72
Joined: Tue Aug 22, 2006 17:37
Location: Belgrade
Contact:

Re: There is something I really miss in Sabayon (in KDE4)

Post by beli0135 » Sat Nov 13, 2010 15:53

Yea... now it's complete.
Emil Beli
Blog: http://www.beli.ws/blog/

User avatar
Fitzcarraldo
Sagely Hen
Posts: 8186
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom
Contact:

Re: There is something I really miss in Sabayon (in KDE4)

Post by Fitzcarraldo » Sun Apr 24, 2011 13:24

Ha! Just a week after I posted in my blog about how to do this (see Reboot button which allows you to specify which GRUB 2 menu entry to boot) I today discovered that a GUI feature to do this will be added in KDE 4.7 when it is released: Hello planet (?) and GRUB2 Support for KDM.

Thev00d00
Generally Awesome (tm)
Posts: 1472
Joined: Wed Feb 21, 2007 15:52
Location: United Kingdom
Contact:

Re: There is something I really miss in Sabayon (in KDE4)

Post by Thev00d00 » Mon Apr 25, 2011 21:56

This will be of much interest to you chaps.

http://www.phoronix.com/scan.php?page=n ... &px=OTM2OA
Image
Please report Bugs on the Bugzilla, not forum
Please Adopt an Unanswered thread
Website / Blog : v00d00.net
twitter: Follow Me
G+: Circle Me

User avatar
Fitzcarraldo
Sagely Hen
Posts: 8186
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom
Contact:

Re: There is something I really miss in Sabayon (in KDE4)

Post by Fitzcarraldo » Mon Apr 25, 2011 22:06

Thev00d00 wrote:This will be of much interest to you chaps.

http://www.phoronix.com/scan.php?page=n ... &px=OTM2OA
I cut out the middle man: that Phoronix article links to the blog post I linked to earlier: Hello planet (?) and GRUB2 Support for KDM. :wink:

Post Reply