core/udev-oxnas to 174-1

This commit is contained in:
Kevin Mihelich 2011-10-25 17:18:24 -04:00
parent 70076fab44
commit 7adc6f5180
8 changed files with 101 additions and 315 deletions

View file

@ -1,23 +0,0 @@
KERNEL!="sd[a-z][0-9]", GOTO="media_by_label_auto_mount_end"
PROGRAM="/bin/grep -q ' %M:%m /[^ ]* /' /proc/self/mountinfo", PROGRAM!="/bin/grep -q ' %M:%m / /media/' /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}="hd-%k"
# Global mount options
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"
# 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}"
# 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

@ -1,12 +0,0 @@
KERNEL!="mmcblk[0-9]p[0-9]", GOTO="sd_cards_auto_mount_end"
PROGRAM="/bin/grep -q ' %M:%m /[^ ]* /' /proc/self/mountinfo", PROGRAM!="/bin/grep -q ' %M:%m / /media/' /proc/self/mountinfo", 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,83 +1,9 @@
# Udev rules for Archlinux by Tobias Powalowski <tpowa@archlinux.org>
# do not edit this file, it will be overwritten on update
#
# There are a number of modifiers that are allowed to be used in some
# of the different fields. They provide the following subsitutions:
#
# %n the "kernel number" of the device.
# For example, 'sda3' has a "kernel number" of '3'
# %k the kernel name for the device.
# %M the kernel major number for the device
# %m the kernel minor number for the device
# %b the bus id for the device
# %c the string returned by the PROGRAM
# %s{filename} the content of a sysfs attribute.
# %% the '%' char itself.
#
# There are a number of modifiers that are allowed to be used in some of the
# fields. See the udev man page for a full description of them.
# global stuff
#
# this file is going away in the near future
# permission for sg devices
KERNEL=="sg[0-9]*", ATTRS{type}!="3|6", GROUP="disk", MODE="0660"
# permissions for IDE CD devices
SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTR{removable}=="1", ATTRS{media}=="cdrom*", GROUP="optical"
# permissions for SCSI CD devices
SUBSYSTEMS=="scsi", KERNEL=="sr[0-9]*", ATTRS{type}=="5", SYMLINK+="scd%n", GROUP="optical"
SUBSYSTEMS=="scsi", KERNEL=="sg[0-9]*", ATTRS{type}=="5", GROUP="optical"
# permissions for removable devices like cardreaders or sticks
KERNEL=="sd*", ATTRS{scsi_level}=="3", ATTRS{type}=="0", GROUP="storage"
# permissions for firewire external drives
KERNEL=="sd*", ATTRS{scsi_level}=="5", GROUP="storage"
# permissions for usb to scsi external adapters
KERNEL=="sd*", ATTRS{scsi_level}=="3", ATTRS{type}=="7", GROUP="storage"
# permissions for ide storage like pcmcia card readers
ACTION!="add", GOTO="pcmcia_end"
SUBSYSTEM!="block", GOTO="pcmcia_end"
KERNEL=="hd*[!0-9]", IMPORT{program}="ata_id --export $tempnode"
KERNEL=="hd*", IMPORT{parent}=="ID_*"
KERNEL=="hd*", ENV{ID_TYPE}=="generic", GROUP="storage"
LABEL="pcmcia_end"
# permissions for SCSI scanners
SUBSYSTEMS=="scsi", KERNEL=="sg[0-9]*", ATTRS{type}=="6", GROUP="scanner"
# mem
KERNEL=="ram0", SYMLINK+="ramdisk"
KERNEL=="ram1", SYMLINK+="ram"
# video4linux
KERNEL=="vbi0", SYMLINK+="vbi"
KERNEL=="radio0", SYMLINK+="radio"
KERNEL=="radio[0-9]*", GROUP="video"
KERNEL=="video0", SYMLINK+="video"
KERNEL=="vtx0", SYMLINK+="vtx"
# video devices
### xorg resets those permissions, adjust your xorg.conf!
KERNEL=="3dfx*", GROUP="video"
KERNEL=="fb[0-9]*", GROUP="video"
# misc
KERNEL=="sgi_fetchop", MODE="0666"
# this might belong in <http://aur.archlinux.org/packages.php?ID=22698>
# see also /usr/src/*/Documentation/laptops/sonypi.txt
KERNEL=="sonypi", MODE="0666"
# USB devices
# this might belong in <https://aur.archlinux.org/packages.php?ID=18393>
KERNEL=="legousbtower*", MODE="0666"
# kbd devices
KERNEL=="kbd", MODE="0664"
# miscellaneous
KERNEL=="rtc|rtc0", GROUP="audio", MODE="0664"
#######################################
# Permissions and Symlinks - end
#######################################

