Package: yaboot
Version: 1.3.13-3
Severity: normal
Tags: patch

ybin and mkofboot hardcode /dev/nvram as the nvram device.  devfs (and
udev, using devfs.rules) use /dev/misc/nvram instead.

The attached patch checks for both devices so that it will work on
both systems.

Please note that this patch depends upon #300946 to be fixed in
nvsetenv (powerpc-utils) before this patch will have any effect.


Regards.
Roger

-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (990, 'unstable')
Architecture: powerpc (ppc)
Kernel: Linux 2.6.8-powerpc
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages yaboot depends on:
ii  libc6                       2.3.2.ds1-20 GNU C Library: Shared libraries an

-- no debconf information
--- /usr/sbin/ybin      2004-11-26 02:20:31.000000000 +0000
+++ ybin        2005-03-22 21:05:14.879486304 +0000
@@ -450,20 +450,29 @@
            if [ "$OLD" = 1 ] ; then
                ## i check this myself to avoid misleading error
                ## messages. nvsetenv should REALLY support --version.
-               if [ ! -e /dev/nvram ] ; then
-                   echo 1>&2 "$PRG: /dev/nvram: No such file or directory"
+
+               ## Check for devfs-style nvram device
+               nvdev="/dev/nvram"
+               for dev in /dev/misc/nvram /dev/nvram; do
+                   if [ -e "$dev" ] ; then
+                       nvdev="$dev"
+                       break
+                   fi
+               done
+               if [ ! -e $nvdev ] ; then
+                   echo 1>&2 "$PRG: $nvdev: No such file or directory"
                    echo 1>&2 "$PRG: Warning: nvram will not be updated"
                    nonvram=1
-               elif [ ! -c /dev/nvram ] ; then
-                   echo 1>&2 "$PRG: /dev/nvram: Not a character device"
+               elif [ ! -c $nvdev ] ; then
+                   echo 1>&2 "$PRG: $nvdev: Not a character device"
                    echo 1>&2 "$PRG: Warning: nvram will not be updated"
                    nonvram=1
-               elif [ ! -w /dev/nvram -o ! -r /dev/nvram ] ; then
-                   echo 1>&2 "$PRG: /dev/nvram: Permission denied"
+               elif [ ! -w $nvdev -o ! -r $nvdev ] ; then
+                   echo 1>&2 "$PRG: $nvdev: Permission denied"
                    echo 1>&2 "$PRG: Warning: nvram will not be updated"
                    nonvram=1
-               elif ! (dd if=/dev/nvram of=/dev/null bs=1 count=10 > /dev/null 
2>&1) ; then
-                   echo 1>&2 "$PRG: /dev/nvram: No such device"
+               elif ! (dd if=$nvdev of=/dev/null bs=1 count=10 > /dev/null 
2>&1) ; then
+                   echo 1>&2 "$PRG: $nvdev: No such device"
                    echo 1>&2 "$PRG: Warning: nvram will not be updated"
                    nonvram=1
                else
--- /usr/sbin/mkofboot  2004-11-26 02:20:31.000000000 +0000
+++ mkofboot    2005-03-22 21:07:34.225302520 +0000
@@ -450,20 +450,29 @@
            if [ "$OLD" = 1 ] ; then
                ## i check this myself to avoid misleading error
                ## messages. nvsetenv should REALLY support --version.
-               if [ ! -e /dev/nvram ] ; then
-                   echo 1>&2 "$PRG: /dev/nvram: No such file or directory"
+
+               ## Check for devfs-style nvram device
+               nvdev="/dev/nvram"
+               for dev in /dev/misc/nvram /dev/nvram; do
+                   if [ -e "$dev" ] ; then
+                       nvdev="$dev"
+                       break
+                   fi
+               done
+               if [ ! -e $nvdev ] ; then
+                   echo 1>&2 "$PRG: $nvdev: No such file or directory"
                    echo 1>&2 "$PRG: Warning: nvram will not be updated"
                    nonvram=1
-               elif [ ! -c /dev/nvram ] ; then
-                   echo 1>&2 "$PRG: /dev/nvram: Not a character device"
+               elif [ ! -c $nvdev ] ; then
+                   echo 1>&2 "$PRG: $nvdev: Not a character device"
                    echo 1>&2 "$PRG: Warning: nvram will not be updated"
                    nonvram=1
-               elif [ ! -w /dev/nvram -o ! -r /dev/nvram ] ; then
-                   echo 1>&2 "$PRG: /dev/nvram: Permission denied"
+               elif [ ! -w $nvdev -o ! -r $nvdev ] ; then
+                   echo 1>&2 "$PRG: $nvdev: Permission denied"
                    echo 1>&2 "$PRG: Warning: nvram will not be updated"
                    nonvram=1
-               elif ! (dd if=/dev/nvram of=/dev/null bs=1 count=10 > /dev/null 
2>&1) ; then
-                   echo 1>&2 "$PRG: /dev/nvram: No such device"
+               elif ! (dd if=$nvdev of=/dev/null bs=1 count=10 > /dev/null 
2>&1) ; then
+                   echo 1>&2 "$PRG: $nvdev: No such device"
                    echo 1>&2 "$PRG: Warning: nvram will not be updated"
                    nonvram=1
                else

Reply via email to