# $Id: udev-151-r2.smage2 5611 2010-07-14 13:23:26Z niro $ PNAME="udev" PVER="163" PBUILD="r1" 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/util-linux-2.18 >= virtual/usbutils >= virtual/pciutils >= virtual/initscripts >= dev-libs/glib2-2.24" SDEPEND=">= virtual/kernel-sources >= dev-util/gperf-3.0.4" SRCFILE="${PNAME}-${PVER}.tar.bz2" SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" CONFIG_SRCFILE="config-${PNAME}-${PVER}-${PBUILD}.tar.bz2" CONFIG_SRCDIR="${BUILDDIR}/config-${PNAME}-${PVER}-${PBUILD}" # global var: ${LINUX_SOURCES} # location where they are [[ -z ${LINUX_SOURCES} ]] && LINUX_SOURCES="/usr/src/linux" MCORE_ONLY_KEEP="etc lib $(mlibdir) sbin usr/$(mlibdir)/*.so usr/$(mlibdir)/*.so.*" sminclude mtools multilib mcore-split SRC_URI=( http://www.kernel.org/pub/linux/utils/kernel/hotplug/${SRCFILE} mirror://${PNAME}/${SRCFILE} mirror://${PNAME}/${CONFIG_SRCFILE} ) UP2DATE="updatecmd http://www.kernel.org/pub/linux/utils/kernel/hotplug | grep ${PNAME}- | lasttarball" src_prepare() { munpack ${SRCFILE} || die oldmunpack ${CONFIG_SRCFILE} || die } src_compile() { # using /lib/udev as libexecdir also on multilib systems # to have one common rules/script directory! # same with the systemd units dir! # # we set --exec-prefix --bindir and --sbindir to fix ${exec_prefix} issues in the systemd units # variables are not allowd in the beginning of ExecStart # see: http://cgit.freedesktop.org/systemd/commit/?id=d2f316345cfadd07025b1a1770f63804e33c4b50 mconfigure \ --exec-prefix= \ --bindir=/bin \ --sbindir=/sbin \ --with-libdir-name='$(mlibdir)' \ --libexecdir=/lib/udev \ --enable-logging \ --without-selinux \ --disable-introspection \ --with-systemdsystemunitdir=/lib/systemd/system \ || die mmake || die } mcore_generic_src_install() { mmake DESTDIR=${BINDIR} install || die minstalldocs COPYING ChangeLog NEWS README TODO || die # install our config cd ${CONFIG_SRCDIR} make DESTDIR=${BINDIR} install || die # create symlinks for these utilities to /sbin # where multipath-tools expect them to be mlink ../lib/udev/scsi_id /sbin/ || die # mark some dirs undeletable mkeepdir /etc/udev/rules.d || die 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 } preinstall() { if [[ ! -z $(magequery -n hotplug) ]] then echo -e ${COLRED} echo -e "Error: sys-apps/hotplug is installed!!" echo -e "hotplug is now fully provided by udev itself and it is not recommend to use this anymore." echo -e "Please uninstall sys-apps/hotplug first!" echo -e ${COLDEFAULT} die "sys-apps/hotplug found!" fi 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 # delete deprecated pnp-aliases if [[ -f ${MROOT}/etc/modprobe.d/pnp-aliases ]] then rm -f ${MROOT}/etc/modprobe.d/pnp-aliases fi # delete all udev.rules which are moved from /etc/udev to /lib/udev local rule for rule in 40-arch-s390.rules \ 61-persistent-storage-edd.rules \ 75-persistent-net-generator.rules \ 64-md-raid.rules \ 65-permissions.rules \ 64-device-mapper.rules \ 40-alsa.rules \ 40-zaptel.rules \ 60-persistent-input.rules \ 40-arch-ia64.rules \ 05-udev-early.rules \ 40-arch-ppc.rules \ 60-cdrom_id.rules \ 40-pilot-links.rules \ 95-udev-late.rules \ 40-magellan.rules \ 50-udev-default.rules \ 80-drivers.rules \ 30-kernel-compat.rules \ 40-video.rules \ 60-persistent-storage-tape.rules \ 75-cd-aliases-generator.rules \ 60-persistent-storage.rules do # delete obsolete hotplug.dev script if [[ -f ${MROOT}/etc/udev/rules.d/${rule} ]] then rm -f ${MROOT}/etc/udev/rules.d/${rule} fi done } 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 }