View file

@ -1,3 +1,4 @@
# $Id: PKGBUILD 141113 2011-10-24 09:59:23Z dreisner $
# Maintainer: Aaron Griffin <aaron@archlinux.org>
# Maintainer: Tobias Powalowski <tpowa@archlinux.org>
# Maintainer: Thomas Bächler <thomas@archlinux.org>
@ -5,88 +6,71 @@
# ALARM: Jason Plum <max@warheads.net>
# - Make this compatible with non-accept4 kernels.
# - noautobuild to keep from building on v7h
plugrel=2
plugrel=1
noautobuild=1
pkgbase="udev-oxnas"
pkgbaseplate="udev"
pkgname="udev-oxnas"
pkgver=171
pkgrel=2
_pkgbase='udev'
pkgname='udev-oxnas'
pkgver=174
pkgrel=1
arch=(i686 x86_64)
url="http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html"
license=('GPL')
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/$pkgbaseplate-$pkgver.tar.bz2
makedepends=('gobject-introspection' 'gperf')
#source=(http://www.kernel.org/pub/linux/utils/kernel/hotplug/$_pkgbase-$pkgver.tar.bz2
source=(http://people.freedesktop.org/~kay/$_pkgbase-$pkgver.tar.bz2
81-arch.rules
static-audio-nodes-group.patch
static-nodes-permissions.patch
pre-accept4-kernel.patch
)
pre-accept4-kernel.patch)
md5sums=('3b84706046a33d7a7e00491a1136804d'
'3da2bb9891592f9438a07bd641465531'
'c6d2de68c7a30f3deb2cbb151bc6749f')
build() {
cd $srcdir/$pkgbaseplate-$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
patch -Np1 -i ../pre-accept4-kernel.patch
./configure --sysconfdir=/etc --with-rootlibdir=/lib --libexecdir=/lib/udev\
--sbindir=/sbin --with-systemdsystemunitdir=/lib/systemd/system\
--disable-rule-generator
cd $srcdir/$_pkgbase-$pkgver
patch -Np1 -i ${srcdir}/pre-accept4-kernel.patch
./configure --sysconfdir=/etc\
--with-rootlibdir=/lib\
--libexecdir=/lib/udev\
--sbindir=/sbin\
--with-systemdsystemunitdir=/lib/systemd/system\
--disable-rule-generator\
--enable-udev_acl
make
}
package_udev-oxnas() {
pkgdesc="The userspace dev tools (udev-oxnas)"
depends=('glibc' 'coreutils' 'util-linux' 'libusb-compat' 'glib2'
'module-init-tools>=3.11' 'pciutils')
depends=('util-linux' 'libusb-compat' 'glib2' 'module-init-tools' 'pciutils')
install=udev.install
backup=(etc/udev/udev.conf
etc/modprobe.d/framebuffer_blacklist.conf)
backup=(etc/udev/udev.conf)
conflicts=('pcmcia-cs' 'hotplug' 'initscripts<2009.07' 'udev')
replaces=('devfsd')
provides=('udev=171')
provides=('udev=174')
cd $srcdir/$pkgbaseplate-$pkgver
cd $srcdir/$_pkgbase-$pkgver
make DESTDIR=${pkgdir} install
# Install our rule for permissions and symlinks
install -D -m644 $srcdir/81-arch.rules $pkgdir/lib/udev/rules.d/81-arch.rules
# create framebuffer blacklist
mkdir -p $pkgdir/etc/modprobe.d/
mkdir -p $pkgdir/lib/modprobe.d/
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
done | sort -u > $pkgdir/lib/modprobe.d/framebuffer_blacklist.conf
# create static devices in /lib/udev/devices/
mkdir ${pkgdir}/lib/udev/devices/pts
mkdir ${pkgdir}/lib/udev/devices/shm
mknod -m 0600 ${pkgdir}/lib/udev/devices/console c 5 1
mknod -m 0666 ${pkgdir}/lib/udev/devices/null c 1 3
mknod -m 0660 ${pkgdir}/lib/udev/devices/zero c 1 5
mknod -m 0666 ${pkgdir}/lib/udev/devices/kmsg c 1 11
ln -snf /proc/self/fd ${pkgdir}/lib/udev/devices/fd
ln -snf /proc/self/fd/0 ${pkgdir}/lib/udev/devices/stdin
ln -snf /proc/self/fd/1 ${pkgdir}/lib/udev/devices/stdout
ln -snf /proc/self/fd/2 ${pkgdir}/lib/udev/devices/stderr
ln -snf /proc/kcore ${pkgdir}/lib/udev/devices/core
# these static devices are created for convenience, to autoload the modules if necessary
# /dev/loop0
# /dev/loop0 is created for convenience, to autoload the module if necessary
# may be obsoleted by https://lkml.org/lkml/2011/7/30/111
mknod -m 0660 ${pkgdir}/lib/udev/devices/loop0 b 7 0
chgrp disk ${pkgdir}/lib/udev/devices/loop0
# /dev/net/tun
mkdir ${pkgdir}/lib/udev/devices/net
mknod -m 0666 ${pkgdir}/lib/udev/devices/net/tun c 10 200
# /dev/fuse
mknod -m 0666 ${pkgdir}/lib/udev/devices/fuse c 10 229
# /dev/ppp
mknod -m 0600 ${pkgdir}/lib/udev/devices/ppp c 108 0
# udevd moved, symlink to make life easy for restarting udevd manually
ln -s /lib/udev/udevd ${pkgdir}/sbin/udevd
# Replace dialout/tape/cdrom group in rules with uucp/storage/optical group
for i in $pkgdir/lib/udev/rules.d/*.rules; do
@ -95,9 +79,6 @@ package_udev-oxnas() {
s#GROUP="cdrom"#GROUP="optical"#g' $i
done
}
md5sums=('bdf4617284be2ecac11767437417e209'
'6ee44e3feb8e0f037947e7d4ca273f12'
'4f625aea95a5597afd8cdf189421f193'
'f9e50b8dfcd2215f5423ff9bc04ecf68'
'c6d2de68c7a30f3deb2cbb151bc6749f')
md5sums=('3b84706046a33d7a7e00491a1136804d'
'3da2bb9891592f9438a07bd641465531'
'8b28d85b2158be1b5a190135c9cc8851')

View file

@ -1,5 +1,6 @@
--- a/libudev/libudev-ctrl.c 2011-05-19 16:57:34.000000000 -0400
+++ b/libudev/libudev-ctrl.c 2011-07-04 00:06:09.000000000 -0400
diff -urN a/udev/udev-ctrl.c b/udev/udev-ctrl.c
--- a/udev/udev-ctrl.c 2011-10-09 17:10:32.000000000 -0600
+++ b/udev/udev-ctrl.c 2011-10-25 15:11:09.000000000 -0600
@@ -15,6 +15,7 @@
#include <stddef.h>
#include <string.h>
@ -8,7 +9,7 @@
#include <sys/types.h>
#include <sys/poll.h>
#include <sys/socket.h>
@@ -179,6 +180,7 @@
@@ -182,6 +183,7 @@
struct ucred ucred;
socklen_t slen;
const int on = 1;
@ -16,7 +17,7 @@
conn = calloc(1, sizeof(struct udev_ctrl_connection));
if (conn == NULL)
@@ -186,13 +188,19 @@
@@ -189,13 +191,19 @@
conn->refcount = 1;
conn->uctrl = uctrl;

View file

@ -1,27 +0,0 @@
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

View file

@ -1,57 +0,0 @@
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

View file

@ -2,64 +2,61 @@
# arg 2: the old package version
post_upgrade() {
if [ "$(vercmp $2 100)" -lt 0 ]; then
if [ "$(vercmp $2 174)" -lt 0 ]; then
echo "ATTENTION UDEV:"
echo "----------"
echo "udev >=098 rules syntax has changed, please update your own rules."
echo "udev >=099 Added persistent network and CD/DVD Symlink generator rules."
echo "Please read the instructions carefully before reboot."
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"
if [ "$(vercmp $2 168)" -lt 0 ]; then
echo "Kernel 2.6.32 or newer is now required."
echo " --"
echo "OSS emulation modules are not loaded by default, add to rc.conf if needed."
echo " --"
echo "Arch specific cd symlinks are now no longer created."
echo " --"
echo "cd and net persistent rules will no longer be autogenerated,"
echo "see <https://wiki.archlinux.org/index.php/Udev> for details."
echo " --"
echo "Errors are now logged (possibly to the console) by default."
echo " --"
fi
if [ "$(vercmp $2 171)" -lt 0 ]; then
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
if [ "$(vercmp $2 172)" -lt 0 ]; then
echo "Support for non-devtmpfs self-compiled kernels have been moved to udev-compat."
echo " --"
echo "Blacklisting of framebuffer devices has moved from /etc/modprobe.d to"
echo "/lib/modprobe.d. Any customizations shoud be done to the file in /etc, as it"
echo "takes precedence."
echo " --"
echo "kbd and rtc devices are no longer world readable."
echo " --"
echo "rtc is no longer in the audio group and fb devices are no longer in"
echo "the video group, as permissions and ownership of fb devices are controlled"
echo "by X."
echo " --"
fi
echo "We now use upstream rules for assigning devices to the 'disk', 'optical',"
echo "'scanner' and 'video' groups. Beware of any changes."
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 "We no longer create symlinks from /dev/<dev> to /dev/<dev>0."
echo " --"
echo "For security reasons, we no longer add devices to the 'storage' group. Use"
echo "udisks and friends, or add custom rules to /etc/udev.d/rules/, if you want"
echo "this functionality back."
echo " --"
echo "We no longer create the static nodes on install needed for an initrd-less and"
echo "devtmpfs-less boot, this only affects fresh installs."
echo "---------------"
fi
}
post_install() {
# If a ramfs is mounted, we still need to make sure that /dev/{console,null,zero} exist
# The Archlinux installer bind-mounts /dev to /mnt/dev, thus making the real /dev invisible
ROOTDIR=""
[ "$(stat -c %D /)" != "$(stat -c %D /dev)" ] && ROOTDIR=$(mktemp -d /tmp/udevinstall.XXXXXX)
[ -n "${ROOTDIR}" ] && mount --bind / ${ROOTDIR}
if [ ! -c ${ROOTDIR}/dev/console ]; then
rm -f ${ROOTDIR}/dev/console
mknod -m600 ${ROOTDIR}/dev/console c 5 1
fi
if [ ! -c ${ROOTDIR}/dev/null ]; then
rm -f ${ROOTDIR}/dev/null
mknod -m644 ${ROOTDIR}/dev/null c 1 3
fi
if [ ! -c ${ROOTDIR}/dev/zero ]; then
rm -f ${ROOTDIR}/dev/zero
mknod -m644 ${ROOTDIR}/dev/zero c 1 5
fi
if [ -n "${ROOTDIR}" ]; then
umount ${ROOTDIR}
rmdir ${ROOTDIR}
fi
}