diff --git a/udev/81-chakra.rules b/udev/81-chakra.rules index 69431c571..c3fac4bed 100644 --- a/udev/81-chakra.rules +++ b/udev/81-chakra.rules @@ -1,138 +1,15 @@ -# Udev rules for Chakra GNU/Linux by Tobias Powalowski +# Udev rules for Chakra GNU/Linux by Phil Miller # 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 -# - -##################################### -###### 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 Chakra GNU/Linux -# Permissions and Symlinks - begin -##################################### - -# permission for sg devices -KERNEL=="sg[0-9]*", ATTRS{type}!="3|6", GROUP="disk", MODE="0660" +# this file is going away in the near future # 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" +SUBSYSTEMS=="scsi", KERNEL=="s[rg][0-9]*", ATTRS{type}=="5", GROUP="optical" # misc -KERNEL=="sgi_fetchop", MODE="0666" -KERNEL=="sonypi", MODE="0666" +KERNEL=="sonypi", MODE="0666" # USB devices -KERNEL=="legousbtower*", MODE="0666" - -# kbd devices -KERNEL=="kbd", MODE="0664" - -# miscellaneous -KERNEL=="rtc|rtc0", GROUP="audio", MODE="0664" -####################################### -# Permissions and Symlinks - end -####################################### +KERNEL=="legousbtower*", MODE="0666" \ No newline at end of file diff --git a/udev/82-optical-symlinks.rules b/udev/82-optical-symlinks.rules new file mode 100644 index 000000000..b46700d18 --- /dev/null +++ b/udev/82-optical-symlinks.rules @@ -0,0 +1,12 @@ +# These rules create /dev/{cdrom,dvd,...} symlinks +SUBSYSTEM=="block", KERNEL=="sr0" , SYMLINK+="cdrom cdrw dvd dvdrw" +SUBSYSTEM=="block", KERNEL=="sr1" , SYMLINK+="cdrom1 cdrw1 dvd1 dvdrw1" +SUBSYSTEM=="block", KERNEL=="sr2" , SYMLINK+="cdrom2 cdrw2 dvd2 dvdrw2" +SUBSYSTEM=="block", KERNEL=="sr3" , SYMLINK+="cdrom3 cdrw3 dvd3 dvdrw3" +SUBSYSTEM=="block", KERNEL=="sr4" , SYMLINK+="cdrom4 cdrw4 dvd4 dvdrw4" +SUBSYSTEM=="block", KERNEL=="sr5" , SYMLINK+="cdrom5 cdrw5 dvd5 dvdrw5" +SUBSYSTEM=="block", KERNEL=="sr6" , SYMLINK+="cdrom6 cdrw6 dvd6 dvdrw6" +SUBSYSTEM=="block", KERNEL=="sr7" , SYMLINK+="cdrom7 cdrw7 dvd7 dvdrw7" +SUBSYSTEM=="block", KERNEL=="sr8" , SYMLINK+="cdrom8 cdrw8 dvd8 dvdrw8" +SUBSYSTEM=="block", KERNEL=="sr9" , SYMLINK+="cdrom9 cdrw9 dvd9 dvdrw9" + diff --git a/udev/PKGBUILD b/udev/PKGBUILD index ac1a70153..c0f69aa9d 100644 --- a/udev/PKGBUILD +++ b/udev/PKGBUILD @@ -6,108 +6,102 @@ pkgbase="udev" pkgname=('udev' 'udev-compat') -pkgver=166 -pkgrel=1 -arch=(i686 x86_64) +pkgver=175 +pkgrel=3 +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' 'libusb' 'pciutils' 'glib2' 'kernel26' 'gperf' 'libxslt' 'gobject-introspection>=0.10.0') -source=(http://www.kernel.org/pub/linux/utils/kernel/hotplug/$pkgname-$pkgver.tar.bz2 - 80-drivers.rules - 81-chakra.rules - load-modules.sh - cdsymlinks.sh) -md5sums=('4db27d73fdbe94f47fd89fdd105c2dfb' - '4427855146513a4703ab5c7eb8a0156e' - 'a2bf84747f44915ec9c5e6e88b077845' - 'f91fddc67609b45b244a624977c4247b' - '2e808ee78d237c478b57af2a68d43769') +makedepends=('gobject-introspection' 'gperf') +source=("http://people.freedesktop.org/~kay/udev/${pkgbase}-${pkgver}.tar.bz2" + '81-chakra.rules' + '82-optical-symlinks.rules') +md5sums=('2fc9c1efcbde98e3d73ffee7a77aea47' + '8455185f071187579a252dd0505b72cf' + '4538d729fa292fbb8f9dca6265dc9c14') build() { - cd $srcdir/$pkgname-$pkgver - ./configure --sysconfdir=/etc --with-rootlibdir=/lib --libexecdir=/lib/udev\ - --sbindir=/sbin --with-systemdsystemunitdir=/lib/systemd/system + cd "${srcdir}/${pkgbase}-${pkgver}" + + ./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() { pkgdesc="The userspace dev tools (udev)" - depends=('glibc' 'coreutils' 'util-linux' 'libusb' 'pciutils' 'glib2' - 'module-init-tools>=3.11') - install=udev.install - backup=(etc/udev/udev.conf - etc/modprobe.d/framebuffer_blacklist.conf) + depends=('util-linux' 'libusb-compat' 'glib2' 'module-init-tools' 'pciutils') + install='udev.install' + backup=(etc/udev/udev.conf) conflicts=('pcmcia-cs' 'hotplug' 'initscripts<2009.07') replaces=('devfsd') - cd $srcdir/$pkgname-$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-chakra.rules $pkgdir/lib/udev/rules.d/81-chakra.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 + cd "${srcdir}/${pkgbase}-${pkgver}" + make DESTDIR="${pkgdir}" install - # 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 + # Setup the udev rules directory + install -d -m755 "${pkgdir}/lib/udev/rules.d" + for rule in "${srcdir}"/*.rules; do + install -m644 "${rule}" "${pkgdir}/lib/udev/rules.d" done - # create static devices in /lib/udev/devices/ - mkdir ${pkgdir}/lib/udev/devices/pts - mkdir ${pkgdir}/lib/udev/devices/shm + # create framebuffer blacklist + install -d -m755 "${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}/lib/modprobe.d/framebuffer_blacklist.conf" - 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 + # /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" - 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 - 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 + for i in "${pkgdir}/lib/udev/rules.d"/*.rules; do sed -i -e 's#GROUP="dialout"#GROUP="uucp"#g; s#GROUP="tape"#GROUP="storage"#g; - s#GROUP="cdrom"#GROUP="optical"#g' $i + s#GROUP="cdrom"#GROUP="optical"#g' "${i}" done } 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 -m644 "${srcdir}/${pkgbase}-${pkgver}/rules/misc/30-kernel-compat.rules" "${pkgdir}/lib/udev/rules.d" + # create static devices in /lib/udev/devices/ + mkdir -p "${pkgdir}/lib/udev/devices"/{pts,shm} + + mknod -m0600 "${pkgdir}/lib/udev/devices/console" c 5 1 + mknod -m0666 "${pkgdir}/lib/udev/devices/null" c 1 3 + mknod -m0660 "${pkgdir}/lib/udev/devices/zero" c 1 5 + mknod -m0666 "${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 + install -d -m755 "${pkgdir}/lib/udev/devices/net" + # /dev/net/tun + mknod -m0666 "${pkgdir}/lib/udev/devices/net/tun" c 10 200 + # /dev/fuse + mknod -m0666 "${pkgdir}/lib/udev/devices/fuse" c 10 229 + # /dev/ppp + mknod -m0600 "${pkgdir}/lib/udev/devices/ppp" c 108 0 } + +# vim:set ts=2 sw=2 et: diff --git a/udev/static-node-permission.patch b/udev/static-node-permission.patch new file mode 100644 index 000000000..3d9a8722c --- /dev/null +++ b/udev/static-node-permission.patch @@ -0,0 +1,26 @@ +From 36acdbcc776822624103eff7c80a9468317918ac Mon Sep 17 00:00:00 2001 +From: Kay Sievers +Date: Mon, 11 Jul 2011 22:56:37 +0200 +Subject: [PATCH] udevd: fix (recently) broken static node permission setting + +Many thanks to Tom Gundersen for identifying the issue. +--- + udev/udev-rules.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/udev/udev-rules.c b/udev/udev-rules.c +index d16c1f9..7db0767 100644 +--- a/udev/udev-rules.c ++++ b/udev/udev-rules.c +@@ -2721,7 +2721,7 @@ void udev_rules_apply_static_dev_perms(struct udev_rules *rules) + struct stat stats; + + /* we assure, that the permissions tokens are sorted before the static token */ +- if (uid == 0 && gid == 0) ++ if (mode == 0 && uid == 0 && gid == 0) + goto next; + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(rules->udev), "/", + &rules->buf[cur->key.value_off], NULL); +-- +1.7.6 + diff --git a/udev/udev.install b/udev/udev.install index cdde9d744..7f8a6f0af 100644 --- a/udev/udev.install +++ b/udev/udev.install @@ -2,20 +2,52 @@ # arg 2: the old package version post_upgrade() { - if [ "$(vercmp $2 100)" -lt 0 ]; then + if [ "$(vercmp $2 172)" -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-chakra.txt" - echo "----------" + 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 "Chakra specific cd symlinks are now no longer created." + echo " --" + echo "cd and net persistent rules will no longer be autogenerated," + echo "see for details." + echo " --" + echo "Errors are now logged (possibly to the console) by default." + echo " --" + fi + if [ "$(vercmp $2 171)" -lt 0 ]; then + echo "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 + 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 /lib/modprobe.d" + echo "Any customizations shoud be done to the file in /etc, as it 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 the video group" + echo "(permissions and ownership of fb devices are controlled by X)." + 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 + # and 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}