2011-03-02 13:43:31 +01:00
|
|
|
# vim: set ft=sh:
|
|
|
|
|
2011-05-11 01:43:53 +02:00
|
|
|
# kernel_cmdline <param> <default>
|
2011-03-02 13:43:31 +01:00
|
|
|
# Looks for a parameter on the kernel's boot-time command line.
|
|
|
|
#
|
|
|
|
# returns: 0 if param was found. Also prints its value if it was a K=V param.
|
2011-05-11 01:43:53 +02:00
|
|
|
# 1 if it was not. Also prints value passed as <default>
|
2011-03-02 13:43:31 +01:00
|
|
|
#
|
|
|
|
kernel_cmdline ()
|
|
|
|
{
|
|
|
|
for param in $(/bin/cat /proc/cmdline); do
|
|
|
|
case "${param}" in
|
|
|
|
$1=*) echo "${param##*=}"; return 0 ;;
|
|
|
|
$1) return 0 ;;
|
|
|
|
*) continue ;;
|
|
|
|
esac
|
|
|
|
done
|
2011-05-11 01:43:53 +02:00
|
|
|
[ -n "${2}" ] && echo "${2}"
|
2011-03-02 13:43:31 +01:00
|
|
|
return 1
|
|
|
|
}
|