diff options
author | Matthias Schwarzott <zzam@gentoo.org> | 2007-04-23 20:18:22 +0000 |
---|---|---|
committer | Matthias Schwarzott <zzam@gentoo.org> | 2007-04-23 20:18:22 +0000 |
commit | 567dc7a1b50317426f9591997943c0a714101c0d (patch) | |
tree | b1c177c03b67f4eb35b428df16b1164705ee5dd5 /sys-fs/udev/files | |
parent | Keyworded ~x86-fbsd (diff) | |
download | historical-567dc7a1b50317426f9591997943c0a714101c0d.tar.gz historical-567dc7a1b50317426f9591997943c0a714101c0d.tar.bz2 historical-567dc7a1b50317426f9591997943c0a714101c0d.zip |
Removing variable that was unconditionally added to env of all events, saving lot of space, Bug #173476. Restricting /dev-tmpfs in size, 10M by default. Added persistent links for joysticks. Finally removed /etc/dev.d. Make moving persistent-rules from tmp-storage to /etc more generic.
Package-Manager: portage-2.1.2.4
Diffstat (limited to 'sys-fs/udev/files')
-rw-r--r-- | sys-fs/udev/files/digest-udev-108-r1 | 3 | ||||
-rw-r--r-- | sys-fs/udev/files/udev-108-cleanup-early-rules.diff | 11 | ||||
-rw-r--r-- | sys-fs/udev/files/udev-108-persistent-joystick.diff | 19 | ||||
-rw-r--r-- | sys-fs/udev/files/udev-start-108-r1.sh | 149 | ||||
-rwxr-xr-x | sys-fs/udev/files/udev-stop-108-r1.sh | 96 | ||||
-rw-r--r-- | sys-fs/udev/files/udev.conf.post_108 | 19 |
6 files changed, 297 insertions, 0 deletions
diff --git a/sys-fs/udev/files/digest-udev-108-r1 b/sys-fs/udev/files/digest-udev-108-r1 new file mode 100644 index 000000000000..38c2b79089e7 --- /dev/null +++ b/sys-fs/udev/files/digest-udev-108-r1 @@ -0,0 +1,3 @@ +MD5 67935abde67b23e7c6e86e0be77c5e4b udev-108.tar.bz2 187460 +RMD160 cfc3885bdbb1a3611118c8503efe3ffe472b0f2d udev-108.tar.bz2 187460 +SHA256 0956fd6e7388cbb9c3431db302e52f8ee03d7fad8a159359597878058d8632ec udev-108.tar.bz2 187460 diff --git a/sys-fs/udev/files/udev-108-cleanup-early-rules.diff b/sys-fs/udev/files/udev-108-cleanup-early-rules.diff new file mode 100644 index 000000000000..ee6e26883f71 --- /dev/null +++ b/sys-fs/udev/files/udev-108-cleanup-early-rules.diff @@ -0,0 +1,11 @@ +diff -r -ru udev-108-orig/etc/udev/gentoo/05-udev-early.rules udev-108/etc/udev/gentoo/05-udev-early.rules +--- udev-108-orig/etc/udev/gentoo/05-udev-early.rules 2007-04-11 09:32:13.007423206 +0200 ++++ udev-108/etc/udev/gentoo/05-udev-early.rules 2007-04-11 09:32:30.587306470 +0200 +@@ -7,7 +7,3 @@ + ACTION=="add", KERNEL=="[0-9]*:[0-9]*", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" + ACTION=="add", SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" + ACTION=="add", SUBSYSTEM=="net", ENV{PHYSDEVDRIVER}=="?*", WAIT_FOR_SYSFS="device/driver" +- +-# Set IN_HOTPLUG for compatibility with init-scripts called from udev +-ENV{IN_HOTPLUG}="1" +- diff --git a/sys-fs/udev/files/udev-108-persistent-joystick.diff b/sys-fs/udev/files/udev-108-persistent-joystick.diff new file mode 100644 index 000000000000..091b2e0795b1 --- /dev/null +++ b/sys-fs/udev/files/udev-108-persistent-joystick.diff @@ -0,0 +1,19 @@ +diff --git a/etc/udev/rules.d/60-persistent-input.rules b/etc/udev/rules.d/60-persistent-input.rules +index 623eb7d..503e61e 100644 +--- a/etc/udev/rules.d/60-persistent-input.rules ++++ b/etc/udev/rules.d/60-persistent-input.rules +@@ -18,12 +18,12 @@ ATTRS{modalias}=="input:*-*a[068],*|input:*-*a*,[68],*m*", ATTRS{modalias}!="inp + ENV{ID_CLASS}=="?*", ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial" + + # by-id links +-KERNEL=="mouse*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_CLASS}" ++KERNEL=="mouse*|js*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_CLASS}" + KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{ID_CLASS}" + + # by-path + IMPORT{program}="path_id %p" +-ENV{ID_PATH}=="?*", KERNEL=="mouse*", SYMLINK+="input/by-path/$env{ID_PATH}-$env{ID_CLASS}" ++ENV{ID_PATH}=="?*", KERNEL=="mouse*|js*", SYMLINK+="input/by-path/$env{ID_PATH}-$env{ID_CLASS}" + ENV{ID_PATH}=="?*", KERNEL=="event*", SYMLINK+="input/by-path/$env{ID_PATH}-event-$env{ID_CLASS}" + + LABEL="persistent_input_end" diff --git a/sys-fs/udev/files/udev-start-108-r1.sh b/sys-fs/udev/files/udev-start-108-r1.sh new file mode 100644 index 000000000000..677dc722270f --- /dev/null +++ b/sys-fs/udev/files/udev-start-108-r1.sh @@ -0,0 +1,149 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +tmpfs_size="10M" + +[ -e /etc/udev/udev.conf ] && . /etc/udev/udev.conf + +populate_udev() { + # populate /dev with devices already found by the kernel + + # tell modprobe.sh to be verbose to $CONSOLE + echo CONSOLE=${CONSOLE} > /dev/.udev_populate + + if get_bootparam "nocoldplug" ; then + RC_COLDPLUG="no" + ewarn "Skipping udev coldplug as requested in kernel cmdline" + fi + + if [ $(get_KV) -gt $(KV_to_int '2.6.14') ] ; then + ebegin "Populating /dev with existing devices through uevents" + local opts= + [ "${RC_COLDPLUG}" != "yes" ] && opts="--attr-match=dev" + /sbin/udevtrigger ${opts} + eend $? + else + ebegin "Populating /dev with existing devices with udevstart" + /sbin/udevstart + eend $? + fi + + # loop until everything is finished + # there's gotta be a better way... + ebegin "Letting udev process events" + /sbin/udevsettle --timeout=60 + eend $? + + rm -f /dev/.udev_populate + return 0 +} + +seed_dev() { + # Seed /dev with some things that we know we need + ebegin "Seeding /dev with needed nodes" + + # creating /dev/console and /dev/tty1 to be able to write + # to $CONSOLE with/without bootsplash before udevd creates it + [ ! -c /dev/console ] && mknod /dev/console c 5 1 + [ ! -c /dev/tty1 ] && mknod /dev/tty1 c 4 1 + + # udevd will dup its stdin/stdout/stderr to /dev/null + # and we do not want a file which gets buffered in ram + [ ! -c /dev/null ] && mknod /dev/null c 1 3 + + # copy over any persistant things + if [ -d /lib/udev/devices ] ; then + cp --preserve=all --recursive --update /lib/udev/devices/* /dev 2>/dev/null + fi + + # Not provided by sysfs but needed + ln -snf /proc/self/fd /dev/fd + ln -snf fd/0 /dev/stdin + ln -snf fd/1 /dev/stdout + ln -snf fd/2 /dev/stderr + [ -e /proc/kcore ] && ln -snf /proc/kcore /dev/core + + # Create problematic directories + mkdir -p /dev/pts /dev/shm + eend 0 +} + +unpack_device_tarball() { + # Actually get udev rolling + if [ "${RC_DEVICE_TARBALL}" = "yes" ] && \ + [ -s /lib/udev/state/devices.tar.bz2 ] ; then + ebegin "Populating /dev with saved device nodes" + try tar -jxpf /lib/udev/state/devices.tar.bz2 -C /dev + eend $? + fi +} + +main() { + # Setup temporary storage for /dev + ebegin "Mounting /dev for udev" + if [ "${RC_USE_FSTAB}" = "yes" ] ; then + mntcmd=$(get_mount_fstab /dev) + else + unset mntcmd + fi + if [ -n "${mntcmd}" ] ; then + try mount -n ${mntcmd} + else + mntopts="exec,nosuid,mode=0755,size=${tmpfs_size}" + if grep -Eq "[[:space:]]+tmpfs$" /proc/filesystems ; then + mntcmd="tmpfs" + else + mntcmd="ramfs" + fi + # many video drivers require exec access in /dev #92921 + try mount -n -t "${mntcmd}" -o "${mntopts}" udev /dev + fi + eend $? + + # Create a file so that our rc system knows it's still in sysinit. + # Existance means init scripts will not directly run. + # rc will remove the file when done with sysinit. + touch /dev/.rcsysinit + + # Selinux lovin; /selinux should be mounted by selinux-patched init + if [ -x /sbin/restorecon ] && [ -c /selinux/null ] ; then + restorecon /dev > /selinux/null + fi + + unpack_device_tarball + seed_dev + + # Setup hotplugging (if possible) + if [ -e /proc/sys/kernel/hotplug ] ; then + ebegin "Setting up proper hotplug agent" + eindent + if [ $(get_KV) -gt $(KV_to_int '2.6.14') ] ; then + einfo "Using netlink for hotplug events..." + echo "" > /proc/sys/kernel/hotplug + else + einfo "Setting /sbin/udevsend as hotplug agent ..." + echo "/sbin/udevsend" > /proc/sys/kernel/hotplug + fi + eoutdent + eend 0 + fi + + ebegin "Starting udevd" + /sbin/udevd --daemon + eend $? + + populate_udev + + # Create nodes that udev can't + ebegin "Finalizing udev configuration" + [ -x /sbin/lvm ] && \ + /sbin/lvm vgscan -P --mknodes --ignorelockingfailure &>/dev/null + # Running evms_activate on a LiveCD causes lots of headaches + [ -z "${CDBOOT}" ] && [ -x /sbin/evms_activate ] && \ + /sbin/evms_activate -q &>/dev/null + eend 0 +} + +main + +# vim:ts=4 diff --git a/sys-fs/udev/files/udev-stop-108-r1.sh b/sys-fs/udev/files/udev-stop-108-r1.sh new file mode 100755 index 000000000000..a38baf133146 --- /dev/null +++ b/sys-fs/udev/files/udev-stop-108-r1.sh @@ -0,0 +1,96 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +# store persistent-rules that got created while booting +# when / was still read-only +store_persistent_rules() { + local file dest + + for file in /dev/.udev/tmp-rules--*; do + dest=${file##*tmp-rules--} + [ "$dest" = '*' ] && break + type=${dest##70-persistent-} + type=${type%%.rules} + einfo "Saving udev persistent ${type} rules to /etc/udev/rules.d" + cat "$file" >> /etc/udev/rules.d/"$dest" + rm -f "$file" + done +} + +create_device_tarball() { + if [ -e /dev/.devfsd ] || [ ! -e /dev/.udev ] || [ ! -z "${CDBOOT}" ] || \ + [ "${RC_DEVICE_TARBALL}" != "yes" ] || \ + ! touch /lib/udev/state/devices.tar.bz2 2>/dev/null + then + return 0 + fi + + ebegin "Saving device nodes" + # Handle our temp files + save_tmp_base=/tmp/udev.savedevices."$$" + devices_udev="${save_tmp_base}"/devices.udev + devices_real="${save_tmp_base}"/devices.real + devices_totar="${save_tmp_base}"/devices.totar + device_tarball="${save_tmp_base}"/devices + + rm -rf "${save_tmp_base}" + mkdir "${save_tmp_base}" + touch "${devices_udev}" "${devices_real}" \ + "${devices_totar}" "${device_tarball}" + + if [ -f ${devices_udev} ] && [ -f ${devices_real} ] && \ + [ -f ${devices_totar} ] && [ -f ${device_tarball} ] ; then + cd /dev + # Find all devices + find . -xdev -type b -or -type c -or -type l | cut -d/ -f2- > \ + "${devices_real}" + # Figure out what udev created + udevinfo=$(udevinfo --export-db) + + # This basically strips 'S:' and 'N:' from the db output, and then + # print all the nodes/symlinks udev created ... + echo "${udevinfo}" | gawk ' + /^(N|S):.+/ { + sub(/^(N|S):/, "") + split($0, nodes) + for (x in nodes) + print nodes[x] + }' > "${devices_udev}" + # These ones we also do not want in there + for x in MAKEDEV core fd initctl pts shm stderr stdin stdout; do + echo "${x}" >> "${devices_udev}" + done + if [ -d /lib/udev/devices ]; then + cd /lib/udev/devices + find . -xdev -type b -or -type c -or -type l | cut -d/ -f2- >> "${devices_udev}" + fi + cd /dev + fgrep -x -v -f "${devices_udev}" < "${devices_real}" | \ + grep -v ^\\.udev > "${devices_totar}" + + # Now only tarball those not created by udev if we have any + if [ -s ${devices_totar} ]; then + # we dont want to descend into mounted filesystems (e.g. devpts) + # looking up username may involve NIS/network, and net may be down + tar --one-file-system --numeric-owner -jcpf "${device_tarball}" -T "${devices_totar}" + mv -f "${device_tarball}" /lib/udev/state/devices.tar.bz2 + else + rm -f /lib/udev/state/devices.tar.bz2 + fi + eend 0 + else + eend 1 "Could not create temporary files!" + fi + + rm -rf "${save_tmp_base}" +} + +main() { + store_persistent_rules + create_device_tarball +} + +main + + +# vim:ts=4 diff --git a/sys-fs/udev/files/udev.conf.post_108 b/sys-fs/udev/files/udev.conf.post_108 new file mode 100644 index 000000000000..7d4f87a57afd --- /dev/null +++ b/sys-fs/udev/files/udev.conf.post_108 @@ -0,0 +1,19 @@ +# /etc/udev/udev.conf: main config file for udev +# $Header: /var/cvsroot/gentoo-x86/sys-fs/udev/files/udev.conf.post_108,v 1.1 2007/04/23 20:18:22 zzam Exp $ +# +# This file can be used to override some of udev's default values. +# See the udev man page for more details about these values. + +# udev_root - where in the filesystem to place the device nodes +udev_root="/dev/" + +# udev_rules - The name and location of the udev rules file +udev_rules="/etc/udev/rules.d/" + +# The initial syslog(3) priority: "err", "info", "debug" or its +# numerical equivalent. For runtime debugging, the daemons internal +# state can be changed with: "udevcontrol log_priority=<value>". +udev_log="err" + +# The maximum size reserved for the tmpfs mounted on /dev +tmpfs_size="10M" |