Package: nvram-wakeup
Severity: wishlist
Tags: patch

hi, I prepared some code for grub2. It helps (a lot) people that need to
reboot the machine to set up the RTC alarm in their motherboard. (Note that
the instructions that are provided in the README.reboot file are useless for
people using grub2 ).

The end result is that there is a new menu voice in the grub2 boot, on
bottom, that will immediately halt the machine; this menu is autoselected
if the command 
'/usr/bin/grub-editenv /boot/grub/grubenv set nvram_halt_once=1'
is run before reboot; this autoselection happens only
once, that is, when you then boot the machine, the usual menu is selected
(whatever "usual" means to you).

What follows is tested in Debian squeeze: the attached file is to be saved in
/etc/grub.d/50_nvram_wakeup and then 'update-grub' so that the file
/boot/grub/grub.cfg is regenerated to contain the new menu voice . That's
all folks.

I suggest that this script be put somewhere in the nvram-wakeup
package; and these instructions may go in a file such as
 /usr/share/doc/nvram-wakeup/README_grub2_reboot-halt

 ---

I use the above method in my Freevo box, that now is in a PC with a
 mobo that needs a reboot. In /etc/freevo/local_conf.py, I set

AUTOSHUTDOWN_BIOS_NEEDS_REBOOT=True
AUTOSHUTDOWN_BOOT_LOADER = "GRUB"
AUTOSHUTDOWN_GRUB_CMD = "/usr/bin/grub-editenv /boot/grub/grubenv set 
nvram_halt_once=1"

(the above assumes that the user running freevo can also edit the file
/boot/grub/grubenv , so in some setups 'sudo' may be used)

Bye, and thanks. a.
#!/bin/sh
exec tail -n +3 $0
# This is an utility for the nvram-wakeup package.  nvram-wakeup
# programs the alarm of the RTC (Real Time Clock, a clock in the
# motherboard) so that the system will power up at a certain hour.
# This menu method provides an easy way to halt the system at reboot,
# once.  This is needed by nvram-wakeup on certain motherboard, where,
# for the changes to take effect, you need to restart (not halt) the
# computer and wait until the BIOS runs (don't need to enter the BIOS
# setup).
menuentry "Halt once (for setting alarm)" {
  halt
}
if [ ${nvram_halt_once} ] ; then
  set nvram_halt_once=
  save_env nvram_halt_once
  set default="Halt once (for setting alarm)"
fi

Reply via email to