work around udev's "cosmetic warnings"
[grml-live.git] / etc / grml / fai / config / files / etc / initramfs-tools / hooks / 000-udev-shutup / GRMLBASE
diff --git a/etc/grml/fai/config/files/etc/initramfs-tools/hooks/000-udev-shutup/GRMLBASE b/etc/grml/fai/config/files/etc/initramfs-tools/hooks/000-udev-shutup/GRMLBASE
new file mode 100755 (executable)
index 0000000..f125511
--- /dev/null
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+# This file is installed by grml-live in 10-build-initramfs.
+# It's purpose is to shut up so called "cosmetic warnings"
+# introduced in udev 168-1.
+
+PREREQ=""
+prereqs()
+{
+       echo "$PREREQ"
+}
+case $1 in
+prereqs)
+       prereqs
+       exit 0
+       ;;
+esac
+
+# Restrict this to the known problematic version.
+UDEV_VERSION=$(dpkg-query -W -f '${Version}' udev)
+if [ "$UDEV_VERSION" != "168-1" ]; then
+       exit 0
+fi
+
+. /usr/share/initramfs-tools/hook-functions
+
+TMPFILE=$(mktemp)
+
+cat >$TMPFILE <<EOSH
+#!/bin/sh
+# THIS FILE IS AUTOMATICALLY GENERATED BY
+# /etc/initramfs-tools/hooks/udev_shutup
+exit 0
+EOSH
+
+chmod a+rx $TMPFILE
+
+for i in cdrom_id net.agent mtd_probe; do
+       if [ ! -e "${DESTDIR}"/lib/udev/$i ]; then
+               cp -a $TMPFILE "${DESTDIR}"/lib/udev/$i
+       fi
+done
+
+rm $TMPFILE
+
+exit 0