summaryrefslogtreecommitdiffstats
path: root/testing/udev
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2010-10-04 11:51:22 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2010-10-04 11:51:22 +0000
commit00988521484a48ddcb6df5ec319277a27b8087c7 (patch)
tree74de629d5fbb69fe3769eb98f4c99901e31eadce /testing/udev
parentd13f1399e367057ba18c55fcb8792228b8529e7a (diff)
downloadaports-00988521484a48ddcb6df5ec319277a27b8087c7.tar.bz2
aports-00988521484a48ddcb6df5ec319277a27b8087c7.tar.xz
main/udev: moved from testing
Diffstat (limited to 'testing/udev')
-rw-r--r--testing/udev/APKBUILD58
-rwxr-xr-xtesting/udev/move_tmp_persistent_rules.sh25
-rw-r--r--testing/udev/udev-mount.initd61
-rw-r--r--testing/udev/udev-postmount.initd37
-rw-r--r--testing/udev/udev.confd64
-rw-r--r--testing/udev/udev.initd238
-rwxr-xr-xtesting/udev/write_root_link_rule29
7 files changed, 0 insertions, 512 deletions
diff --git a/testing/udev/APKBUILD b/testing/udev/APKBUILD
deleted file mode 100644
index f48f99f5a..000000000
--- a/testing/udev/APKBUILD
+++ /dev/null
@@ -1,58 +0,0 @@
-# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
-pkgname=udev
-pkgver=162
-pkgrel=0
-pkgdesc="The userspace dev tools (udev)"
-url="http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html"
-license="GPL"
-subpackages="$pkgname-dev $pkgname-doc libgudev"
-depends=
-makedepends="gobject-introspection glib-dev gperf acl-dev libusb-compat-dev
- usbutils pciutils-dev libtool"
-install=
-source="http://www.kernel.org/pub/linux/utils/kernel/hotplug/$pkgname-$pkgver.tar.bz2
- write_root_link_rule
- move_tmp_persistent_rules.sh
- udev-mount.initd
- udev-postmount.initd
- udev.initd"
-
-build ()
-{
- cd "$srcdir"/$pkgname-$pkgver
- ./configure --prefix=/usr \
- --sysconfdir=/etc \
- --sbindir=/sbin \
- --libdir=/usr/lib \
- --with-rootlibdir=/lib \
- --libexecdir=/lib/udev \
- || return 1
- make || return 1
-}
-
-package() {
- cd "$srcdir"/$pkgname-$pkgver
- make DESTDIR="$pkgdir" install
-
- mkdir -p "$pkgdir"/usr/lib/pkgconfig
- chmod +x "$pkgdir"/lib/udev/write_*_rules
- for _i in write_root_link_rule move_tmp_persistent_rules.sh; do
- install -Dm755 ../$_i "$pkgdir"/lib/udev/$_i
- done
- for _i in udev udev-mount udev-postmount; do
- install -Dm755 ../$_i.initd "$pkgdir"/etc/init.d/$_i
- done
-}
-
-libgudev() {
- pkgdesc="A GObject wrapper of the library gudev"
- mkdir -p "$subpkgdir"/usr/lib/
- mv "$pkgdir"/usr/lib/libgudev* "$subpkgdir"/usr/lib/
-}
-
-md5sums="dd7099242e92084605e07db0c7299a02 udev-162.tar.bz2
-c9de7581099cdfdcd105666cd98a0f0a write_root_link_rule
-7bf11e11519117f743483c73e0767750 move_tmp_persistent_rules.sh
-884d7faaaa149a323b14e907ea1934f4 udev-mount.initd
-8f0a1b371804c7fa30f1a7bfde88e9ea udev-postmount.initd
-42b7e4ad49874e68851fc21153f41c4f udev.initd"
diff --git a/testing/udev/move_tmp_persistent_rules.sh b/testing/udev/move_tmp_persistent_rules.sh
deleted file mode 100755
index 1a0259798..000000000
--- a/testing/udev/move_tmp_persistent_rules.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-# Copyright 1999-2007 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-. /etc/init.d/functions.sh
-
-# 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}
- ebegin "Saving udev persistent ${type} rules to /etc/udev/rules.d"
- cat "$file" >> /etc/udev/rules.d/"$dest" && rm -f "$file"
- eend $? "Failed moving persistent rules!"
- done
-}
-
-store_persistent_rules
-
-# vim:ts=4
diff --git a/testing/udev/udev-mount.initd b/testing/udev/udev-mount.initd
deleted file mode 100644
index f0d8cc39f..000000000
--- a/testing/udev/udev-mount.initd
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/sbin/runscript
-# Copyright 1999-2010 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-description="Mount tmpfs on /dev"
-[ -e /etc/conf.d/udev ] && . /etc/conf.d/udev
-
-mount_dev_directory()
-{
- if mountinfo -q /dev; then
- einfo "/dev is already mounted"
- return 0
- fi
-
- # No options are processed here as they should all be in /etc/fstab
- ebegin "Mounting /dev"
- if ! fstabinfo --mount /dev; then
- # we mount devtmpfs if supported
- local fs=tmpfs
- grep -qs devtmpfs /proc/filesystems && fs=devtmpfs
-
- # Some devices require exec, Bug #92921
- mount -n -t "$fs" -o "exec,nosuid,mode=0755,size=10M" udev /dev
- fi
- eend $?
-}
-
-seed_dev()
-{
- # Seed /dev with some things that we know we need
-
- # creating /dev/console, /dev/tty and /dev/tty1 to be able to write
- # to $CONSOLE with/without bootsplash before udevd creates it
- [ -c /dev/console ] || mknod -m 600 /dev/console c 5 1
- [ -c /dev/tty1 ] || mknod -m 620 /dev/tty1 c 4 1
- [ -c /dev/tty ] || mknod -m 666 /dev/tty c 5 0
-
- # 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 -m 666 /dev/null c 1 3
-
- # so udev can add its start-message to dmesg
- [ -c /dev/kmsg ] || mknod -m 660 /dev/kmsg c 1 11
-
- # Create problematic directories
- mkdir -p /dev/pts /dev/shm
- return 0
-}
-
-
-start()
-{
- mount_dev_directory || return 1
-
- # make sure it exists
- mkdir -p /dev/.udev /dev/.udev/rules.d
-
- seed_dev
-
- return 0
-}
diff --git a/testing/udev/udev-postmount.initd b/testing/udev/udev-postmount.initd
deleted file mode 100644
index 33a412ff8..000000000
--- a/testing/udev/udev-postmount.initd
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/sbin/runscript
-# Copyright 1999-2010 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-fs/udev/files/161/udev-postmount.initd,v 1.1 2010/08/24 18:41:29 zzam Exp $
-
-depend() {
- need localmount
- after dbus # for trigger failed
-}
-
-dir_writeable()
-{
- printf "" 2>/dev/null >"$1"/.test.$$ && rm "$1"/.test.$$
-}
-
-start() {
- # check if this system uses udev
- [ -d /dev/.udev/ ] || return 0
-
- einfo "Doing udev cleanups"
-
- # Run the events that failed at first udev trigger
- udevadm trigger --type=failed -v
-
- # only continue if rules-directory is writable
- dir_writeable /etc/udev/rules.d || return 0
-
- # store persistent-rules that got created while booting
- # when / was still read-only
- /lib/udev/move_tmp_persistent_rules.sh
-}
-
-stop() {
- :
-}
-
-# vim:ts=4
diff --git a/testing/udev/udev.confd b/testing/udev/udev.confd
deleted file mode 100644
index 7c3d3eb22..000000000
--- a/testing/udev/udev.confd
+++ /dev/null
@@ -1,64 +0,0 @@
-# /etc/conf.d/udev: config file for udev
-
-# We discourage to disable persistent-net!!
-# this may lead to random interface naming
-
-# Disable adding new rules for persistent-net
-persistent_net_disable="no"
-
-# Disable adding new rules for persistent-cd
-# Disabling this will stop new cdrom devices to appear
-# as /dev/{cdrom,cdrw,dvd,dvdrw}
-persistent_cd_disable="no"
-
-# Set to "yes" if you want to save /dev to a tarball on shutdown
-# and restore it on startup. This is useful if you have a lot of
-# custom device nodes that udev does not handle/know about.
-#
-# As this option is fragile, we recommend you
-# to create your devices in /lib/udev/devices.
-# These will be copied to /dev on boot.
-#rc_device_tarball="NO"
-
-# udev can trigger coldplug events which cause services to start and
-# kernel modules to be loaded.
-# Services are deferred to start in the boot runlevel.
-# Set rc_coldplug="NO" if you don't want this.
-# If you want module coldplugging but not coldplugging of services then you
-# can disable service coldplugging in baselayout/openrc config files.
-# The setting is named different in different versions.
-# in /etc/rc.conf: rc_hotplug="!*" or
-# in /etc/conf.d/rc: rc_plug_services="!*"
-#rc_coldplug="YES"
-
-
-
-
-# Expert options:
-
-# Disable warning about unreliable kernel/udev combination
-#unreliable_kernel_warning="no"
-
-# Timeout in seconds to wait for processing of uevents at boot.
-# There should be no need to change this.
-#udev_settle_timeout="60"
-
-# Add extra command line options to udevd, use with care
-# udevd --help for possible values
-#udev_opts=""
-
-# Run udevd --debug and write output to /dev/.udev/udev.log
-# Should not be kept on as it fills diskspace slowly
-#udev_debug="YES"
-
-# Run udevadmin monitor to get a log of all events
-# in /dev/.udev/udevmonitor.log
-#udev_monitor="YES"
-
-# Keep udevmonitor running after populating /dev.
-#udev_monitor_keep_running="no"
-
-# Set cmdline options for udevmonitor.
-# could be some of --env --kernel --udev
-#udev_monitor_opts="--env"
-
diff --git a/testing/udev/udev.initd b/testing/udev/udev.initd
deleted file mode 100644
index e48ea9b67..000000000
--- a/testing/udev/udev.initd
+++ /dev/null
@@ -1,238 +0,0 @@
-#!/sbin/runscript
-# Copyright 1999-2010 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-description="Run udevd and create the device-nodes"
-
-[ -e /etc/udev/udev.conf ] && . /etc/udev/udev.conf
-
-rc_coldplug=${rc_coldplug:-${RC_COLDPLUG:-YES}}
-
-depend()
-{
- provide dev
- if yesno "${rc_device_tarball:-no}"; then
- need sysfs udev-mount udev-dev-tarball
- else
- need sysfs udev-mount
- fi
- before checkfs fsck
-
- # udev does not work inside vservers
- keyword novserver nolxc noopenvz
-}
-
-cleanup()
-{
- # fail more gracely and not leave udevd running
- start-stop-daemon --stop --exec /sbin/udevd
- exit 1
-}
-
-disable_hotplug_agent()
-{
- if [ -e /proc/sys/kernel/hotplug ]; then
- echo "" >/proc/sys/kernel/hotplug
- fi
-}
-
-root_link()
-{
- /lib/udev/write_root_link_rule
-}
-
-rules_disable_switch()
-{
- # this function disables rules files
- # by creating new files with the same name
- # in a temp rules directory with higher priority
- local f=/dev/.udev/rules.d/"$1" bname="$1" onoff="$2"
-
- if yesno "${onoff}"; then
- echo "# This file disables ${bname} due to /etc/conf.d/udev" \
- > "${f}"
- else
- rm -f "${f}"
- fi
-}
-
-start_udevd()
-{
- # load unix domain sockets if built as module, Bug #221253
- if [ -e /proc/modules ] ; then
- modprobe -q unix 2>/dev/null
- fi
- local opts="${udev_opts}"
-
- ebegin "Starting udevd"
- if yesno "${udev_debug:-no}"; then
- /sbin/udevd --daemon ${opts} --debug 2>/dev/.udev/udev.log
- else
- start-stop-daemon --start --exec /sbin/udevd -- --daemon ${opts}
- fi
-
- eend $?
-}
-
-# populate /dev with devices already found by the kernel
-populate_dev()
-{
- if get_bootparam "nocoldplug" ; then
- rc_coldplug="NO"
- ewarn "Skipping udev coldplug as requested in kernel cmdline"
- fi
-
- ebegin "Populating /dev with existing devices through uevents"
- udevadm control --property=STARTUP=1
- if yesno "${rc_coldplug}"; then
- udevadm trigger --action="add"
- else
- # Do not run any init-scripts, Bug #206518
- udevadm control --property=do_not_run_plug_service=1
-
- # only create device nodes
- udevadm trigger --action="add" --attr-match=dev
-
- # run persistent-net stuff, bug 191466
- udevadm trigger --action="add" --subsystem-match=net
- fi
- eend $?
-
- # we can speed up booting under these conditions:
- # * using devtmpfs so kernel creates device nodes for us
- # * only using kernel created device nodes at boot (in /etc/fstab and elsewhere)
- #
- ebegin "Waiting for uevents to be processed"
- udevadm settle --timeout=${udev_settle_timeout:-60}
- eend $?
-
- udevadm control --property=do_not_run_plug_service=
- udevadm control --property=STARTUP=
- return 0
-}
-
-# for debugging
-start_udevmonitor()
-{
- yesno "${udev_monitor:-no}" || return 0
-
- udevmonitor_log=/dev/.udev/udevmonitor.log
- udevmonitor_pid=/dev/.udev/udevmonitor.pid
-
- einfo "udev: Running udevadm monitor ${udev_monitor_opts} to get a log of all events"
- start-stop-daemon --start --stdout "${udevmonitor_log}" \
- --make-pidfile --pidfile "${udevmonitor_pid}" \
- --background --exec /sbin/udevadm -- monitor ${udev_monitor_opts}
-}
-
-stop_udevmonitor()
-{
- yesno "${udev_monitor:-no}" || return 0
-
- if yesno "${udev_monitor_keep_running:-no}"; then
- ewarn "udev: udevmonitor is still running and writing into ${udevmonitor_log}"
- else
- einfo "udev: Stopping udevmonitor: Log is in ${udevmonitor_log}"
- start-stop-daemon --stop --pidfile "${udevmonitor_pid}" --exec /sbin/udevadm
- fi
-}
-
-display_hotplugged_services() {
- local svcfile= svc= services=
- for svcfile in "${RC_SVCDIR}"/hotplugged/*; do
- svc="${svcfile##*/}"
- [ -x "${svcfile}" ] || continue
-
- services="${services} ${svc}"
- done
- [ -n "${services}" ] && einfo "Device initiated services:${HILITE}${services}${NORMAL}"
-}
-
-check_persistent_net()
-{
- # check if there are problems with persistent-net
- local syspath= devs= problem=false
- for syspath in /sys/class/net/*_rename*; do
- if [ -d "${syspath}" ]; then
- devs="${devs} ${syspath##*/}"
- problem=true
- fi
- done
-
- ${problem} || return 0
-
- eerror "UDEV: Your system has a problem assigning persistent names"
- eerror "to these network interfaces: ${devs}"
-
- einfo "Checking persistent-net rules:"
- # the sed-expression lists all duplicate lines
- # from the input, like "uniq -d" does, but uniq
- # is installed into /usr/bin and not available at boot.
- dups=$(
- RULES_FILE='/etc/udev/rules.d/70-persistent-net.rules'
- . /lib/udev/rule_generator.functions
- find_all_rules 'NAME=' '.*' | \
- tr ' ' '\n' | \
- sort | \
- sed '$!N; s/^\(.*\)\n\1$/\1/; t; D'
- )
- if [ -n "${dups}" ]; then
- ewarn "The rules create multiple entries assigning these names:"
- eindent
- ewarn "${dups}"
- eoutdent
- else
- ewarn "Found no duplicate names in persistent-net rules,"
- ewarn "there must be some other problem!"
- fi
- return 1
-}
-
-check_udev_works()
-{
- # should exist on every system, else udev failed
- if [ ! -e /dev/zero ]; then
- eerror "Assuming udev failed somewhere, as /dev/zero does not exist."
- return 1
- fi
- return 0
-}
-
-start()
-{
- _start
-
- display_hotplugged_services
-
- return 0
-}
-
-_start()
-{
- if [ ! -e /etc/runlevels/${RC_DEFAULTLEVEL:-default}/udev-postmount ]; then
- ewarn "You should add udev-postmount service to your default runlevel."
- fi
-
- root_link
- rules_disable_switch 75-persistent-net-generator.rules "${persistent_net_disable:-no}"
- rules_disable_switch 75-cd-aliases-generator.rules ${persistent_cd_disable:-no}
-
- disable_hotplug_agent
- start_udevd || cleanup
- start_udevmonitor
- populate_dev || cleanup
-
- check_persistent_net
-
- check_udev_works || cleanup
- stop_udevmonitor
-
- return 0
-}
-
-stop() {
- ebegin "Stopping udevd"
- start-stop-daemon --stop --exec /sbin/udevd
- eend $?
-}
-
diff --git a/testing/udev/write_root_link_rule b/testing/udev/write_root_link_rule
deleted file mode 100755
index 8eaea1176..000000000
--- a/testing/udev/write_root_link_rule
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/sh
-#
-# This script should run before doing udevtrigger at boot.
-# It will create a rule matching the device directory / is on, and
-# creating /dev/root symlink pointing on its device node.
-#
-# This is especially useful for hal looking at /proc/mounts containing
-# a line listing /dev/root as device:
-# /dev/root / reiserfs rw 0 0
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation version 2 of the License.
-#
-# (c) 2007-2008 Matthias Schwarzott <zzam@gentoo.org>
-
-eval $(udevadm info --export --export-prefix="ROOT_" --device-id-of-file=/)
-
-[ $? = 0 ] || exit 0
-[ "$ROOT_MAJOR" = 0 ] && exit 0
-
-DIR=/dev/.udev/rules.d
-[ -d "$DIR" ] || mkdir -p "$DIR"
-RULES=$DIR/10-root-link.rules
-
-echo "# Created by /lib/udev/write_root_link_rule" > "${RULES}"
-echo "# This rule should create /dev/root as link to real root device." >> "${RULES}"
-echo "SUBSYSTEM==\"block\", ENV{MAJOR}==\"$ROOT_MAJOR\", ENV{MINOR}==\"$ROOT_MINOR\", SYMLINK+=\"root\"" >> "${RULES}"
-