From 25b32097c819d3812d466fde64e141cb1f77443c Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Tue, 7 Aug 2012 12:53:32 -0500
Subject: pcmcia 018

---
 abs/core/pcmciautils/60-pcmcia.rules         | 30 --------------------
 abs/core/pcmciautils/PKGBUILD                | 42 +++++++++++++++-------------
 abs/core/pcmciautils/initcpio-install-pcmcia | 22 +++++++++++++++
 3 files changed, 45 insertions(+), 49 deletions(-)
 delete mode 100644 abs/core/pcmciautils/60-pcmcia.rules
 create mode 100644 abs/core/pcmciautils/initcpio-install-pcmcia

diff --git a/abs/core/pcmciautils/60-pcmcia.rules b/abs/core/pcmciautils/60-pcmcia.rules
deleted file mode 100644
index aa3c1a2..0000000
--- a/abs/core/pcmciautils/60-pcmcia.rules
+++ /dev/null
@@ -1,30 +0,0 @@
-# PCMCIA devices:
-#
-ACTION!="add", GOTO="pcmciautils_end"
-# modprobe $env{MODALIAS} loads all possibly appropriate modules
-SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="?*", \
-		RUN+="/lib/udev/load-modules.sh $env{MODALIAS}"
-
-# Very few CIS firmware entries (which we use for matching)
-# are so broken that we need to read out random bytes of it
-# instead of the manufactor, card or product ID. Then the
-# matching is done in userspace.
-SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="?*", \
-		RUN+="/lib/udev/pcmcia-check-broken-cis"
-
-# However, the "weak" matching by func_id is only allowed _after_ modprobe
-# returns, so that "strong" matches have a higher priority.
-SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="?*", ATTR{allow_func_id_match}="1"
-
-# PCMCIA sockets:
-#
-# modprobe the pcmcia bus module so that 16-bit PCMCIA devices work
-SUBSYSTEM=="pcmcia_socket", \
-		RUN+="/lib/udev/load-modules.sh pcmcia"
-
-# if this is a PCMCIA socket which needs a resource database,
-# pcmcia-socket-startup sets it up
-SUBSYSTEM=="pcmcia_socket", \
-		RUN+="/lib/udev/pcmcia-socket-startup"
-
-LABEL="pcmciautils_end"
diff --git a/abs/core/pcmciautils/PKGBUILD b/abs/core/pcmciautils/PKGBUILD
index 40a4a6b..fcc5996 100644
--- a/abs/core/pcmciautils/PKGBUILD
+++ b/abs/core/pcmciautils/PKGBUILD
@@ -1,31 +1,35 @@
-# $Id: PKGBUILD 82630 2010-06-15 04:26:01Z allan $
-# Maintainer: Tobias Powalowski <tpowa@archlinux.org>
+# $Id: PKGBUILD 155725 2012-04-06 00:03:55Z tomegun $
+# Maintainer: Tom Gundersen <teg@jklm.no>
+# Contributor: Tobias Powalowski <tpowa@archlinux.org>
 pkgname=pcmciautils
-pkgver=017
-pkgrel=1
+pkgver=018
+pkgrel=4
 pkgdesc="Utilities for inserting and removing PCMCIA cards"
-arch=('i686' 'x86_64')
+arch=(i686 x86_64)
 url="http://kernel.org/pub/linux/utils/kernel/pcmcia/pcmcia.html"
 license=('GPL')
 groups=('base')
-depends=('glibc' 'sysfsutils' 'module-init-tools>=3.2pre9')
+# sysfsutils will not be required in the next release
+depends=('udev' 'sysfsutils')
 conflicts=('pcmcia-cs')
-source=(http://kernel.org/pub/linux/utils/kernel/pcmcia/pcmciautils-$pkgver.tar.bz2 
-	60-pcmcia.rules)
+# source=(http://kernel.org/pub/linux/utils/kernel/pcmcia/${pkgname}-${pkgver}.tar.bz2) broken due to breakin
+source=(ftp://ftp.archlinux.org/other/${pkgname}/${pkgname}-${pkgver}.tar.xz
+	initcpio-install-pcmcia)
 options=(!makeflags)
-md5sums=('5245af28eeba57ec0606a874d44d10f7'
-         'f88ac464ab9c75fe1565af551e6553a2')
 
 build() {
-  cd $srcdir/$pkgname-$pkgver
-  sed -i -e 's,/usr/bin/install,/bin/install,g' Makefile
-  make || return 1
+  cd "${srcdir}/${pkgname}-${pkgver}"
+  sed -i -e 's,/usr/bin/install,install,g;
+             s,/lib/udev,/usr/lib/udev,g' Makefile
+  make
 }
+
 package() {
-  cd $srcdir/$pkgname-$pkgver
-  make DESTDIR=$pkgdir install || return 1
-  # fix lspcmcia symlink
-  ln -sf pccardctl $pkgdir/sbin/lspcmcia
-  # add fixed rules file
-  install -D -m644 $srcdir/60-pcmcia.rules $pkgdir/lib/udev/rules.d/
+  cd "${srcdir}/${pkgname}-${pkgver}"
+  make DESTDIR="${pkgdir}" install
+
+  # install the mkinitpcio hook
+  install -D -m644 ../initcpio-install-pcmcia ${pkgdir}/usr/lib/initcpio/install/pcmcia
 }
+md5sums=('964c802994677a71b38ec56554aa229f'
+         '2659576a4637c58c4e79a96f8e43e316')
diff --git a/abs/core/pcmciautils/initcpio-install-pcmcia b/abs/core/pcmciautils/initcpio-install-pcmcia
new file mode 100644
index 0000000..71052d6
--- /dev/null
+++ b/abs/core/pcmciautils/initcpio-install-pcmcia
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+build() {
+    FILES="/etc/pcmcia/config.opts"
+    MODULES=" $(checked_modules '/drivers/pcmcia/' | grep -ve 'sound' -e 'net') $(checked_modules '/ide/legacy')"
+
+    [[ $MODULES ]] && MODULES+=" sd_mod?"
+
+    add_binary "/usr/lib/udev/pcmcia-socket-startup"
+    add_binary "/usr/lib/udev/pcmcia-check-broken-cis"
+    add_file "/usr/lib/udev/rules.d/60-pcmcia.rules"
+}
+
+help() {
+    cat <<HELPEOF
+This hook loads the necessary modules for a pcmcia root device.  Detection will
+take place at runtime. To minimize the modules in the image, add the autodetect
+hook too.
+HELPEOF
+}
+
+# vim: set ft=sh ts=4 sw=4 et:
-- 
cgit v0.12