New udev with vanilla archlinux wiki rules

This commit is contained in:
Mike Staszel 2010-06-27 07:04:54 -07:00
parent 40d7982b01
commit 622bea4cf5
7 changed files with 66 additions and 107 deletions

View file

@ -1,22 +1,22 @@
# Plugbox Linux USB and SD-card automounter
KERNEL!="sd[a-z][0-9]", GOTO="media_by_label_auto_mount_end"
KERNEL!="sd[a-z]*|mmcblk[0-9]p[0-9]", GOTO="media_by_label_auto_mount_end"
ACTION=="add", PROGRAM!="/sbin/blkid %N", GOTO="media_by_label_auto_mount_end"
# Do not mount devices on boot because otherwise fsck may fail
ACTION=="add", PROGRAM!="/bin/grep ' / / rw[, ]' /proc/self/mountinfo", GOTO="media_by_label_auto_mount_end"
# Import FS infos
IMPORT{program}="/sbin/blkid -o udev -p %N"
# Get a label if present, otherwise specify one
ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"
ENV{ID_FS_LABEL}=="", ENV{dir_name}="usbhd-%k"
# Global mount options
ACTION=="add", ENV{mount_options}="exec,suid,noatime,users"
# Filesystem specific options
ACTION=="add", PROGRAM=="/sbin/blkid -o value -s TYPE %E{device}", RESULT=="vfat|ntfs", ENV{mount_options}="%E{mount_options},utf8,gid=100,umask=002"
ACTION=="add", ENV{mount_options}="noatime"
# Filesystem-specific mount options
ACTION=="add", ENV{ID_FS_TYPE}=="vfat|ntfs", ENV{mount_options}="$env{mount_options},utf8,gid=100,umask=002"
# Get label
ACTION=="add", PROGRAM=="/sbin/blkid -o value -s LABEL %N", ENV{dir_name}="%c"
# Use basename to correctly handle labels such as ../mnt/foo
ACTION=="add", PROGRAM=="/usr/bin/basename '%E{dir_name}'", ENV{dir_name}="%c"
ACTION=="add", ENV{dir_name}!="?*", ENV{dir_name}="usbhd-%k"
# Mount the device
ACTION=="add", RUN+="/bin/mkdir -p /media/%E{dir_name}", RUN+="/bin/mount -o $env{mount_options} /dev/%k /media/%E{dir_name}"
ACTION=="add", ENV{dir_name}=="?*", RUN+="/bin/mkdir -p '/media/%E{dir_name}'", RUN+="/bin/mount -o %E{mount_options} /dev/%k '/media/%E{dir_name}'"
ACTION=="remove", ENV{dir_name}=="?*", RUN+="/bin/umount -l '/media/%E{dir_name}'"
ACTION=="remove", ENV{dir_name}=="?*", RUN+="/bin/rmdir '/media/%E{dir_name}'"
# Clean up after removal
ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/umount -l /media/%E{dir_name}", RUN+="/bin/rmdir /media/%E{dir_name}"
# Exit
LABEL="media_by_label_auto_mount_end"

View file

@ -0,0 +1,11 @@
KERNEL!="mmcblk[0-9]p[0-9]", GOTO="sd_cards_auto_mount_end"
# Global mount options
ACTION=="add", ENV{mount_options}="relatime"
# Filesystem specific options
ACTION=="add", IMPORT{program}="/sbin/blkid -o udev -p %N"
ACTION=="add", ENV{ID_FS_TYPE}=="vfat|ntfs", ENV{mount_options}="$env{mount_options},utf8,gid=100,umask=002"
ACTION=="add", RUN+="/bin/mkdir -p /media/sd-%k", RUN+="/bin/ln -s /media/sd-%k /mnt/sd-%k", RUN+="/bin/mount -o $env{mount_options} /dev/%k /media/sd-%k"
ACTION=="remove", RUN+="/bin/umount -l /media/sd-%k", RUN+="/bin/rmdir /media/sd-%k"
LABEL="sd_cards_auto_mount_end"

