From ad32a43286913fd709415a7732de2ae0df2b4667 Mon Sep 17 00:00:00 2001
From: Cecil <knoppmyth@gmail.com>
Date: Thu, 7 Jul 2011 06:47:21 -0700
Subject: udev:Bumped to latest.

---
 abs/core/udev/81-arch.rules                  | 55 -------------------------
 abs/core/udev/PKGBUILD                       | 61 ++++++++++++----------------
 abs/core/udev/static-audio-nodes-group.patch | 27 ++++++++++++
 abs/core/udev/static-nodes-permissions.patch | 57 ++++++++++++++++++++++++++
 abs/core/udev/udev.install                   | 27 ++++++++++++
 5 files changed, 136 insertions(+), 91 deletions(-)
 create mode 100644 abs/core/udev/static-audio-nodes-group.patch
 create mode 100644 abs/core/udev/static-nodes-permissions.patch

diff --git a/abs/core/udev/81-arch.rules b/abs/core/udev/81-arch.rules
index 21127a7..cd4e3e9 100644
--- a/abs/core/udev/81-arch.rules
+++ b/abs/core/udev/81-arch.rules
@@ -19,61 +19,6 @@
 # global stuff
 #
 
-#####################################
-###### Hotplug rules - begin
-# Only additional modules, 
-# which are not detectable,
-# are loaded here!
-#####################################
-# check if the device has already been claimed by a driver
-ACTION!="add", GOTO="drivers_end"
-
-# SOUND addon modules
-SUBSYSTEM=="sound", RUN+="/lib/udev/load-modules.sh snd-pcm-oss"
-SUBSYSTEM=="sound", RUN+="/lib/udev/load-modules.sh snd-seq-oss"
-
-#PNP addon modules
-SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", ATTRS{id}=="PNP0800", RUN+="/lib/udev/load-modules.sh pcspkr"
-SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", ATTRS{id}=="*PNP051[01]*", RUN+="/lib/udev/load-modules.sh irtty-sir"
-SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", ATTRS{id}=="PNPb02f", RUN+="/lib/udev/load-modules.sh analog"
-
-# PARPORT addon modules
-SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", ATTRS{id}=="PNP040*", RUN+="/lib/udev/load-modules.sh lp"
-SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", ATTRS{id}=="PNP040*", RUN+="/lib/udev/load-modules.sh ppdev"
-
-# fix ide cdrom detection on old proliant servers
-SUBSYSTEM=="pci", ENV{MODALIAS}=="pci:v00000E11d00000001sv00000000sd00000000bc06sc02i00", RUN+="/lib/udev/load-modules.sh ide-generic"
-
-LABEL="drivers_end"
-#####################################
-##### Hotplug rules - end
-#####################################
-
-#####################################
-###### CD/DVD symlinks - begin
-#####################################
-ACTION=="add|change", SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", IMPORT="cdrom_id --export $tempnode"
-ACTION=="add|change", SUBSYSTEMS=="scsi", KERNEL=="sr[0-9]*", IMPORT="cdrom_id --export $tempnode"
-ACTION=="add|change", SUBSYSTEMS=="scsi", KERNEL=="scd[a-z]", IMPORT="cdrom_id --export $tempnode"
-ENV{ID_CDROM}=="?*", SYMLINK+="cd/cdrom-%b"
-ENV{ID_CDROM_CD_RW}=="?*", SYMLINK+="cd/cdrw-%b"
-ENV{ID_CDROM_DVD}=="?*", SYMLINK+="cd/dvd-%b"
-ENV{ID_CDROM_DVD_R}=="?*", SYMLINK+="cd/dvdrw-%b"
-ACTION=="add|change", SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTR{removable}=="1", ATTRS{media}=="cdrom*", RUN+="cdsymlinks.sh"
-ACTION=="add|change", SUBSYSTEMS=="scsi", KERNEL=="sr[0-9]*", ATTRS{type}=="5", RUN+="cdsymlinks.sh"
-ACTION=="add|change", SUBSYSTEMS=="scsi", KERNEL=="sg[0-9]*", ATTRS{type}=="5", RUN+="cdsymlinks.sh"
-ACTION=="remove", SUBSYSTEMS=="block", KERNEL=="hd[a-z]", RUN+="cdsymlinks.sh"
-ACTION=="remove", SUBSYSTEMS=="block", KERNEL=="sr[0-9]*", RUN+="cdsymlinks.sh"
-ACTION=="remove", SUBSYSTEMS=="block", KERNEL=="sg[0-9]*", RUN+="cdsymlinks.sh"
-#####################################
-###### CD/DVD symlinks - end
-#####################################
-
-#####################################
-# Additional Archlinux
-# Permissions and Symlinks - begin
-#####################################
-
 # permission for sg devices
 KERNEL=="sg[0-9]*", ATTRS{type}!="3|6", GROUP="disk", MODE="0660"
 
