From: Jesse Keating Date: Fri, 1 Jun 2012 01:41:25 +0000 (-0700) Subject: Don't set an already set attribute (#826357) X-Git-Tag: 019~12 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e82e54df2c7579efac722556b612b81fd19a3e5f;p=thirdparty%2Fdracut.git Don't set an already set attribute (#826357) Depending on how the dasd_mod module was loaded, our device could have already been marked as online or offline. We need to make the sysecho sensitive to this and not fail if the attribute we're trying to set has already been set. --- diff --git a/modules.d/80cms/cmssetup.sh b/modules.d/80cms/cmssetup.sh index 995bfa7aa..41c853cb6 100755 --- a/modules.d/80cms/cmssetup.sh +++ b/modules.d/80cms/cmssetup.sh @@ -5,7 +5,7 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh function sysecho () { - file=$1 + file="$1" shift local i=1 while [ $i -le 10 ] ; do @@ -16,7 +16,11 @@ function sysecho () { break fi done - [ -f "$file" ] && echo $* > $file + local status + read status < "$file" + if [[ ! $status == $* ]]; then + [ -f "$file" ] && echo $* > "$file" + fi } function dasd_settle() {