From patchwork Fri Nov 14 14:55:53 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: ybin --bootonce doesn't work Date: Fri, 14 Nov 2008 04:55:53 -0000 From: Roman Rakus X-Patchwork-Id: 22979 Message-Id: <491D9179.4020506@redhat.com> To: yaboot-devel@ozlabs.org >From bugzilla https://bugzilla.redhat.com/show_bug.cgi?id=471425 /Description From Will Woods (wwoods@redhat.com ) 2008-11-13 12:25:19 EDT/ ybin --bootonce doesn't work, for a couple of reasons: 1) It inverts the logic of a test to see if nvram is available, and 2) It assumes the output of 'nvsetenv VARNAME' will be 'VARNAME=VALUE', rather than just 'VALUE' (as it is when using the "nvram" utility). The attached patch fixes these problems and makes --bootonce work as expected. RR diff --git a/ybin/ybin b/ybin/ybin index 379b94b..bd4e8cc 100755 --- a/ybin/ybin +++ b/ybin/ybin @@ -1658,14 +1658,15 @@ checkconf || exit 1 if [ "x$bootonce" != "x" ]; then foundlabel=`sed s/\#.*// $bootconf | grep "label=$bootonce$" | wc -l` - if [ "$nonvram" = 0 ]; then + if [ "$nonvram" = 1 ]; then echo 1>&2 "$PRG: --bootonce specified, but nvsetenv not available." exit 1 fi if [ "$foundlabel" = 1 ]; then nvsetenv boot-once "$bootonce" foundlabel=`nvsetenv boot-once` - if [ "$foundlabel" != "boot-once=$bootonce" ]; then + if [ "$foundlabel" != "boot-once=$bootonce" -a \ + "$foundlabel" != "$bootonce" ]; then echo 1>&2 "$PRG: Could not nvsetenv boot-once $bootonce" exit 1 fi