diff --git a/abs/core/udev/PKGBUILD b/abs/core/udev/PKGBUILD
index de372ed..b80fd77 100644
--- a/abs/core/udev/PKGBUILD
+++ b/abs/core/udev/PKGBUILD
@@ -1,12 +1,13 @@
-# $Id: PKGBUILD 104538 2011-01-03 22:13:06Z tpowa $
+# $Id: PKGBUILD 126202 2011-06-02 14:49:12Z tomegun $
 # Maintainer: Aaron Griffin <aaron@archlinux.org>
 # Maintainer: Tobias Powalowski <tpowa@archlinux.org>
 # Maintainer: Thomas Bächler <thomas@archlinux.org>
+# Maintainer: Tom Gundersen <teg@jklm.no>
 
 pkgbase="udev"
 pkgname=('udev' 'udev-compat')
-pkgver=165
-pkgrel=1
+pkgver=171
+pkgrel=2
 arch=(i686 x86_64)
 url="http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html"
 license=('GPL')
@@ -14,21 +15,19 @@ groups=('base')
 # older initscripts versions required start_udev
 options=(!makeflags !libtool)
 makedepends=('glibc' 'coreutils' 'util-linux' 'pciutils' 'libusb-compat' 'glib2' 'kernel26' 'gperf' 'libxslt' 'gobject-introspection')
-source=(http://www.kernel.org/pub/linux/utils/kernel/hotplug/$pkgname-$pkgver.tar.bz2
-        80-drivers.rules 
-        81-arch.rules 
-        load-modules.sh 
-        cdsymlinks.sh)
-md5sums=('74c62aa82969278960b7ee81e94b6d8f'
-         '4427855146513a4703ab5c7eb8a0156e'
-         'f17c99779173ddc79f866cf3a5de5e68'
-         'f91fddc67609b45b244a624977c4247b'
-         '2e808ee78d237c478b57af2a68d43769')
+source=(http://www.kernel.org/pub/linux/utils/kernel/hotplug/$pkgbase-$pkgver.tar.bz2
+        81-arch.rules
+	static-audio-nodes-group.patch
+	static-nodes-permissions.patch)
 
 build() {
-  cd $srcdir/$pkgname-$pkgver
+  cd $srcdir/$pkgbase-$pkgver
+  # fix https://bugs.archlinux.org/task/24362 (will be in udev-172)
+  patch -Np1 -i ../static-audio-nodes-group.patch
+  patch -Np1 -i ../static-nodes-permissions.patch
   ./configure --sysconfdir=/etc --with-rootlibdir=/lib --libexecdir=/lib/udev\
-              --sbindir=/sbin --with-systemdsystemunitdir=/lib/systemd/system
+              --sbindir=/sbin --with-systemdsystemunitdir=/lib/systemd/system\
+              --disable-rule-generator
   make
 }
   
