Oops... the above is not a good one, should be [0-9], however, if selinux=0 is assigned in bootparam, upstart will go wrong.
Therefore maybe make it like:
------
start on rcS/stop
script
runlevel --reboot || true
if grep -q -w -- "-s\|single\|S" /proc/cmdline; then
telinit S
elif grep -qE -- "[[:space:]]+[0-9][[:space:]]+" /proc/cmdline; then RL="$(grep -Eo -- "[[:space:]]+[0-9][[:space:]]+" /proc/cmdline)"
if [ -n "$RL" ]; then telinit $RL
else telinit 2
fi
elif [ -r /etc/inittab ]; then RL="$(sed -n -e "/^id:[0-9]*:initdefault:/{s/^id://;s/:.*//;p}" /etc
/inittab || true)"
if [ -n "$RL" ]; then telinit $RL
else telinit 2
fi
else
telinit 2
fi
end script
-------------
I bet you have better solution about this.
Oops... the above is not a good one, should be [0-9], however, if selinux=0 is assigned in bootparam, upstart will go wrong.
Therefore maybe make it like:
------
start on rcS/stop
script
runlevel --reboot || true
if grep -q -w -- "-s\|single\|S" /proc/cmdline; then ]]+[0-9] [[:space: ]]+" /proc/cmdline; then
RL= "$(grep -Eo -- "[[:space: ]]+[0-9] [[:space: ]]+" /proc/cmdline)"
telinit $RL
telinit 2
RL= "$(sed -n -e "/^id:[ 0-9]*:initdefau lt:/{s/ ^id://; s/:.*// ;p}" /etc
telinit $RL
telinit 2
telinit S
elif grep -qE -- "[[:space:
if [ -n "$RL" ]; then
else
fi
elif [ -r /etc/inittab ]; then
/inittab || true)"
if [ -n "$RL" ]; then
else
fi
else
telinit 2
fi
end script
-------------
I bet you have better solution about this.