]> git.ozlabs.org Git - yaboot.git/commitdiff
ybin --bootonce doesn't work
authorWill Woods <wwoods@redhat.com>
Fri, 14 Nov 2008 04:55:53 +0000 (04:55 +0000)
committerTony Breeds <tony@bakeyournoodle.com>
Tue, 17 Feb 2009 22:59:52 +0000 (09:59 +1100)
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).

From bugzilla:
  https://bugzilla.redhat.com/show_bug.cgi?id=471425

The attached patch fixes these problems and makes --bootonce work as expected.

Signed-off-by: Roman Rakus <rrakus@redhat.com>
Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
ybin/ybin

index cf58db9ec2da27669ca059c3b443a7dec2edfc0f..d8836225720331ee11c0fd8069c1afba8c0d7a7a 100755 (executable)
--- a/ybin/ybin
+++ b/ybin/ybin
@@ -1659,14 +1659,15 @@ checkconf || exit 1
 
 if [ "x$bootonce" != "x" ]; then
     foundlabel=`sed s/\#.*// $bootconf | grep "label=$bootonce$" | wc -l`
 
 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`
        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
            echo 1>&2 "$PRG: Could not nvsetenv boot-once $bootonce"
            exit 1
        fi