View file

@ -1,10 +1,13 @@
# Maintainer: Mike Staszel <mikestaszel@plugboxlinux.org>
# Maintainer: Mike Staszel <mikestaszel@plugboxlinux.org
# Maintainer: Aaron Griffin <aaron@archlinux.org>
# Maintainer: Tobias Powalowski <tpowa@archlinux.org>
# Maintainer: Thomas Bächler <thomas@archlinux.org>
pkgbase="udev"
pkgname=('udev' 'udev-compat')
pkgver=151
pkgrel=4
arch=('arm')
pkgver=157
pkgrel=1
arch=(i686 x86_64)
url="http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html"
license=('GPL')
groups=('base')
@ -12,29 +15,21 @@ groups=('base')
options=(!makeflags !libtool)
makedepends=('glibc' 'coreutils' 'util-linux' 'libusb' 'glib2' 'kernel26' 'gperf' 'libxslt' 'gobject-introspection')
source=(http://www.kernel.org/pub/linux/utils/kernel/hotplug/$pkgname-$pkgver.tar.bz2
81-arch.rules
load-modules.sh
cdsymlinks.sh
root-link.sh
81-arch.rules load-modules.sh cdsymlinks.sh root-link.sh
arch-udev-rules.patch
ignore-remove.sh
firmware-loader-fix-missing-firmware.patch
11-media-by-label-auto-mount.rules)
md5sums=('aeae0e6273dcbec246c3c1b9868ebed1'
11-media-by-label-auto-mount.rules
11-sd-cards-auto-mount.rules)
md5sums=('0ea39cc875116982abf200eb16c1b53e'
'6393ee81993f8b9beb776ca904005864'
'a2d0d59742b80b3b28ed498718654eb7'
'f91fddc67609b45b244a624977c4247b'
'2e808ee78d237c478b57af2a68d43769'
'2d6dc6842464f107bccc68cd505a6c31'
'22c1f059cdeddaac5e7fe33b007da6a3'
'35fa97500243a79b2370fa4684828e69'
'ec1fa2ecaff2e8efc611cb70568630ad'
'4d93226190db7c940fe7fe4429138703')
'70198227b7bbe3852e1cd2299693af66'
'b71221f5d3588b5f1522906bb7cd7c6b'
'689cf10b97269e68db29451809e28419')
build() {
cd $srcdir/$pkgname-$pkgver
# The new firmware loader has a bug where modprobe will hang 60 seconds when a
# firmware file is missing. Fix this by properly reporting error to the kernel
patch -p1 -i "$srcdir"/firmware-loader-fix-missing-firmware.patch || return 1
./configure --prefix="" --mandir=/usr/share/man\
--includedir=/usr/include\
--libexecdir=/lib/udev\
@ -67,8 +62,6 @@ package_udev() {
install -D -m755 $srcdir/cdsymlinks.sh $pkgdir/lib/udev/cdsymlinks.sh
# install root-link.sh
install -D -m755 $srcdir/root-link.sh $pkgdir/lib/udev/root-link.sh
# install ignore-remove.sh
install -D -m755 $srcdir/ignore-remove.sh $pkgdir/lib/udev/ignore-remove.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
# install additional standard rules files
@ -131,9 +124,12 @@ package_udev() {
for i in $pkgdir/lib/udev/rules.d/*.rules; do
sed -i -e 's#GROUP="dialout"#GROUP="uucp"#g' $i
done
# Add Plugbox Linux USB and SD-card automount rules
mv "${pkgdir}/lib/girepository-1.0" "${pkgdir}/usr/lib/" || return 1
# Plugbox Linux USB drive and SD card automount rules
cp -R $srcdir/11-media-by-label-auto-mount.rules $pkgdir/etc/udev/rules.d/
cp -R $srcdir/11-sd-cards-auto-mount.rules $pkgdir/etc/udev/rules.d/
}
package_udev-compat() {

View file

@ -24,35 +24,27 @@ diff -Nur rules.d/50-udev-default.rules rules.d.arch/50-udev-default.rules
# block-related
KERNEL=="sch[0-9]*", GROUP="disk"
@@ -116,5 +116,4 @@
KERNEL=="rrom[0-9]*", MODE="0400"
# do not delete static device nodes
-ACTION=="remove", NAME=="", TEST=="/lib/udev/devices/%k", OPTIONS+="ignore_remove"
-ACTION=="remove", NAME=="?*", TEST=="/lib/udev/devices/$name", OPTIONS+="ignore_remove"
+ACTION=="remove", PROGRAM="ignore-remove.sh %r", OPTIONS+="ignore_remove"
diff -Nur rules.d/80-drivers.rules rules.d.arch/80-drivers.rules
--- rules.d/80-drivers.rules 2009-03-07 22:22:48.200242883 +0100
+++ rules.d.arch/80-drivers.rules 2009-03-07 22:22:54.757744454 +0100
@@ -2,13 +2,14 @@
--- rules.d/80-drivers.rules 2010-06-03 11:55:08.978720002 +0200
+++ rules.d.arch/80-drivers.rules 2010-06-03 11:58:41.207865142 +0200
@@ -2,12 +2,13 @@
ACTION!="add", GOTO="drivers_end"
ACTION=="remove", GOTO="drivers_end"
-DRIVER!="?*", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe -b $env{MODALIAS}"
-SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", RUN+="/sbin/modprobe -b tifm_sd"
-SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", RUN+="/sbin/modprobe -b tifm_ms"
-SUBSYSTEM=="memstick", RUN+="/sbin/modprobe -b --all ms_block mspro_block"
-SUBSYSTEM=="i2o", RUN+="/sbin/modprobe -b i2o_block"
-SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST!="[module/sg]", RUN+="/sbin/modprobe -b sg"
-SUBSYSTEM=="module", KERNEL=="parport_pc", RUN+="/sbin/modprobe -b ppdev"
+DRIVER!="?*", ENV{MODALIAS}=="?*", RUN+="/lib/udev/load-modules.sh $env{MODALIAS}"
+SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", RUN+="/lib/udev/load-modules.sh tifm_sd"
+SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", RUN+="/lib/udev/load-modules.sh tifm_ms"
-DRIVER!="?*", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe -bv $env{MODALIAS}"
-SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", RUN+="/sbin/modprobe -bv tifm_sd"
-SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", RUN+="/sbin/modprobe -bv tifm_ms"
-SUBSYSTEM=="memstick", RUN+="/sbin/modprobe -bv --all ms_block mspro_block"
-SUBSYSTEM=="i2o", RUN+="/sbin/modprobe -bv i2o_block"
-SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST!="[module/sg]", RUN+="/sbin/modprobe -bv sg"
-SUBSYSTEM=="module", KERNEL=="parport_pc", RUN+="/sbin/modprobe -bv ppdev"
+DRIVER!="?*", ENV{MODALIAS}=="?*", RUN+="/lib/udev/load-modules.sh $env{MODALIAS}"
+SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", RUN+="/lib/udev/load-modules.sh tifm_sd"
+SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", RUN+="/lib/udev/load-modules.sh tifm_ms"
+SUBSYSTEM=="memstick", RUN+="/lib/udev/load-modules.sh ms_block"
+SUBSYSTEM=="memstick", RUN+="/lib/udev/load-modules.sh mspro_block"
+SUBSYSTEM=="i2o", RUN+="/lib/udev/load-modules.sh i2o_block"
+SUBSYSTEM=="i2o", RUN+="/lib/udev/load-modules.sh i2o_block"
+SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST!="[module/sg]", RUN+="/lib/udev/load-modules.sh sg"
+SUBSYSTEM=="module", KERNEL=="parport_pc", RUN+="/lib/udev/load-modules.sh ppdev"
LABEL="drivers_end"

View file

@ -1,27 +0,0 @@
diff -Nur udev-151.orig/extras/firmware/firmware.c udev-151/extras/firmware/firmware.c
--- udev-151.orig/extras/firmware/firmware.c 2009-12-15 16:19:30.000000000 +0100
+++ udev-151/extras/firmware/firmware.c 2010-01-31 13:17:09.195896260 +0100
@@ -149,6 +149,7 @@
util_path_encode(firmware, fwencpath, sizeof(fwencpath));
util_strscpyl(misspath, sizeof(misspath), udev_get_dev_path(udev), "/.udev/firmware-missing/", fwencpath, NULL);
+ util_strscpyl(loadpath, sizeof(loadpath), udev_get_sys_path(udev), devpath, "/loading", NULL);
if (fwfile == NULL) {
int err;
@@ -166,6 +167,7 @@
udev_selinux_resetfscreatecon(udev);
} while (err == -ENOENT);
rc = 2;
+ set_loading(udev, loadpath, "-1");
goto exit;
}
@@ -176,7 +178,6 @@
if (unlink(misspath) == 0)
util_delete_path(udev, misspath);
- util_strscpyl(loadpath, sizeof(loadpath), udev_get_sys_path(udev), devpath, "/loading", NULL);
set_loading(udev, loadpath, "1");
util_strscpyl(datapath, sizeof(datapath), udev_get_sys_path(udev), devpath, "/data", NULL);

View file

@ -1,13 +0,0 @@
#!/bin/sh
if [ -z "$1" ]; then
exit 1
fi
for f in ${DEVNAME} ${DEVLINKS}; do
if [ -e "/lib/udev/devices/${f#$1}" ]; then
exit 0
fi
done
exit 1

View file

@ -46,7 +46,7 @@ if [ "$MOD_AUTOLOAD" = "yes" -o "$MOD_AUTOLOAD" = "YES" ]; then
# If no modules could be found, try if the alias name is a module name
# In that case, omit the --use-blacklist parameter to imitate normal modprobe behaviour
[ -z "${mods}" ] && $MODPROBE -qni $1 && mods="$1" && USEBLACKLIST=""
[ -z "${mods}" ] && $LOGGER -p info -t "$(basename $0)" "'$1' is not a valid module or alias name"
[ -z "${mods}" ] && $LOGGER -p local0.debug -t "$(basename $0)" "'$1' is not a valid module or alias name"
for mod in ${mods}; do
# Find the module and all its dependencies
deps="$($MODPROBE -i --show-depends ${mod})"
@ -61,9 +61,9 @@ if [ "$MOD_AUTOLOAD" = "yes" -o "$MOD_AUTOLOAD" = "YES" ]; then
for dep in $deps; do
if echo "${BLACKLIST}" | /bin/grep -q -e " ${dep} " -e "^${dep} " -e " ${dep}\$"; then
if [ "${dep}" = "${mod}" ]; then
$LOGGER -p info -t "$(basename $0)" "Not loading module '${mod}' for alias '$1' because it is blacklisted"
$LOGGER -p local0.info -t "$(basename $0)" "Not loading module '${mod}' for alias '$1' because it is blacklisted"
else
$LOGGER -p info -t "$(basename $0)" "Not loading module '${mod}' for alias '$1' because its dependency '${dep}' is blacklisted"
$LOGGER -p local0.info -t "$(basename $0)" "Not loading module '${mod}' for alias '$1' because its dependency '${dep}' is blacklisted"
fi
continue 2
fi
@ -74,7 +74,7 @@ if [ "$MOD_AUTOLOAD" = "yes" -o "$MOD_AUTOLOAD" = "YES" ]; then
$MODPROBE $USEBLACKLIST ${mod}
done
else
$MODPROBE $1
$MODPROBE $USEBLACKLIST $1
fi
fi
# vim: set et ts=4: