diff options
author | Matthias Schwarzott <zzam@gentoo.org> | 2007-05-04 14:14:51 +0000 |
---|---|---|
committer | Matthias Schwarzott <zzam@gentoo.org> | 2007-05-04 14:14:51 +0000 |
commit | 092bd4ed39f13d587e9bc96e4f06069e11d79335 (patch) | |
tree | 1f67aaa6bcb6f110b9e484114d707088f04ba22a /sys-fs | |
parent | ocsigen logrotate useflag (diff) | |
download | gentoo-2-092bd4ed39f13d587e9bc96e4f06069e11d79335.tar.gz gentoo-2-092bd4ed39f13d587e9bc96e4f06069e11d79335.tar.bz2 gentoo-2-092bd4ed39f13d587e9bc96e4f06069e11d79335.zip |
Now creating /dev/root the easy way (mknod), Bug #175243. Printing a warning at boot if persistent-net behaves bad, and if, then checking the stored rules for duplicates.
(Portage version: 2.1.2.5)
Diffstat (limited to 'sys-fs')
-rw-r--r-- | sys-fs/udev/ChangeLog | 11 | ||||
-rw-r--r-- | sys-fs/udev/files/digest-udev-110-r1 | 3 | ||||
-rw-r--r-- | sys-fs/udev/files/udev-110-root-link-1.diff | 148 | ||||
-rw-r--r-- | sys-fs/udev/files/udev-start-110-r1.sh | 203 | ||||
-rwxr-xr-x | sys-fs/udev/files/udev-stop-110-r1.sh | 96 | ||||
-rw-r--r-- | sys-fs/udev/udev-110-r1.ebuild | 301 |
6 files changed, 761 insertions, 1 deletions
diff --git a/sys-fs/udev/ChangeLog b/sys-fs/udev/ChangeLog index 0aae4b7c76c6..959cb63f34d0 100644 --- a/sys-fs/udev/ChangeLog +++ b/sys-fs/udev/ChangeLog @@ -1,6 +1,15 @@ # ChangeLog for sys-fs/udev # Copyright 1999-2007 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-fs/udev/ChangeLog,v 1.300 2007/05/04 07:05:24 zzam Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-fs/udev/ChangeLog,v 1.301 2007/05/04 14:14:51 zzam Exp $ + +*udev-110-r1 (04 May 2007) + + 04 May 2007; Matthias Schwarzott <zzam@gentoo.org> + +files/udev-start-110-r1.sh, +files/udev-stop-110-r1.sh, + +files/udev-110-root-link-1.diff, +udev-110-r1.ebuild: + Now creating /dev/root the easy way (mknod), Bug #175243. Printing a warning + at boot if persistent-net behaves bad, and if, then checking the stored + rules for duplicates. 04 May 2007; Matthias Schwarzott <zzam@gentoo.org> +files/udev-110-makefile-depend.diff, udev-110.ebuild: diff --git a/sys-fs/udev/files/digest-udev-110-r1 b/sys-fs/udev/files/digest-udev-110-r1 new file mode 100644 index 000000000000..47649e311d1c --- /dev/null +++ b/sys-fs/udev/files/digest-udev-110-r1 @@ -0,0 +1,3 @@ +MD5 34c703949f7c22745f52ef5a56d5910c udev-110.tar.bz2 188708 +RMD160 6ad83cfa386a7eedb79fc642eca438071a396580 udev-110.tar.bz2 188708 +SHA256 14532a4a563ad99c4631b5c3a1b4950337c3137d91a87825d6ae24b953f652ca udev-110.tar.bz2 188708 diff --git a/sys-fs/udev/files/udev-110-root-link-1.diff b/sys-fs/udev/files/udev-110-root-link-1.diff new file mode 100644 index 000000000000..c8813d1044b2 --- /dev/null +++ b/sys-fs/udev/files/udev-110-root-link-1.diff @@ -0,0 +1,148 @@ +diff --git a/extras/root_link/Makefile b/extras/root_link/Makefile +new file mode 100644 +index 0000000..76b475d +--- /dev/null ++++ b/extras/root_link/Makefile +@@ -0,0 +1,69 @@ ++# Makefile for udev extra invoked from the udev main Makefile ++# ++# Copyright (C) 2004-2005 Kay Sievers <kay.sievers@vrfy.org> ++# ++# Released under the GNU General Public License, version 2. ++# ++ ++PROG = get_dir_major_minor ++OBJ = ++HEADERS = ++GEN_HEADERS = ++MAN_PAGES = ++ ++prefix = ++etcdir = ${prefix}/etc ++sbindir = ${prefix}/sbin ++usrbindir = ${prefix}/usr/bin ++usrsbindir = ${prefix}/usr/sbin ++libudevdir = ${prefix}/lib/udev ++mandir = ${prefix}/usr/share/man ++configdir = ${etcdir}/udev/ ++ ++INSTALL = install -c ++INSTALL_PROGRAM = ${INSTALL} ++INSTALL_DATA = ${INSTALL} -m 644 ++INSTALL_SCRIPT = ${INSTALL} ++ ++all: $(PROG) $(MAN_PAGES) ++.PHONY: all ++.DEFAULT: all ++ ++%.o: %.c $(GEN_HEADERS) ++ $(E) " CC " $@ ++ $(Q) $(CC) -c $(CFLAGS) $< -o $@ ++ ++$(PROG): %: $(HEADERS) %.o $(OBJS) ++ $(E) " LD " $@ ++ $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) ++ ++# man pages ++%.8: %.xml ++ $(E) " XMLTO " $@ ++ $(Q) xmlto man $? ++.PRECIOUS: %.8 ++ ++clean: ++ $(E) " CLEAN " ++ $(Q) rm -f $(PROG) $(OBJS) $(GEN_HEADERS) ++.PHONY: clean ++ ++install-bin: all ++ $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) ++.PHONY: install-bin ++ ++uninstall-bin: ++ - rm $(DESTDIR)$(libudevdir)/$(PROG) ++.PHONY: uninstall-bin ++ ++install-man: ++ @echo "Please create a man page for this tool." ++.PHONY: install-man ++ ++uninstall-man: ++ @echo "Please create a man page for this tool." ++.PHONY: uninstall-man ++ ++install-config: ++ @echo "no config file to install" ++.PHONY: install-config +diff --git a/extras/root_link/get_dir_major_minor.c b/extras/root_link/get_dir_major_minor.c +new file mode 100644 +index 0000000..1e39411 +--- /dev/null ++++ b/extras/root_link/get_dir_major_minor.c +@@ -0,0 +1,48 @@ ++// print out major/minor nr of the device the supplied dir ++// is mounted on ++// ++// Author: Matthias Schwarzott <zzam@gentoo.org> ++ ++#include <sys/types.h> ++#include <sys/stat.h> ++#include <unistd.h> ++ ++#include <stdio.h> ++#include <stdlib.h> ++ ++// Getting major/minor ++#include <sys/sysmacros.h> ++int main(int argc, char **argv) ++{ ++ struct stat stat_buf; ++ unsigned int dev_major=0, dev_minor=0; ++ dev_t dev; ++ ++ if (argc != 2) { ++ printf("Usage:\n"); ++ printf(" get_dir_major_minor <directory>\n"); ++ return EXIT_FAILURE; ++ } ++ ++ if (stat(argv[1], &stat_buf) < 0) { ++ perror("stat"); ++ return EXIT_FAILURE; ++ } ++ ++ dev = stat_buf.st_dev; ++ ++ dev_major = gnu_dev_major(dev); ++ dev_minor = gnu_dev_minor(dev); ++ ++ ++ if (dev_major == 0) { ++ fprintf(stderr, "Major number is 0.\n"); ++ return EXIT_FAILURE; ++ } else ++ printf("%d %d\n", ++ dev_major, ++ dev_minor); ++ ++ return EXIT_SUCCESS; ++} ++ +diff --git a/extras/root_link/print_root_link_rule.sh b/extras/root_link/print_root_link_rule.sh +new file mode 100755 +index 0000000..c33f290 +--- /dev/null ++++ b/extras/root_link/print_root_link_rule.sh +@@ -0,0 +1,13 @@ ++#!/bin/sh ++ ++PROG=/lib/udev/print_dir_major_minor ++[ -x "${PROG}" ] && DEV=$(/lib/udev/print_dir_major_minor /) ++if [ $? == 0 ]; then ++ MAJOR="${DEV##* }" ++ MINOR="${DEV%% *}" ++ ++ echo "# Created by print_root_link_rule" ++ echo "# This rule should create /dev/root as link to real root device." ++ echo "SUBSYSTEM==\"block\", ENV{MAJOR}==\"$MAJOR\", ENV{MINOR}==\"$MINOR\", SYMLINK+=\"root\"" ++fi ++ diff --git a/sys-fs/udev/files/udev-start-110-r1.sh b/sys-fs/udev/files/udev-start-110-r1.sh new file mode 100644 index 000000000000..0ae63972151d --- /dev/null +++ b/sys-fs/udev/files/udev-start-110-r1.sh @@ -0,0 +1,203 @@ +# 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 export CONSOLE=${CONSOLE} > /dev/.udev_populate + echo export TERM=${TERM} >> /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 +} + +make_dev_root() { + local DEV=$(/lib/udev/get_dir_major_minor "/") + if [ $? == 0 ] && [ -n "${DEV}" ]; then + mknod -m 600 /dev/root b ${DEV} + fi +} + +check_persistent_net() { + # check if there are problems with persistent-net + local syspath + local devs="" + local problem_found=0 + for syspath in /sys/class/net/*_rename*; do + if [ -d "${syspath}" ]; then + devs="${devs} ${syspath##*/}" + problem_found=1 + fi + done + + [ "${problem_found}" = 0 ] && 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 +} + +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 + make_dev_root + + # Only do this for baselayout-1* + if [ ! -e /lib/librc.so ]; then + + # 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 + fi + + check_persistent_net +} + +main + +# vim:ts=4 diff --git a/sys-fs/udev/files/udev-stop-110-r1.sh b/sys-fs/udev/files/udev-stop-110-r1.sh new file mode 100755 index 000000000000..38eb82551ec9 --- /dev/null +++ b/sys-fs/udev/files/udev-stop-110-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 root; 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/udev-110-r1.ebuild b/sys-fs/udev/udev-110-r1.ebuild new file mode 100644 index 000000000000..22c7f7eaf937 --- /dev/null +++ b/sys-fs/udev/udev-110-r1.ebuild @@ -0,0 +1,301 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/udev/udev-110-r1.ebuild,v 1.1 2007/05/04 14:14:51 zzam Exp $ + +inherit eutils flag-o-matic multilib toolchain-funcs + +DESCRIPTION="Linux dynamic and persistent device naming support (aka userspace devfs)" +HOMEPAGE="http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html" +SRC_URI="mirror://kernel/linux/utils/kernel/hotplug/${P}.tar.bz2" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" +IUSE="selinux" + +DEPEND="selinux? ( sys-libs/libselinux )" +RDEPEND="!sys-apps/coldplug" +RDEPEND="${DEPEND} ${RDEPEND} + >=sys-apps/baselayout-1.12.5" +# We need the lib/rcscripts/addon support +PROVIDE="virtual/dev-manager" + +src_unpack() { + unpack ${A} + + cd "${S}" + + # patches go here... + #epatch ${FILESDIR}/${P}-udev_volume_id.patch + epatch ${FILESDIR}/${PN}-104-peristent-net-disable-xen.patch + EPATCH_OPTS="-p1" epatch ${FILESDIR}/${PN}-110-root-link-1.diff + epatch ${FILESDIR}/${P}-makefile-depend.diff + + # No need to clutter the logs ... + sed -ie '/^DEBUG/ c\DEBUG = false' Makefile + # Do not use optimization flags from the package + sed -ie 's|$(OPTIMIZATION)||g' Makefile + + # Make sure there is no sudden changes to udev.rules.gentoo + # (more for my own needs than anything else ...) + MD5=`md5sum < "${S}/etc/udev/gentoo/50-udev.rules"` + MD5=${MD5/ -/} + if [ "${MD5}" != "04a8f3303a2b172affbed26973745f26" ] + then + echo + eerror "gentoo/udev.rules has been updated, please validate!" + die "gentoo/udev.rules has been updated, please validate!" + fi +} + +src_compile() { + filter-flags -fprefetch-loop-arrays + local myconf= + local extras="extras/ata_id \ + extras/cdrom_id \ + extras/edd_id \ + extras/firmware \ + extras/floppy \ + extras/path_id \ + extras/scsi_id \ + extras/usb_id \ + extras/volume_id \ + extras/rule_generator \ + extras/root_link" + + use selinux && myconf="${myconf} USE_SELINUX=true" + + # Not everyone has full $CHOST-{ld,ar,etc...} yet + local mycross="" + type -p ${CHOST}-ar && mycross=${CHOST}- + + echo "get_libdir = $(get_libdir)" + emake \ + EXTRAS="${extras}" \ + udevdir="/dev/" \ + CROSS_COMPILE=${mycross} \ + OPTFLAGS="" \ + ${myconf} || die +} + +src_install() { + # we install everything by "hand" and don't rely on the udev Makefile to do + # it for us (why? it's easier that way...) + dobin udevinfo || die "Required binary not installed properly" + dobin udevtest || die "Required binary not installed properly" + dobin udevmonitor || die "Required binary not installed properly" + into / + dosbin udevd || die "Required binary not installed properly" + dosbin udevstart || die "Required binary not installed properly" + dosbin udevtrigger || die "Required binary not installed properly" + dosbin udevcontrol || die "Required binary not installed properly" + dosbin udevsettle || die "Required binary not installed properly" + + # Helpers + exeinto /lib/udev + doexe extras/ata_id/ata_id || die "Required helper not installed properly" + doexe extras/volume_id/vol_id || die "Required helper not installed properly" + doexe extras/scsi_id/scsi_id || die "Required helper not installed properly" + doexe extras/usb_id/usb_id || die "Required helper not installed properly" + doexe extras/path_id/path_id || die "Required helper not installed properly" + doexe extras/cdrom_id/cdrom_id || die "Required helper not installed properly" + doexe extras/edd_id/edd_id || die "Required helper not installed properly" + doexe extras/rule_generator/write_cd_rules || die "Required helper not installed properly" + doexe extras/rule_generator/write_net_rules || die "Required helper not installed properly" + doexe extras/rule_generator/rule_generator.functions || die "Required helper not installed properly" + doexe extras/root_link/get_dir_major_minor || die "Required helper not installed properly" + keepdir /lib/udev/state + keepdir /lib/udev/devices + + # create symlinks for these utilities to /sbin + # where multipath-tools expect them to be (Bug #168588) + dosym ../lib/udev/vol_id /sbin/vol_id + dosym ../lib/udev/scsi_id /sbin/scsi_id + + # vol_id library (needed by mount and HAL) + dolib extras/volume_id/lib/*.a extras/volume_id/lib/*.so* + # move the .a files to /usr/lib + dodir /usr/$(get_libdir) + mv -f "${D}"/$(get_libdir)/*.a "${D}"/usr/$(get_libdir)/ + + # handle static linking bug #4411 + gen_usr_ldscript libvolume_id.so + + # save pkgconfig info + insinto /usr/$(get_libdir)/pkgconfig + doins extras/volume_id/lib/*.pc + + #exeinto /etc/udev/scripts + exeinto /lib/udev + #doexe extras/ide-devfs.sh + #doexe extras/scsi-devfs.sh + #doexe extras/raid-devfs.sh + doexe extras/floppy/create_floppy_devices || die "Required binary not installed properly" + doexe extras/firmware/firmware.sh || die "Required binary not installed properly" + newexe ${FILESDIR}/net-104-r10.sh net.sh || die "Required binary not installed properly" + newexe ${FILESDIR}/modprobe-105.sh modprobe.sh || die "Required binary not installed properly" + + # Our udev config file + insinto /etc/udev + newins ${FILESDIR}/udev.conf.post_108 udev.conf + + # Our rules files + insinto /etc/udev/rules.d/ + doins etc/udev/gentoo/??-*.rules + #newins ${FILESDIR}/udev.rules-107-r1 50-udev.rules + #newins ${FILESDIR}/05-udev-early.rules-106-r5 05-udev-early.rules + #doins ${FILESDIR}/95-udev-late.rules + # Special rules for device-mapper + #newins ${FILESDIR}/64-device-mapper.rules-107-r1 64-device-mapper.rules + # Use upstream's persistent rules for devices + doins etc/udev/rules.d/60-*.rules + doins extras/rule_generator/75-*.rules || die "rules not installed properly" + + # scsi_id configuration + insinto /etc + doins extras/scsi_id/scsi_id.config + + # all of the man pages + doman *.7 + doman *.8 + doman extras/ata_id/ata_id.8 + doman extras/edd_id/edd_id.8 + doman extras/scsi_id/scsi_id.8 + doman extras/volume_id/vol_id.8 + doman extras/cdrom_id/cdrom_id.8 + # create a extra symlink for udevcontrol + dosym udevd.8 /usr/share/man/man8/udevcontrol.8 + + # our udev hooks into the rc system + insinto /$(get_libdir)/rcscripts/addons + newins "${FILESDIR}"/udev-start-110-r1.sh udev-start.sh + newins "${FILESDIR}"/udev-stop-110-r1.sh udev-stop.sh + + # needed to compile latest Hal + insinto /usr/include + doins extras/volume_id/lib/libvolume_id.h + + dodoc ChangeLog FAQ README TODO RELEASE-NOTES + dodoc docs/{overview,udev_vs_devfs} + dodoc docs/writing_udev_rules/* + + newdoc extras/volume_id/README README_volume_id + + insinto /etc/modprobe.d + newins ${FILESDIR}/blacklist-110 blacklist + doins ${FILESDIR}/pnp-aliases + + if use s390; then + # s390 does not has persistent mac addresses + # and we only have persistence rules for mac. + # For now just remove the rules file. + rm ${D}/etc/udev/rules.d/75-persistent-net-generator.rules + fi + +} + +pkg_preinst() { + if [[ -d ${ROOT}/lib/udev-state ]] ; then + mv -f "${ROOT}"/lib/udev-state/* "${D}"/lib/udev/state/ + rm -r "${ROOT}"/lib/udev-state + fi + + if [ -f "${ROOT}/etc/udev/udev.config" -a \ + ! -f "${ROOT}/etc/udev/udev.rules" ] + then + mv -f ${ROOT}/etc/udev/udev.config ${ROOT}/etc/udev/udev.rules + fi + + # delete the old udev.hotplug symlink if it is present + if [ -h "${ROOT}/etc/hotplug.d/default/udev.hotplug" ] + then + rm -f ${ROOT}/etc/hotplug.d/default/udev.hotplug + fi + + # delete the old wait_for_sysfs.hotplug symlink if it is present + if [ -h "${ROOT}/etc/hotplug.d/default/05-wait_for_sysfs.hotplug" ] + then + rm -f ${ROOT}/etc/hotplug.d/default/05-wait_for_sysfs.hotplug + fi + + # delete the old wait_for_sysfs.hotplug symlink if it is present + if [ -h "${ROOT}/etc/hotplug.d/default/10-udev.hotplug" ] + then + rm -f ${ROOT}/etc/hotplug.d/default/10-udev.hotplug + fi + + # is there a stale coldplug initscript? (CONFIG_PROTECT leaves it behind) + coldplug_stale="" + if [ -f "${ROOT}/etc/init.d/coldplug" ] + then + coldplug_stale="1" + fi +} + +pkg_postinst() { + if [[ ${ROOT} == "/" ]] ; then + # check if root of init-process is identical to ours + if [ -r /proc/1/root -a /proc/1/root/ -ef /proc/self/root/ ]; then + einfo "restarting udevd now." + if [[ -n $(pidof udevd) ]] ; then + killall -15 udevd &>/dev/null + sleep 1 + killall -9 udevd &>/dev/null + fi + /sbin/udevd --daemon + fi + fi + + # people want reminders, I'll give them reminders. Odds are they will + # just ignore them anyway... + + if [[ ${coldplug_stale} == "1" ]] ; then + ewarn "A stale coldplug init script found. You should run:" + ewarn + ewarn " rc-update del coldplug" + ewarn " rm -f /etc/init.d/coldplug" + ewarn + ewarn "udev now provides its own coldplug functionality." + fi + + # delete 40-scsi-hotplug.rules - all integrated in 50-udev.rules + if has_version "=sys-fs/udev-103-r3"; then + if [[ -e "${ROOT}/etc/udev/rules.d/40-scsi-hotplug.rules" ]] + then + ewarn "Deleting stray 40-scsi-hotplug.rules" + ewarn "installed by sys-fs/udev-103-r3" + rm -f ${ROOT}/etc/udev/rules.d/40-scsi-hotplug.rules + fi + fi + + # Removing some device-nodes we thought we need some time ago + if [[ -d "${ROOT}"/lib/udev/devices ]]; then + rm -f "${ROOT}"/lib/udev/devices/{null,zero,console,urandom} + fi + + # Removing some old file + if has_version "<sys-fs/udev-104-r5"; then + rm -f "${ROOT}"/etc/dev.d/net/hotplug.dev + rmdir --ignore-fail-on-non-empty "${ROOT}"/etc/dev.d/net + fi + + if has_version "<sys-fs/udev-106-r5"; then + if [[ -e ${ROOT}/etc/udev/rules.d/95-net.rules ]]; then + rm -f ${ROOT}/etc/udev/rules.d/95-net.rules + fi + fi + + # Try to remove /etc/dev.d as that is obsolete + if [[ -d "${ROOT}"/etc/dev.d ]]; then + rmdir --ignore-fail-on-non-empty "${ROOT}"/etc/dev.d/default "${ROOT}"/etc/dev.d + if [[ -d "${ROOT}"/etc/dev.d ]]; then + ewarn "You still have the directory /etc/dev.d on your system." + ewarn "This is no longer used by udev and can be removed." + fi + fi + + einfo + einfo "For more information on udev on Gentoo, writing udev rules, and" + einfo " fixing known issues visit:" + einfo " http://www.gentoo.org/doc/en/udev-guide.xml" +} |