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

Discuss all artwork and development - Suggestions needed

Moderator: Moderators

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

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

Post by beli0135 » Fri Oct 22, 2010 12:50

There is a neat thing that openSUSE does and Sabayon don't, and I really miss it.

On shutdown menu, there are options on shutdown button, however, there are not options on restart button. OpenSUSE let you choose in which of GRUB's item you wish to boot.
So now, if I wish to load another OS or different kernel, I need to restard and wait beside computer so I can choose what I want from GRUB menu.

That option will let me make a coffee or get 2 spoons of sabayon ,meanwhile :)
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 » Mon Oct 25, 2010 12:38

Hmm... I wonder if the grub-set-default command could be used to achieve this functionality. You could knock up a Bash script to be launched by a Desktop Config File with an icon on your Desktop or Panel. You could include in the Bash script a simple menu listing the distributions installed on your HDD and prompt the user for the one (s)he wants to boot, whereupon the script would issue the command sudo grub-set-default <n> followed by a reboot now command.

Alternatively, you could just use KRunner (Alt-F2) to enter the command sudo grub-set-default <n> (where <n> is the entry in your Grub2 menu) and then reboot using the GUI.

You'd need to configure /etc/default/grub and run grub-mkconfig as explained on the aforementioned Web page to be able to do what I describe, but after that it would be routine.

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 Oct 25, 2010 13:26

Listing should be included by default in restart menu. There is no point doing it manually, as it is faster to sit that 50-90 sec beside computer.
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 » Mon Oct 25, 2010 16:59

As an exercise for my own satisfaction, the following is a quick and dirty way to do it. I haven't tested it because the shutdown and reboot commands stopped working on my laptop a couple of months ago for some reason, but the theory behind it should be correct, albeit the Bash script may need tweaking.

A. Setting it all up:

The example below assumes I have four entries in my Grub2 menu. The script can be modified easily according to my actual Grub2 menu.

1. Create the simple Bash script shown below in my home directory. I'll call the script reboot.sh for example:

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/grub2-set-default 1
          sudo shutdown -r now
          ;;
      "Sabayon_Safe_Mode")
          echo "Rebooting to Sabayon Safe Mode"
          sudo /sbin/grub2-set-default 2
          sudo shutdown -r now
          ;;
      "Windows_Recovery")
          echo "Rebooting to Windows 7 Factory Restore Partition"
          sudo /sbin/grub2-set-default 3
          sudo shutdown -r now
          ;;
      "Windows")
          echo "Rebooting to Windows 7"
          sudo /sbin/grub2-set-default 4
          sudo shutdown -r now
          ;;
      "Shutdown")
          echo "Shutting down"
          sudo shutdown -h now
          ;;
      "Cancel")
          echo "Cancel"
          exit
          ;;
  esac
done
2. Make the script executable:

Code: Select all

$ chmod +x ~/reboot.sh
3. Create an icon (Desktop Config File) on my Desktop (right-click on the Desktop and select Create New > Link to Application...), configure it to execute the command sh reboot.sh in a terminal, and give it a nice icon (the default shutdown icon shown below would suffice). I'll drag it onto my Panel so it's always visible and only needs a single click to activate.

Image

4. Edit the file /etc/default/grub to have GRUB_DEFAULT=saved and GRUB_SAVEDEFAULT=true (if it is not already like that).

5. Regenerate /boot/grub/grub.cfg (this would only be necessary if I changed anything in /etc/default/grub):

Code: Select all

# grub-mkconfig -o /boot/grub/grub.cfg

B. How to use it:

1. Click on the new icon on my Panel.

2. Upon being presented with the following menu:

Code: Select all

1) Sabayon
2) Sabayon_Safe_Mode
3) Windows_Recovery
4) Windows
5) Shutdown
6) Cancel
enter the number of the menu item I want and press Enter.

3. Enter my password when prompted. (If I had wanted to, I could have configured Linux to not require a password for this.)

The PC should reboot to the Grub2 menu item I selected (1 to 4), or shut down the PC if I selected that option (5) or exit the script and do nothing if I selected the Cancel option (6).

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 Oct 25, 2010 17:07

WOW... you are surely determined guy.

Will try your script, to my satisfction, but as I continue to claim: that was suggestion for Sabayon team to make it in next release of their KDE4, or even now, if they wish.
It's such a convinient thing...

Many openSUSE lovers (including myself), loves openSUSE just because it's developers pay attention to small details and polish whatever they can to max of possibilities. Since Sabayon is ment to be polished Gentoo, well.. I suggest that, besides this thing, search how they can make system more fancy. As fancy it is anyways. Just make it more fancy.

(please, dont be like Apple in "fancy", I didn't mean exactly that, lolz)
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 » Mon Oct 25, 2010 17:12

Not determined, just curious and enjoying a 'puzzle'.

I know it was your suggestion to the SL developers. The best way of doing that is to post your request in the SL Bugzilla (see the link 'Bugs' at the top of the page). One of the options available in the SL Bugzilla is to suggest an addition or enhancement to the OS. lxnay will either agree to it, or not. In the latter case, you'll find out via a comment in the 'bug' report.

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 9:28

Just for information:

As I have now found a solution to my problem of the shutdown and reboot commands not working (see Linux freezes when using reboot or shutdown command [Solved]) I have now been able to try out the 'quick-and-dirty' method of providing a menu for rebooting to a specific Grub2 menu entry that I gave in my post of 25 Oct. 2010. Basically it works. I just needed to make a tweak to my example Bash script due to the fact that the menu entry number n in the command grub2-set-default <n> starts from zero, not one:

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/grub2-set-default 0
          sudo shutdown -r now
          ;;
      "Sabayon_Safe_Mode")
          echo "Rebooting to Sabayon Safe Mode"
          sudo /sbin/grub2-set-default 1
          sudo shutdown -r now
          ;;
      "Windows_Recovery")
          echo "Rebooting to Windows 7 Factory Restore Partition"
          sudo /sbin/grub2-set-default 2
          sudo shutdown -r now
          ;;
      "Windows")
          echo "Rebooting to Windows 7"
          sudo /sbin/grub2-set-default 3
          sudo shutdown -r now
          ;;
      "Shutdown")
          echo "Shutting down"
          sudo shutdown -h now
          ;;
      "Cancel")
          echo "Cancel"
          exit
          ;;
  esac
done

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 » Sun Nov 07, 2010 19:16

Please dont be offended, but I dont like the solution. You set default of grub menu, then reboot it normally.
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)
Pitty that I am totally out of time to investigate this.
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 Nov 07, 2010 20:51

Don't worry: absolutely no offence taken. Just recording it for my own interest and the possible interest of others who might be browsing or googling. I already realised that it's not of interest to you.

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 » Sun Nov 07, 2010 21:30

Yes, thanks. I really want it to be in KDE menu, as it will benefit sabayon more. Its handy.
Emil Beli
Blog: http://www.beli.ws/blog/

Post Reply