@@ -42,30 +41,16 @@ package_udev() {
   conflicts=('pcmcia-cs' 'hotplug' 'initscripts<2009.07')
   replaces=('devfsd')
   
-  cd $srcdir/$pkgname-$pkgver
+  cd $srcdir/$pkgbase-$pkgver
   make DESTDIR=${pkgdir} install
-  # Replace original 80-drivers.rules with custom one.
-  install -D -m644 $srcdir/80-drivers.rules $pkgdir/lib/udev/rules.d/80-drivers.rules
   # Install our rule for permissions and symlinks
   install -D -m644 $srcdir/81-arch.rules $pkgdir/lib/udev/rules.d/81-arch.rules
-  # install our module loading subsystem
-  install -D -m755 $srcdir/load-modules.sh $pkgdir/lib/udev/load-modules.sh
-  # install cdsymlinks.sh
-  install -D -m755 $srcdir/cdsymlinks.sh $pkgdir/lib/udev/cdsymlinks.sh
-  # disable error logging to prevent startup failures printed to vc on boot
-  sed -i -e 's|udev_log="err"|udev_log="0"|g' $pkgdir/etc/udev/udev.conf
-  # disable persistent cdromsymlinks and network by default 
-  # and move it to /etc/udev/rules.d
-  mv $pkgdir/lib/udev/rules.d/75-persistent-net-generator.rules \
-     $pkgdir/etc/udev/rules.d/75-persistent-net-generator.rules.optional
-  mv $pkgdir/lib/udev/rules.d/75-cd-aliases-generator.rules \
-     $pkgdir/etc/udev/rules.d/75-cd-aliases-generator.rules.optional
 
   # create framebuffer blacklist
   mkdir -p $pkgdir/etc/modprobe.d/
-  for mod in $(find /lib/modules/*/kernel/drivers/video -name '*fb.ko' -exec basename {} .ko \;); do 
-	echo "blacklist $mod" >> $pkgdir/etc/modprobe.d/framebuffer_blacklist.conf
-  done
+  for mod in $(find /lib/modules/*/kernel/drivers/video -name '*fb.ko.gz' -exec basename {} .ko.gz \;); do 
+  	echo "blacklist $mod" 
+  done | sort -u > $pkgdir/etc/modprobe.d/framebuffer_blacklist.conf
 
   # create static devices in /lib/udev/devices/
   mkdir ${pkgdir}/lib/udev/devices/pts
@@ -106,7 +91,11 @@ package_udev-compat() {
   pkgdesc="The userspace dev tools (udev) - additional rules for older kernels"
   depends=('udev')
   groups=('')
-  cd $srcdir/$pkgname-$pkgver
-  install -d -m755 ${pkgdir}/lib/${pkgname}/rules.d
-  install -D -m644 ${srcdir}/${pkgname}-${pkgver}/rules/misc/30-kernel-compat.rules ${pkgdir}/lib/udev/rules.d/30-kernel-compat.rules
+  cd $srcdir/$pkgbase-$pkgver
+  install -d -m755 ${pkgdir}/lib/${pkgbase}/rules.d
+  install -D -m644 ${srcdir}/${pkgbase}-${pkgver}/rules/misc/30-kernel-compat.rules ${pkgdir}/lib/udev/rules.d/30-kernel-compat.rules
 }
+md5sums=('bdf4617284be2ecac11767437417e209'
+         '6ee44e3feb8e0f037947e7d4ca273f12'
+         '4f625aea95a5597afd8cdf189421f193'
+         'f9e50b8dfcd2215f5423ff9bc04ecf68')
diff --git a/abs/core/udev/static-audio-nodes-group.patch b/abs/core/udev/static-audio-nodes-group.patch
new file mode 100644
index 0000000..b1fc4f9
--- /dev/null
+++ b/abs/core/udev/static-audio-nodes-group.patch
@@ -0,0 +1,27 @@
+From 3e227830ad6494700e18ae03297e8fb833ff26bf Mon Sep 17 00:00:00 2001
+From: Kay Sievers <kay.sievers@vrfy.org>
+Date: Fri, 27 May 2011 02:50:29 +0200
+Subject: [PATCH] rules: apply 'audio' group of the static snd/{seq,timer}
+ nodes
+
+---
+ rules/rules.d/50-udev-default.rules |    3 ++-
+ 1 files changed, 2 insertions(+), 1 deletions(-)
+
+diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules
+index cd745ef..cacb533 100644
+--- a/rules/rules.d/50-udev-default.rules
++++ b/rules/rules.d/50-udev-default.rules
+@@ -38,7 +38,8 @@ SUBSYSTEM=="graphics",		GROUP="video"
+ SUBSYSTEM=="drm",		GROUP="video"
+ 
+ # sound
+-SUBSYSTEM=="sound",		GROUP="audio"
++SUBSYSTEM=="sound",		GROUP="audio", \
++  OPTIONS+="static_node=snd/seq", OPTIONS+="static_node=snd/timer"
+ 
+ # DVB (video)
+ SUBSYSTEM=="dvb", GROUP="video"
+-- 
+1.7.5.3
+
diff --git a/abs/core/udev/static-nodes-permissions.patch b/abs/core/udev/static-nodes-permissions.patch
new file mode 100644
index 0000000..51e6ad6
--- /dev/null
+++ b/abs/core/udev/static-nodes-permissions.patch
@@ -0,0 +1,57 @@
+From c112873b5bc9ebbae39c32f502bc6211f33546cc Mon Sep 17 00:00:00 2001
+From: Kay Sievers <kay.sievers@vrfy.org>
+Date: Mon, 30 May 2011 02:12:02 +0200
+Subject: [PATCH 1/2] rules: static_node - use 0660 if group is given to get
+ the cigar
+
+>> On Tue, May 24, 2011 at 15:33, Tom Gundersen <teg@jklm.no> wrote:
+>
+> Close, but no cigar. Looks like the static nodes are not assigned
+> permissions 0660 even if a gid is set (the nodes have perms 0600).
+>
+> Cheers,
+>
+> Tom
+---
+ udev/udev-rules.c |   10 ++++++++--
+ 1 files changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/udev/udev-rules.c b/udev/udev-rules.c
+index 48395e7..56a258d 100644
+--- a/udev/udev-rules.c
++++ b/udev/udev-rules.c
+@@ -2709,8 +2709,9 @@ void udev_rules_apply_static_dev_perms(struct udev_rules *rules)
+ 		case TK_A_STATIC_NODE: {
+ 			char filename[UTIL_PATH_SIZE];
+ 			struct stat stats;
++
+ 			/* we assure, that the permissions tokens are sorted before the static token */
+-			if (mode == 0 && uid == 0 && gid == 0)
++			if (uid == 0 && gid == 0)
+ 				goto next;
+ 			util_strscpyl(filename, sizeof(filename), udev_get_dev_path(rules->udev), "/",
+ 				      &rules->buf[cur->key.value_off], NULL);
+@@ -2718,14 +2719,19 @@ void udev_rules_apply_static_dev_perms(struct udev_rules *rules)
+ 				goto next;
+ 			if (!S_ISBLK(stats.st_mode) && !S_ISCHR(stats.st_mode))
+ 				goto next;
+-			if (mode != 0 && mode != (stats.st_mode & 0777)) {
++
++			if (mode == 0 && gid > 0)
++				mode = 0660;
++			if (mode != (stats.st_mode & 0777)) {
+ 				chmod(filename, mode);
+ 				info(rules->udev, "chmod '%s' %#o\n", filename, mode);
+ 			}
++
+ 			if ((uid != 0 && uid != stats.st_uid) || (gid != 0 && gid != stats.st_gid)) {
+ 				chown(filename, uid, gid);
+ 				info(rules->udev, "chown '%s' %u %u\n", filename, uid, gid);
+ 			}
++
+ 			utimensat(AT_FDCWD, filename, NULL, 0);
+ 			break;
+ 		}
+-- 
+1.7.5.2
+
diff --git a/abs/core/udev/udev.install b/abs/core/udev/udev.install
index e953ec7..5c02dd1 100644
--- a/abs/core/udev/udev.install
+++ b/abs/core/udev/udev.install
@@ -11,6 +11,33 @@ post_upgrade() {
     echo "They are located in /etc/udev/readme-udev-arch.txt"
     echo "----------"
   fi
+  if [ "$(vercmp $2 169)" -lt 0 ]; then
+    echo "ATTENTION UDEV:"
+    echo "---------------"
+    echo "Kernel 2.6.32 or newer is now required."
+    echo "OSS emulation modules are not loaded by default, add to rc.conf if needed."
+    echo "Arch specific cd symlinks are now no longer created."
+    echo "cd and net persistent rules will no longer be autogenerated,"
+    echo "see <https://wiki.archlinux.org/index.php/Udev> for details."
+    echo "Errors are now logged (possibly to the console) by default."
+    echo "---------------"
+  fi
+  if [ "$(vercmp $2 172)" -lt 0 ]; then
+    echo "ATTENTION UDEV:"
+    echo "---------------"
+    echo "Arch's custom blacklisting logic has been removed. MOD_AUTOLOAD and"
+    echo "blacklisting in MODULES no longer works."
+    echo "See 'man modprobe.conf' for a replacement to blacklisting."
+    echo "To disable a module mod1 on the kernel command line, use"
+    echo "mod1.disable=1"
+    echo "or"
+    echo "modprobe.blacklist=mod1"
+    echo "  --"
+    echo "The following modules are no longer unconditionally loaded:"
+    echo "  pcspkr irtty-sir analog lp ppdev ide-generic"
+    echo "Add them to MODULES in rc.conf if you need them."
+    echo "---------------"
+  fi
 }
 
 post_install() {
-- 
cgit v0.12