script-functions: fix getbootparam/checkbootparam
authorMichael Prokop <mika@grml.org>
Sat, 25 Feb 2012 09:44:49 +0000 (10:44 +0100)
committerMichael Prokop <mika@grml.org>
Sat, 25 Feb 2012 09:44:50 +0000 (10:44 +0100)
We should get rid of this annoying stuff and make sure we
reduce it to a minimum and share what's inside grml-autoconfig.

etc/grml/script-functions

index 1786072..a39e3d8 100644 (file)
@@ -76,8 +76,9 @@ stringinstring(){
 
 # {{{ reread boot command line; echo last parameter's argument or return false.
 getbootparam(){
-  stringinstring " $1=" /proc/cmdline || return 1
-  result="${/proc/cmdline##*$1=}"
+  CMDLINE=$(cat /proc/cmdline)
+  stringinstring " $1=" "$CMDLINE" || return 1
+  result="${CMDLINE##*$1=}"
   result="${result%%[   ]*}"
   echo "$result"
   return 0
@@ -86,7 +87,7 @@ getbootparam(){
 
 # {{{ check boot commandline for specified option
 checkbootparam(){
-  stringinstring " $1" /proc/cmdline
+  stringinfile " $1" /proc/cmdline
   return "$?"
 }
 # }}}