Commit b56f8637 authored by Michael Biebl's avatar Michael Biebl
Browse files

Merge remaining files from udev 175-7

The patches from udev were either merged upstream, applied directly,
added as files to debian/extra/ or dropped:

- debian/patches/commit-4b50a3d0
  Applied upstream in 4b50a3d0
- debian/patches/fix_gtkdoc_oot
  Fixed upstream
- debian/patches/libudevpc_no_librt
  Fixed upstream in e712ffcc
- debian/patches/vio_type
  Dropped for now.
- debian/patches/debian_rules
  Added as debian/extra/rules/*
- debian/patches/extra_agents
  Added as debian/extra/*.agent and debian/extra/hotplug.functions
- debian/patches/extra_initramfs
  Added as debian/extra/initramfs.*
- debian/patches/extra_installer
  Added as debian/extra/udev.*
- debian/patches/extra_modprobeconf
  Added as debian/extra/fbdev-blacklist.conf and
  debian/extra/make-fbdev-blacklist
- debian/patches/extra_misc
  Added as debian/extra/links.conf and debian/extra/create_static_nodes
- debian/patches/dont-build-some-helpers
  Dropped, since we will use the upstream firmware agent now
- debian/patches/libgudev_in_usr
  Applied as 418b0a2d
- debian/patches/rules_compat_qemu
  Dropped, only needed for kernel versions <= 2.6.32
- debian/patches/use_run_tmpfs
  Dropped, since wheezy /run is mandatory
- debian/patches/dev_root_rule
  Dropped, discouraged upstream
- debian/patches/udevd_in_sbin
  Dropped, we will use the $libexec path now in the .service file and
  provide compat symlinks
- udev_conf_comments
  Applied as c82d84e9
parent 60deb488
#!/bin/sh -e
make_extra_nodes() {
[ -e /etc/udev/links.conf ] || return 0
grep '^[^#]' /etc/udev/links.conf | \
while read type name arg1; do
[ "$type" -a "$name" -a ! -e "/$1/$name" -a ! -L "/$1/$name" ] || continue
case "$type" in
L) ln -s $arg1 /$1/$name ;;
D) mkdir -p /$1/$name ;;
M) mknod -m 600 /$1/$name $arg1 ;;
*) echo "links.conf: unparseable line ($type $name $arg1)" >&2 ;;
esac
if [ -x /sbin/restorecon ]; then
/sbin/restorecon /dev/$name
fi
done
}
if [ "$1" ]; then
devdir="$1"
else
devdir='/dev'
fi
make_extra_nodes $devdir
exit 0
#!/bin/sh -e
#
# Copyright 2008 Marco d'Itri <md@Linux.IT>
#
# This script automatically starts networking when a DSL modem is connected
# and its ATM interface is ready.
#
#
# For PPPoE you can set PROTOCOL=2684bridged and then add something like
# this to /etc/network/interfaces:
#
# allow-hotplug nas0
# iface nas0 inet manual
# pre-up ip link set up $IFACE
# up pppd persist call dsl-provider
#
#
# Support for CLIP (Classical IP over ATM, RFC 1577) may be incomplete.
#
# defaults
[ "$IP_INTERFACE" ] || IP_INTERFACE='nas0'
[ "$VP" ] || VP='8'
[ "$VC" ] || VC='35'
if [ -e /etc/default/dsl-modem.agent ]; then
. /etc/default/dsl-modem.agent
fi
# just exit unless a protocol is configured
[ "$PROTOCOL" ] || exit 0
##############################################################################
wait_and_run_pppd() {
# this guarantees that everything pppd needs to work is ready
wait_for_file /dev/log
exec pppd persist call ${PPP_PEER:-dsl-provider}
}
wait_and_run_br2684ctl() {
wait_for_file /dev/log
exec br2684ctl $BR2684_ARGS -b -c ${IP_INTERFACE#nas} \
-a ${ATM_INTERFACE}.${VP}.${VC}
}
wait_and_run_atmarp() {
wait_for_file /var/run/atmarpd.table
# create the IP interface
atmarp -c ${IP_INTERFACE:-atm0}
# setup the VC
# atmarp -s 192.0.2.254 ${ATM_INTERFACE}.${VP}.${VC}
exec ifup ${IP_INTERFACE:-atm0} # XXX
}
##############################################################################
ATM_DRIVER=${NAME%%[0-9]*}
ATM_INTERFACE=${NAME##$ATM_DRIVER}
# is this a DSL modem?
case "$ATM_DRIVER" in
cxacru|speedtch|ueagle-atm|xusbatm|UNICORN) ;;
*) exit 0 ;;
esac
cd /lib/udev/
. ./hotplug.functions
##############################################################################
case "$ACTION" in
add)
case "$PROTOCOL" in
pppoa) wait_and_run_pppd & ;;
2684bridged) wait_and_run_br2684ctl & ;;
clip) wait_and_run_atmarp & ;;
esac
;;
remove)
case "$PROTOCOL" in
pppoa)
# pppd will terminate automatically
;;
2684bridged)
PIDFILE="/var/run/br2684ctl-$IP_INTERFACE.pid"
if [ -e $PIDFILE ]; then
kill $(cat $PIDFILE)
rm -f $PIDFILE
fi
;;
clip)
ifdown ${IP_INTERFACE:-atm0} # XXX
# atmarp -d 192.0.2.254
;;
esac
;;
esac
exit 0
# This file blacklists the framebuffer drivers.
blacklist arkfb
blacklist aty128fb
blacklist atyfb
blacklist radeonfb
blacklist cirrusfb
blacklist cyber2000fb
blacklist gx1fb
blacklist gxfb
blacklist lxfb
blacklist kyrofb
blacklist matroxfb_base
blacklist mb862xxfb
blacklist neofb
blacklist nvidiafb
blacklist pm2fb
blacklist pm3fb
blacklist s3fb
blacklist savagefb
blacklist sisfb
blacklist tdfxfb
blacklist tridentfb
blacklist viafb
blacklist vt8623fb
#!/bin/sh -e
#
# firmware loader agent
#
cd /lib/udev/
. ./hotplug.functions
if [ ! -e /sys/$DEVPATH/loading ]; then
mesg "/sys/$DEVPATH/ does not exist"
exit 1
fi
FIRMWARE_DIRS="/lib/firmware/$(uname -r) /lib/firmware /usr/local/lib/firmware /usr/lib/hotplug/firmware"
for DIR in $FIRMWARE_DIRS; do
[ -e "$DIR/$FIRMWARE" ] || continue
echo 1 > /sys/$DEVPATH/loading
cat "$DIR/$FIRMWARE" > /sys/$DEVPATH/data
echo 0 > /sys/$DEVPATH/loading
exit 0
done
# the firmware was not found
echo -1 > /sys/$DEVPATH/loading
RUNDIR=$(udevadm info --run)
if [ -d "$RUNDIR" ]; then
mkdir -p "$RUNDIR/firmware-missing/"
file=$(echo "$FIRMWARE" | sed -e 's#/#\\x2f#g')
ln -s -f "$DEVPATH" "$RUNDIR/firmware-missing/$file"
fi
debug_mesg "Cannot find the $FIRMWARE firmware"
exit 1
# Setup and shell utility functions for use in hotplug agents.
# vim: syntax=sh
#
# 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.
if [ "$UDEV_LOG" ] && [ "$UDEV_LOG" -ge 7 ]; then
DEBUG=yes
fi
PATH='/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin'
[ -e /etc/default/hotplug ] && . /etc/default/hotplug
if [ -x /usr/bin/logger ]; then
LOGGER=/usr/bin/logger
elif [ -x /bin/logger ]; then
LOGGER=/bin/logger
else
unset LOGGER
fi
# for diagnostics
if [ -t 1 -a -z "$LOGGER" ] || [ ! -e '/dev/log' ]; then
mesg() {
echo "$@" >&2
}
elif [ -t 1 ]; then
mesg() {
echo "$@"
$LOGGER -t "${0##*/}[$$]" "$@"
}
else
mesg() {
$LOGGER -t "${0##*/}[$$]" "$@"
}
fi
debug_mesg() {
[ -z "$DEBUG" -o "$DEBUG" = no ] && return 0
mesg "$@"
}
wait_for_file() {
local file=$1
local timeout=$2
[ "$timeout" ] || timeout=120
local count=$timeout
while [ $count != 0 ]; do
[ -e "$file" ] && return 0
sleep 1
count=$(($count - 1))
done
mesg "$file did not appear before the timeout!"
exit 1
}
#!/bin/sh -e
PREREQS=""
prereqs() { echo "$PREREQS"; }
case "$1" in
prereqs)
prereqs
exit 0
;;
esac
# Stop udevd, we'll miss a few events while we run init, but we catch up
udevadm control --exit
udev_root="/dev"
if [ -e /etc/udev/udev.conf ]; then
. /etc/udev/udev.conf
fi
# move the /dev tmpfs to the rootfs
mount -n -o move /dev ${rootmnt}${udev_root}
# create a temporary symlink to the final /dev for other initramfs scripts
nuke /dev
ln -s ${rootmnt}${udev_root} /dev
#!/bin/sh -e
PREREQS=""
prereqs() { echo "$PREREQS"; }
case "$1" in
prereqs)
prereqs
exit 0
;;
esac
root_over_the_network() {
if egrep -qs '^/dev/(nbd|nd[a-z]|etherd/e)[^[:space:]]+[[:space:]]+/[[:space:]]' /etc/fstab; then
return 0
elif egrep -qs '^[^[:space:]#]+[[:space:]]+/[[:space:]]+nfs[234]?[[:space:]]' /etc/fstab; then
return 0
fi
return 1 # false
}
. /usr/share/initramfs-tools/hook-functions
copy_exec /sbin/udevd /sbin
copy_exec /sbin/udevadm /sbin
mkdir -p $DESTDIR/etc/udev
cp -p /etc/udev/udev.conf $DESTDIR/etc/udev/
mkdir -p $DESTDIR/lib/udev/rules.d/
for rules in 50-udev-default.rules 60-persistent-storage.rules \
80-drivers.rules 91-permissions.rules \
64-md-raid.rules 60-persistent-storage-lvm.rules \
55-dm.rules 60-persistent-storage-dm.rules; do
if [ -e /etc/udev/rules.d/$rules ]; then
cp -p /etc/udev/rules.d/$rules $DESTDIR/lib/udev/rules.d/
elif [ -e /lib/udev/rules.d/$rules ]; then
cp -p /lib/udev/rules.d/$rules $DESTDIR/lib/udev/rules.d/
fi
done
# try to autodetect the value of this configuration option
if [ -z "$NEED_PERSISTENT_NET" ] && root_over_the_network; then
NEED_PERSISTENT_NET='yes'
fi
# Copy the rules for persistent network interface names for the benefit of
# systems which need to boot over the network. If this is enabled then the
# initramfs must be rebuilt every time a new network interface is added.
# See #414287 for details.
case "$NEED_PERSISTENT_NET" in
YES|yes|Yes|Y|y)
if [ -e /etc/udev/rules.d/70-persistent-net.rules ]; then
cp -p /etc/udev/rules.d/70-persistent-net.rules $DESTDIR/lib/udev/rules.d/
fi
;;
esac
cp /lib/udev/hotplug.functions $DESTDIR/lib/udev/
for program in firmware.agent ata_id edd_id scsi_id; do
copy_exec /lib/udev/$program /lib/udev
done
copy_exec /sbin/blkid /sbin
if [ -x /lib/udev/vio_type ]; then
copy_exec /lib/udev/vio_type /lib/udev
fi
#!/bin/sh -e
PREREQS=""
prereqs() { echo "$PREREQS"; }
case "$1" in
prereqs)
prereqs
exit 0
;;
esac
echo > /sys/kernel/uevent_helper
UDEV_ROOT=/dev \
udevd --daemon --resolve-names=never
udevadm trigger --action=add
udevadm settle || true
if [ -d /sys/bus/scsi ]; then
modprobe -q scsi_wait_scan && modprobe -r scsi_wait_scan || true
udevadm settle || true
fi
# If the rootdelay parameter has been set, we wait a bit for devices
# like usb/firewire disks to settle.
if [ "$ROOTDELAY" ]; then
sleep $ROOTDELAY
fi
# Leave udev running to process events that come in out-of-band (like USB
# connections)
# This file does not exist. Please do not ask the Debian maintainer about it.
# If you need manually created devices, create them in /lib/udev/devices/ .
D pts
D shm
M null c 1 3
M console c 5 1
# Hic sunt leones.
M ppp c 108 0
M loop0 b 7 0
D net
M net/tun c 10 200
#!/bin/sh -e
#
# log the event to a file
#
cd /lib/udev/
. ./hotplug.functions
# provide env-like output when the real thing is not available
if [ ! -x /usr/bin/env ]; then
env() {
# bash prepends "declare -x " at the beginning of each line
export -p | sed -e 's/^\(declare -x\|export\) //'
}
fi
# writes a copy of the current hotplug event to stdout
log_to_stdout()
{
{
echo "HOTPLUG_TIME='$(date)'"
env
echo ''
} | egrep -v "^'$|^(_|PATH|PWD|PPID|SHLVL|HOME|IFS|OPTIND|PS[1234])="
}
[ "$EVENTS_LOG" ] || EVENTS_LOG='/dev/hotplug.log'
log_to_stdout >> $EVENTS_LOG
exit 0
#!/bin/sh
# This script should be run before building the package every time a new
# kernel is released.
set -e
BL='fbdev-blacklist.conf'
if [ -e extra/$BL ]; then cd extra; fi
{
printf "# This file blacklists the framebuffer drivers.\n\n"
find /lib/modules/$(uname -r)/kernel/drivers/video -type f | sort | \
while read file; do
/sbin/modinfo $file | grep -q '^alias: *pci:' \
&& echo blacklist $(basename $file .ko) || true
done
} > $BL.tmp
if diff --unified=0 $BL $BL.tmp; then
rm $BL.tmp
else
printf "\n\n\n$BL.tmp has changes!\n\n\n\n"
fi
#!/bin/sh -e
#
# run /sbin/{ifup,ifdown} with the --allow=hotplug option.
#
. /lib/udev/hotplug.functions
if [ -z "$INTERFACE" ]; then
mesg "Bad net.agent invocation: \$INTERFACE is not set"
exit 1
fi
check_program() {
[ -x $1 ] && return 0
mesg "ERROR: $1 not found. You need to install the ifupdown package."
mesg "net.agent $ACTION event for $INTERFACE not handled."
exit 1
}
wait_for_interface() {
local interface=$1
while :; do
local state="$(cat /sys/class/net/$interface/operstate 2>/dev/null || true)"
if [ "$state" != down ]; then
return 0
fi
sleep 1
done
}
net_ifup() {
check_program /sbin/ifup
if grep -q '^auto[[:space:]].*\<'"$INTERFACE"'\>' \
/etc/network/interfaces; then
# this $INTERFACE is marked as "auto"
IFUPARG='\('$INTERFACE'\|-a\|--all\)'
else
IFUPARG=$INTERFACE
fi
if ps -C ifup ho args | grep -q "$IFUPARG"; then
debug_mesg "Already ifup-ing interface $INTERFACE"
exit 0
fi
wait_for_interface lo
if [ -e /sys/fs/cgroup/systemd ]; then
exec systemctl start ifup@${INTERFACE}.service
else
exec ifup --allow=hotplug $INTERFACE
fi
}
net_ifdown() {
check_program /sbin/ifdown
if ps -C ifdown ho args | grep -q $INTERFACE; then
debug_mesg "Already ifdown-ing interface $INTERFACE"
exit 0
fi
exec ifdown --allow=hotplug $INTERFACE
}
do_everything() {
case "$ACTION" in
add)
# these interfaces generate hotplug events *after* they are brought up
case $INTERFACE in
ppp*|ippp*|isdn*|plip*|lo|irda*|ipsec*)
exit 0 ;;
esac
net_ifup
;;
remove)
# the pppd persist option may have been used, so it should not be killed
case $INTERFACE in
ppp*)
exit 0 ;;
esac
net_ifdown
;;
*)
debug_mesg "NET $ACTION event not supported"
exit 1
;;
esac
}
# When udev_log="debug" stdout and stderr are pipes connected to udevd.
# They need to be closed or udevd will wait for this process which will
# deadlock with udevsettle until the timeout.
do_everything > /dev/null 2> /dev/null &
exit 0
# virtio serial / console ports
KERNEL=="vport*", ATTR{name}=="?*", SYMLINK+="virtio-ports/$attr{name}"
SUBSYSTEM=="input", ENV{ID_INPUT}=="", IMPORT{builtin}="input_id"
# RTC on some architectures
SUBSYSTEM=="rtc", DRIVERS=="rtc_cmos", SYMLINK+="rtc"
# /dev/sndstat
SUBSYSTEM=="module", KERNEL=="snd", ACTION=="add", \
RUN+="/bin/ln -sf /proc/asound/oss/sndstat $root/sndstat"
# This file contains the rules needed to create persistent device names.
# we are only interested in add and change actions for block devices
ACTION=="remove", GOTO="persistent_storage_tape_end"
# "Medium Changers"
SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="8", \
IMPORT{program}="scsi_id --export --sg-version=3 --whitelisted --device=$tempnode"
KERNEL=="sg[0-9]*", ATTRS{type}=="8", ENV{ID_SERIAL}=="?*", \
SYMLINK+="tape/by-id/scsi-$env{ID_SERIAL}"
SUBSYSTEM!="scsi_tape", GOTO="persistent_storage_tape_end"
KERNEL=="st*[0-9]|nst*[0-9]", ATTRS{ieee1394_id}=="?*", \
ENV{ID_BUS}="ieee1394", ENV{ID_SERIAL}="$attr{ieee1394_id}"
KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", \
SUBSYSTEMS=="usb", \
IMPORT{builtin}="usb_id"
KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", \
SUBSYSTEMS=="scsi", KERNELS=="[0-9]*:*[0-9]", \
ENV{.BSG_DEV}="$root/bsg/$id"
KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", \
WAIT_FOR="$env{.BSG_DEV}", \
ENV{ID_BUS}="scsi", \
IMPORT{program}="scsi_id --export --device=$env{.BSG_DEV}"
KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}=="?*", \
SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}"
KERNEL=="st*[0-9]|nst*[0-9]", \
IMPORT{builtin}="path_id"
KERNEL=="st*[0-9]", ENV{ID_PATH}=="?*", \
SYMLINK+="tape/by-path/$env{ID_PATH}"
KERNEL=="nst*[0-9]", ENV{ID_PATH}=="?*", \
SYMLINK+="tape/by-path/$env{ID_PATH}-nst"