[debian-edu-commits] r81153 - in branches/wheezy/debian-edu-config: debian share/debian-edu-config/tools

pere at alioth.debian.org pere at alioth.debian.org
Tue Jun 25 07:51:20 UTC 2013


Author: pere
Date: 2013-06-25 07:51:19 +0000 (Tue, 25 Jun 2013)
New Revision: 81153

Modified:
   branches/wheezy/debian-edu-config/debian/changelog
   branches/wheezy/debian-edu-config/share/debian-edu-config/tools/auto-addfirmware
Log:
Rewrite auto-addfirmware to look up all firmware used by all
loaded kernel modules instead of looking at the dmesg content, to
make it more robust.

Modified: branches/wheezy/debian-edu-config/debian/changelog
===================================================================
--- branches/wheezy/debian-edu-config/debian/changelog	2013-06-24 22:34:39 UTC (rev 81152)
+++ branches/wheezy/debian-edu-config/debian/changelog	2013-06-25 07:51:19 UTC (rev 81153)
@@ -8,6 +8,9 @@
   * Updated auto-addfirmware to fetch from http.debian.net.
   * Call auto-addfirmware at the end of debian-edu-hwsetup, to get all
     required firmware installed during installation.
+  * Rewrite auto-addfirmware to look up all firmware used by all
+    loaded kernel modules instead of looking at the dmesg content, to
+    make it more robust.
 
  -- Petter Reinholdtsen <pere at debian.org>  Mon, 24 Jun 2013 16:51:21 +0200
 

Modified: branches/wheezy/debian-edu-config/share/debian-edu-config/tools/auto-addfirmware
===================================================================
--- branches/wheezy/debian-edu-config/share/debian-edu-config/tools/auto-addfirmware	2013-06-24 22:34:39 UTC (rev 81152)
+++ branches/wheezy/debian-edu-config/share/debian-edu-config/tools/auto-addfirmware	2013-06-25 07:51:19 UTC (rev 81153)
@@ -10,12 +10,15 @@
 arch=$(dpkg --print-architecture)
 mirror=http://http.debian.net/debian
 
-# Find firmware files requested by kernel drivers
-# Perhaps it is better to use /dev/.udev/firmware-missing/?
-fwfiles=$(dmesg |grep "firmware: requesting"|rev|awk '{print $1}'|rev|sort -u)
+# Find firmware files requested by loaded kernel drivers.
+for fwfile in $(for module in $(awk '{print $1}' /proc/modules) ; do modinfo $module 2>/dev/null |awk '/^firmware:/ {print $2}'; done|sort -u); do
+    if [ ! -e /lib/firmware/$fwfile ] ; then
+	fwfiles="${fwfiles:+$fwfiles }$fwfile"
+    fi
+done
 
 if [ -z "$fwfiles" ] ; then
-    echo "info: did not find any firmware files requested by the kernel in dmesg.  exiting"
+    echo "info: did not find any firmware files requested by loaded kernel modules.  exiting"
     exit
 fi
 echo "info: kernel drivers requested extra firmware:" $fwfiles
@@ -34,17 +37,17 @@
     if [ -z "$binpkginfo" ] ; then
 	# Special case for b43 where the firmware is undistributable
 	# by Debian.
-	# FIXME verify that this is the correct of the three firmware
-	# packages for b43.
-	if echo $fwfile |grep -q b43-open ; then
-	    binpkgs="firmware-b43-installer $binpkgs"
-	fi
+	case "$fwfile" in
+	    b43/*)
+		binpkgs="${binpkgs:+$binpkgs }firmware-b43-installer"
+		;;
+	esac
     else
 	binpkginfos="$binpkginfos $binpkginfo"
     fi
 done
 
-binpkgs="$(
+binpkgs="${binpkgs:+$binpkgs }$(
 for binpkginfo in $binpkginfos ; do
     echo $binpkginfo |  while IFS=/ read section srcpkg binpkg ; do
         echo $binpkg
@@ -56,15 +59,20 @@
 EOF
 	fi
     done
-done) $binpkgs"
+done)"
 
-# Fetch updated package lists
-echo "info: Updating APT sources after adding non-free APT source"
-apt-get -qq update
+if [ -e /etc/apt/sources.list.d/auto-addfirmware.list ] ; then
+    # Fetch updated package lists
+    echo "info: Updating APT sources after adding non-free APT source"
+    apt-get -qq update
+fi
 
-# Install firmware packages
-echo "info: trying to install $binpkgs"
-apt-get -qq install -y $binpkgs
-
+if [ "$binpkgs" ] ; then
+    # Install firmware packages
+    echo "info: trying to install $binpkgs"
+    apt-get -qq install -y $binpkgs
+else
+    echo "info: No new firmware package with requested firmware detected."
+fi
 cd /
 rm -rf $tmpdir




More information about the debian-edu-commits mailing list