# $Header: /magellan-cvs/smage/udev/udev-119-r2.smage2,v 1.3 2008/06/18 21:49:46 niro Exp $ PNAME="udev" PVER="119" PBUILD="r2" PCATEGORIE="sys-fs" STATE="unstable" DESCRIPTION="A Userspace Implementation for dynamic /dev nodes." HOMEPAGE="http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html" DEPEND=">= virtual/glibc >= sys-apps/initscripts-0.4.11 >= sys-apps/hotplug-20040401" SDEPEND=">= virtual/kernel-sources" SRCFILE="${PNAME}-${PVER}.tar.bz2" SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" # global var: ${LINUX_SOURCES} # location where they are [[ -z ${LINUX_SOURCES} ]] && LINUX_SOURCES="/usr/src/linux" sminclude mtools SRC_URI=( http://www.kernel.org/pub/linux/utils/kernel/hotplug/${SRCFILE} mirror://${PNAME}/${SRCFILE} mirror://${PNAME}/config-${PNAME}-${PVER}-${PBUILD}/udev.conf mirror://${PNAME}/config-${PNAME}-${PVER}-${PBUILD}/udev-alsa.rules.magellan mirror://${PNAME}/config-${PNAME}-${PVER}-${PBUILD}/udev-arch-ia64.rules.magellan mirror://${PNAME}/config-${PNAME}-${PVER}-${PBUILD}/udev-arch-ppc.rules.magellan mirror://${PNAME}/config-${PNAME}-${PVER}-${PBUILD}/udev-arch-s390.rules.magellan mirror://${PNAME}/config-${PNAME}-${PVER}-${PBUILD}/udev-cd-aliases-generator.rules.magellan mirror://${PNAME}/config-${PNAME}-${PVER}-${PBUILD}/udev-cdrom_id.rules.magellan mirror://${PNAME}/config-${PNAME}-${PVER}-${PBUILD}/udev-device-mapper.rules.magellan mirror://${PNAME}/config-${PNAME}-${PVER}-${PBUILD}/udev-drivers.rules.magellan mirror://${PNAME}/config-${PNAME}-${PVER}-${PBUILD}/udev-early.rules.magellan mirror://${PNAME}/config-${PNAME}-${PVER}-${PBUILD}/udev-kernel-compat.rules.magellan mirror://${PNAME}/config-${PNAME}-${PVER}-${PBUILD}/udev-late.rules.magellan mirror://${PNAME}/config-${PNAME}-${PVER}-${PBUILD}/udev-magellan.rules.magellan mirror://${PNAME}/config-${PNAME}-${PVER}-${PBUILD}/udev-md-raid.rules.magellan mirror://${PNAME}/config-${PNAME}-${PVER}-${PBUILD}/udev-permissions.rules.magellan mirror://${PNAME}/config-${PNAME}-${PVER}-${PBUILD}/udev-persistent-input.rules.magellan mirror://${PNAME}/config-${PNAME}-${PVER}-${PBUILD}/udev-persistent-net-generator.rules.magellan mirror://${PNAME}/config-${PNAME}-${PVER}-${PBUILD}/udev-persistent-storage-edd.rules.magellan mirror://${PNAME}/config-${PNAME}-${PVER}-${PBUILD}/udev-persistent-storage.rules.magellan mirror://${PNAME}/config-${PNAME}-${PVER}-${PBUILD}/udev-persistent-storage-tape.rules.magellan mirror://${PNAME}/config-${PNAME}-${PVER}-${PBUILD}/udev-pilot-links.rules.magellan mirror://${PNAME}/config-${PNAME}-${PVER}-${PBUILD}/udev.rules.magellan mirror://${PNAME}/config-${PNAME}-${PVER}-${PBUILD}/udev-video.rules.magellan mirror://${PNAME}/config-${PNAME}-${PVER}-${PBUILD}/udev-zaptel.rules.magellan mirror://${PNAME}/config-${PNAME}-${PVER}-${PBUILD}/modprobe.sh mirror://${PNAME}/config-${PNAME}-${PVER}-${PBUILD}/write_root_link_rule.sh mirror://${PNAME}/config-${PNAME}-${PVER}-${PBUILD}/blacklist mirror://${PNAME}/config-${PNAME}-${PVER}-${PBUILD}/pnp-aliases ) UP2DATE="updatecmd http://www.kernel.org/pub/linux/utils/kernel/hotplug | grep ${PNAME}- | lasttarball" src_prepare() { munpack ${SRCFILE} || die cd ${SRCDIR} # no need to clutter the logs ... sed -i '/^DEBUG/ c\DEBUG = false' Makefile || die # do not use optimization flags from the package sed -i 's|$(OPTIMIZATION)||g' Makefile || die # multilib fixup sed -i "/ =/s:/lib:/$(mlibdir):" extras/volume_id/lib/Makefile || die # enable udev extras export extras="extras/ata_id \ extras/cdrom_id \ extras/collect \ extras/edd_id \ extras/firmware \ extras/floppy \ extras/path_id \ extras/rule_generator \ extras/scsi_id \ extras/usb_id \ extras/volume_id" } src_compile() { cd ${SRCDIR} mmake EXTRAS="${extras}" udevdir="/dev/" DEBUG=false || die } src_install() { cd ${SRCDIR} mmake DESTDIR=${BINDIR} EXTRAS="${extras}" udevdir="/dev/" DEBUG=false install || die # needed directories minstalldir /etc/modprobe.d || die # install vol id library rm ${BINDIR}/$(mlibdir)/libvolume_id.* || die rm ${BINDIR}/usr/$(mlibdir)/libvolume_id.* || die rm ${BINDIR}/usr/$(mlibdir)/pkgconfig/*.pc || die minstallexec extras/volume_id/lib/\*.a /usr/$(mlibdir) || die # don't use install here, link references will be installed, not the symlinks itself cp -a extras/volume_id/lib/*.so* ${BINDIR}/$(mlibdir) || die # fix pkgconfig pathes on multilib systems sed -i "s:/usr/lib:/usr/$(mlibdir):g" extras/volume_id/lib/*.pc || die # pkgconfig minstallfile extras/volume_id/lib/\*.pc /usr/$(mlibdir)/pkgconfig || die # includes minstallfile extras/volume_id/lib/libvolume_id.h /usr/include || die # generic udev helper scripts minstallexec -s modprobe.sh /lib/udev || die minstallexec -s write_root_link_rule.sh /lib/udev/write_root_link_rule || die # create symlinks for these utilities to /sbin # where multipath-tools expect them to be mlink ../lib/udev/vol_id /sbin/ || die mlink ../lib/udev/scsi_id /sbin/ || die # our config file minstalletc udev.conf udev/udev.conf || die # install our udev rules minstalletc udev-early.rules.magellan udev/rules.d/05-udev-early.rules || die minstalletc udev-kernel-compat.rules.magellan udev/rules.d/30-kernel-compat.rules || die minstalletc udev-alsa.rules.magellan udev/rules.d/40-alsa.rules || die minstalletc udev-arch-ia64.rules.magellan udev/rules.d/40-arch-ia64.rules || die minstalletc udev-arch-ppc.rules.magellan udev/rules.d/40-arch-ppc.rules || die minstalletc udev-arch-s390.rules.magellan udev/rules.d/40-arch-s390.rules || die minstalletc udev-magellan.rules.magellan udev/rules.d/40-magellan.rules || die minstalletc udev-pilot-links.rules.magellan udev/rules.d/40-pilot-links.rules || die minstalletc udev-video.rules.magellan udev/rules.d/40-video.rules || die minstalletc udev-zaptel.rules.magellan udev/rules.d/40-zaptel.rules || die minstalletc udev.rules.magellan udev/rules.d/50-udev-default.rules || die minstalletc udev-cdrom_id.rules.magellan udev/rules.d/60-cdrom_id.rules || die minstalletc udev-persistent-input.rules.magellan udev/rules.d/60-persistent-input.rules || die minstalletc udev-persistent-storage.rules.magellan udev/rules.d/60-persistent-storage.rules || die minstalletc udev-persistent-storage-tape.rules.magellan udev/rules.d/60-persistent-storage-tape.rules || die minstalletc udev-persistent-storage-edd.rules.magellan udev/rules.d/61-persistent-storage-edd.rules || die minstalletc udev-device-mapper.rules.magellan udev/rules.d/64-device-mapper.rules || die minstalletc udev-md-raid.rules.magellan udev/rules.d/64-md-raid.rules || die minstalletc udev-permissions.rules.magellan udev/rules.d/65-permissions.rules || die minstalletc udev-cd-aliases-generator.rules.magellan udev/rules.d/75-cd-aliases-generator.rules || die minstalletc udev-persistent-net-generator.rules.magellan udev/rules.d/75-persistent-net-generator.rules || die minstalletc udev-drivers.rules.magellan udev/rules.d/80-drivers.rules || die minstalletc udev-late.rules.magellan udev/rules.d/95-udev-late.rules || die # install our blacklist minstalletc blacklist udev/blacklist || die # install our pnpaliases; now excluded from 50-udev.rules minstalletc pnp-aliases modprobe.d/pnp-aliases || die # mark state dir undeletable mkeepdir /lib/udev/state || die mkeepdir /lib/udev/devices || die # CONFIG_PROTECT_MASK for /etc/udev/rules.d minstalldir /etc/env.d || die echo "CONFIG_PROTECT_MASK=\"/etc/udev/rules.d\"" > ${BINDIR}/etc/env.d/02udev || die # create some nodes that we know we need mknod ${BINDIR}/lib/udev/devices/null c 1 3 || die chmod 666 ${BINDIR}/lib/udev/devices/null || die # hey, that's my birthday :) touch -t 198002220222 ${BINDIR}/lib/udev/devices/null || die mknod ${BINDIR}/lib/udev/devices/zero c 1 5 || die chmod 666 ${BINDIR}/lib/udev/devices/zero || die touch -t 198002220222 ${BINDIR}/lib/udev/devices/zero || die mknod ${BINDIR}/lib/udev/devices/console c 5 1 || die chmod 600 ${BINDIR}/lib/udev/devices/console || die chown root:tty ${BINDIR}/lib/udev/devices/console || die touch -t 198002220222 ${BINDIR}/lib/udev/devices/console || die mknod ${BINDIR}/lib/udev/devices/urandom c 1 9 || die chmod 666 ${BINDIR}/lib/udev/devices/urandom || die touch -t 198002220222 ${BINDIR}/lib/udev/devices/urandom || die cd ${SRCDIR} minstalldocs COPYING ChangeLog FAQ RELEASE-NOTES README TODO \ docs/{overview,udev_vs_devfs,README-gcov_for_udev} \ docs/writing_udev_rules/* \ || die } preinstall() { if [[ -d ${MROOT}/lib/udev-state ]] then mv -f ${MROOT}/lib/udev-state/* ${MROOT}/lib/udev/state/ rm -r ${MROOT}/lib/udev-state fi if [[ -f ${MROOT}/etc/udev/udev.config ]] && [[ ! -f ${MROOT}/etc/udev/udev.rules ]] then mv -f ${MROOT}/etc/udev/udev.config ${MROOT}/etc/udev/udev.rules fi # delete the old udev.hotplug symlink if it is present if [[ -h ${MROOT}/etc/hotplug.d/default/udev.hotplug ]] then rm -f ${MROOT}/etc/hotplug.d/default/udev.hotplug fi # delete the old wait_for_sysfs.hotplug symlink if it is present if [[ -h ${MROOT}/etc/hotplug.d/default/05-wait_for_sysfs.hotplug ]] then rm -f ${MROOT}/etc/hotplug.d/default/05-wait_for_sysfs.hotplug fi # delete the old 10-udev.hotplug symlink if it is present if [[ -h ${MROOT}/etc/hotplug.d/default/10-udev.hotplug ]] then rm -f ${MROOT}/etc/hotplug.d/default/10-udev.hotplug fi # delete the deprectated udev-late rc-script [[ -x ${MROOT}/sbin/rc-config ]] && ${MROOT}/sbin/rc-config del udev-late # delete obsolete hotplug.dev script if [[ -f ${MROOT}/etc/dev.d/net/hotplug.dev ]] then rm -f ${MROOT}/etc/dev.d/net/hotplug.dev fi } postinstall() { # create some nodes that we need if they not exist [[ ! -e ${MROOT}/lib/udev/devices/null ]] && mknod ${MROOT}/lib/udev/devices/null c 1 3 chmod 666 ${MROOT}/lib/udev/devices/null touch -t 198002220222 ${MROOT}/lib/udev/devices/null [[ ! -e ${MROOT}/lib/udev/devices/zero ]] && mknod ${MROOT}/lib/udev/devices/zero c 1 5 chmod 666 ${MROOT}/lib/udev/devices/zero touch -t 198002220222 ${MROOT}/lib/udev/devices/zero [[ ! -e ${MROOT}/lib/udev/devices/console ]] && mknod ${MROOT}/lib/udev/devices/console c 5 1 chmod 600 ${MROOT}/lib/udev/devices/console chown root:tty ${MROOT}/lib/udev/devices/console touch -t 198002220222 ${MROOT}/lib/udev/devices/console [[ ! -e ${MROOT}/lib/udev/devices/urandom ]] && mknod ${MROOT}/lib/udev/devices/urandom c 1 9 chmod 666 ${MROOT}/lib/udev/devices/urandom touch -t 198002220222 ${MROOT}/lib/udev/devices/urandom # after install/uprade, udev *must* be reloaded if already running if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] && [[ -n $(pidof udevd) ]] && [[ ${MAGE_BOOTSTRAP} != true ]] then echo "MROOT=/; restarting udev daemon ..." killall -15 udevd &> /dev/null sleep 1 killall -9 udevd &> /dev/null /sbin/udevd --daemon fi }