On 08/24/2011 12:35 AM, Gerardo Exequiel Pozzi wrote:
Hello,

I am testing this for archiso (I think will help me for dm-snapshot persistent). I am writing custom shutdown hooks that fit for archiso. Anyway, /run is mounted as noexec. This should be changed ;)

:: Creating shutdown ramfs...chroot: can't execute '/bin/busybox': Permission denied

all rest of things will fail ;)

http://mailman.archlinux.org/pipermail/arch-projects/2011-July/001549.html


Another thing is the last code about halt/poweroff/reboot.

# reboot / poweroff / halt, depending on the argument passed by init
# if something invalid is passed, we halt
case "$1" in
  reboot|poweroff|halt) "$1" -f ;;
  *) halt -f;;
esac

$1 is undefined here, so always go to halt -f. why not take decision from $RUNLEVEL?, this variable is defined at this stage.

like in rc.shutdown:

if [[ $RUNLEVEL == 0 ]]; then
    poweroff -f
else
    reboot -f
fi

And we need to use poweroff and not halt, it just stop the system without calling acpi_poweroff().
-- 
Gerardo Exequiel Pozzi
\cos^2\alpha + \sin^2\alpha = 1