Hi Gerardo, On Thu, Aug 25, 2011 at 7:37 AM, Gerardo Exequiel Pozzi <[email protected]> wrote: > 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.
Ah, you are ahead of me ;-) I have a patch against initscripts that passes the correct value, but I have not been able to test it properly yet so have not pushed it. I'll do it today. > like in rc.shutdown: > > if [[ $RUNLEVEL == 0 ]]; then > poweroff -f > else > reboot -f > fi The only reason it's done with $1 rather than $RUNLEVEL is that I wanted to implement the same interface as systemd/dracut. I guess we could have fallen back to checking $RUNLEVEL, but (once my patch to initscripts is in) having $1 not defined means that something is very wrong, so I thought halting was a nice way to show that. /me starts testing some patches ;-) Cheers, Tom
