|
Harald Hoyer |
f3160a |
From 9e7f4955895c1064e3bdd03f5f781efc9b98d5d6 Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
f3160a |
From: Harald Hoyer <harald@redhat.com>
|
|
Harald Hoyer |
f3160a |
Date: Wed, 20 Jul 2011 21:12:17 +0200
|
|
Harald Hoyer |
f3160a |
Subject: [PATCH] dracut-lib.sh: fixed getargs()
|
|
Harald Hoyer |
f3160a |
|
|
Harald Hoyer |
f3160a |
if $1 has a "=<value>", we want the exact match
|
|
Harald Hoyer |
f3160a |
if cmdline argument has no "=<value>", we assume "=1"
|
|
Harald Hoyer |
f3160a |
---
|
|
Harald Hoyer |
f3160a |
modules.d/99base/dracut-lib.sh | 31 ++++++++++++++++++++++++-------
|
|
Harald Hoyer |
f3160a |
1 files changed, 24 insertions(+), 7 deletions(-)
|
|
Harald Hoyer |
f3160a |
|
|
Harald Hoyer |
f3160a |
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
|
|
Harald Hoyer |
f3160a |
index 10025bd..c2202f1 100755
|
|
Harald Hoyer |
f3160a |
--- a/modules.d/99base/dracut-lib.sh
|
|
Harald Hoyer |
f3160a |
+++ b/modules.d/99base/dracut-lib.sh
|
|
Harald Hoyer |
f3160a |
@@ -45,19 +45,36 @@ _getcmdline() {
|
|
Harald Hoyer |
f3160a |
}
|
|
Harald Hoyer |
f3160a |
|
|
Harald Hoyer |
f3160a |
_dogetarg() {
|
|
Harald Hoyer |
f3160a |
- local _o _val
|
|
Harald Hoyer |
f3160a |
+ local _o _val _doecho
|
|
Harald Hoyer |
f3160a |
unset _val
|
|
Harald Hoyer |
f3160a |
unset _o
|
|
Harald Hoyer |
f3160a |
+ unset _doecho
|
|
Harald Hoyer |
f3160a |
_getcmdline
|
|
Harald Hoyer |
f3160a |
|
|
Harald Hoyer |
f3160a |
for _o in $CMDLINE; do
|
|
Harald Hoyer |
f3160a |
- if [ "$_o" = "$1" ]; then
|
|
Harald Hoyer |
f3160a |
- return 0;
|
|
Harald Hoyer |
f3160a |
+ if [ "${_o%%=*}" = "${1%=}" ]; then
|
|
Harald Hoyer |
f3160a |
+ if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
|
|
Harald Hoyer |
f3160a |
+ # if $1 has a "=<value>", we want the exact match
|
|
Harald Hoyer |
f3160a |
+ if [ "$_o" = "$1" ]; then
|
|
Harald Hoyer |
f3160a |
+ _val="1";
|
|
Harald Hoyer |
f3160a |
+ unset _doecho
|
|
Harald Hoyer |
f3160a |
+ fi
|
|
Harald Hoyer |
f3160a |
+ continue
|
|
Harald Hoyer |
f3160a |
+ fi
|
|
Harald Hoyer |
f3160a |
+
|
|
Harald Hoyer |
f3160a |
+ if [ "${_o#*=}" = "$_o" ]; then
|
|
Harald Hoyer |
f3160a |
+ # if cmdline argument has no "=<value>", we assume "=1"
|
|
Harald Hoyer |
f3160a |
+ _val="1";
|
|
Harald Hoyer |
f3160a |
+ unset _doecho
|
|
Harald Hoyer |
f3160a |
+ continue
|
|
Harald Hoyer |
f3160a |
+ fi
|
|
Harald Hoyer |
f3160a |
+
|
|
Harald Hoyer |
f3160a |
+ _val=${_o#*=};
|
|
Harald Hoyer |
f3160a |
+ _doecho=1
|
|
Harald Hoyer |
f3160a |
fi
|
|
Harald Hoyer |
f3160a |
- [ "${_o%%=*}" = "${1%=}" ] && _val=${_o#*=};
|
|
Harald Hoyer |
f3160a |
done
|
|
Harald Hoyer |
f3160a |
if [ -n "$_val" ]; then
|
|
Harald Hoyer |
f3160a |
- echo $_val;
|
|
Harald Hoyer |
f3160a |
+ [ "x$_doecho" != "x" ] && echo $_val;
|
|
Harald Hoyer |
f3160a |
return 0;
|
|
Harald Hoyer |
f3160a |
fi
|
|
Harald Hoyer |
f3160a |
return 1;
|
|
Harald Hoyer |
f3160a |
@@ -67,13 +84,13 @@ getarg() {
|
|
Harald Hoyer |
f3160a |
set +x
|
|
Harald Hoyer |
f3160a |
while [ $# -gt 0 ]; do
|
|
Harald Hoyer |
f3160a |
case $1 in
|
|
Harald Hoyer |
f3160a |
- -y) if _dogetarg $2; then
|
|
Harald Hoyer |
f3160a |
+ -y) if _dogetarg $2 >/dev/null; then
|
|
Harald Hoyer |
f3160a |
echo 1
|
|
Harald Hoyer |
f3160a |
[ "$RD_DEBUG" = "yes" ] && set -x
|
|
Harald Hoyer |
f3160a |
return 0
|
|
Harald Hoyer |
f3160a |
fi
|
|
Harald Hoyer |
f3160a |
shift 2;;
|
|
Harald Hoyer |
f3160a |
- -n) if _dogetarg $2; then
|
|
Harald Hoyer |
f3160a |
+ -n) if _dogetarg $2 >/dev/null; then
|
|
Harald Hoyer |
f3160a |
echo 0;
|
|
Harald Hoyer |
f3160a |
[ "$RD_DEBUG" = "yes" ] && set -x
|
|
Harald Hoyer |
f3160a |
return 1
|