diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2015-07-17 12:33:00 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2015-07-17 12:33:00 +0000 |
commit | ac6acecf9c7ed778422c3685b80ea195551471a1 (patch) | |
tree | 742f305c5fece171ae2ff07b5ac7b79109d43eb3 | |
parent | 607fa5ebb009d014cd29de1a291fa63170776288 (diff) | |
download | aports-ac6acecf9c7ed778422c3685b80ea195551471a1.tar.bz2 aports-ac6acecf9c7ed778422c3685b80ea195551471a1.tar.xz |
main/udev: replaced by eudev
-rw-r--r-- | main/udev/APKBUILD | 102 | ||||
-rw-r--r-- | main/udev/get_pw_r_size.patch | 32 | ||||
-rw-r--r-- | main/udev/udev-mount.initd | 63 | ||||
-rw-r--r-- | main/udev/udev-postmount.initd | 49 | ||||
-rw-r--r-- | main/udev/udev.confd | 64 | ||||
-rw-r--r-- | main/udev/udev.initd | 241 | ||||
-rwxr-xr-x | main/udev/write_root_link_rule | 29 |
7 files changed, 15 insertions, 565 deletions
diff --git a/main/udev/APKBUILD b/main/udev/APKBUILD index e1b6400fc7..acdee56c7d 100644 --- a/main/udev/APKBUILD +++ b/main/udev/APKBUILD @@ -1,106 +1,34 @@ # Maintainer: Natanael Copa <ncopa@alpinelinux.org> pkgname=udev pkgver=175 -pkgrel=9 -pkgdesc="The userspace dev tools (udev)" +pkgrel=10 +pkgdesc="Compatility package. Use udev instead" url="http://www.kernel.org/pub/linux/utils/kernel/hotplug/" -arch="all" +arch="noarch" license="GPL2" -subpackages="$pkgname-dev $pkgname-doc libudev libgudev" -depends= -makedepends="gobject-introspection-dev glib-dev gperf acl-dev libusb-compat-dev - usbutils pciutils-dev libtool sed linux-headers" +subpackages="" +depends="eudev" +makedepends="" install="" -source="http://www.kernel.org/pub/linux/utils/kernel/hotplug/$pkgname-$pkgver.tar.bz2 - get_pw_r_size.patch - write_root_link_rule - udev-mount.initd - udev-postmount.initd - udev.initd" +source="" -_builddir="$srcdir/$pkgname-$pkgver" prepare() { - cd "$_builddir" - for i in $source; do - case $i in - *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;; - esac - done - update_config_sub || return 1 + return 0 } build() { - cd "$_builddir" - ./configure \ - --build=$CBUILD \ - --host=$CHOST \ - --prefix=/usr \ - --sysconfdir=/etc \ - --sbindir=/sbin \ - --libdir=/usr/lib \ - --with-rootlibdir=/lib \ - --libexecdir=/lib/udev \ - || return 1 - make || return 1 + mkdir -p "$pkgdir" } package() { - cd "$_builddir" - make DESTDIR="$pkgdir" install || return 1 + mkdir -p "$pkgdir"/usr/share/doc/udev + cat >"$pkgdir"/usr/share/doc/udev/README.alpine <<EOF - # Upstream moved udevd to /lib/udev - ln -s "../lib/udev/udevd" "$pkgdir"/sbin/udevd +udev is deprecated and replaced by eudev. To replace it you need to: - # multipath-tools expect scsi_id in /sbin - ln -s "../lib/udev/scsi_id" "$pkgdir"/sbin/scsi_id + apk add eudev + apk del udev - mkdir -p "$pkgdir"/usr/lib/pkgconfig - chmod +x "$pkgdir"/lib/udev/write_*_rules - for _i in write_root_link_rule; 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 - # provided by bluez - rm -f "$pkgdir"/lib/udev/hid2hci - - # remove libtool archives - rm "$pkgdir"/usr/lib/*.la -} - -libudev() { - pkgdesc="Dynamic library to access udev device information" - replaces="udev" - mkdir -p "$subpkgdir"/lib - mv "$pkgdir"/lib/libudev.so.* "$subpkgdir"/lib/ -} - -libgudev() { - pkgdesc="A GObject wrapper of the library gudev" - replaces="udev" - mkdir -p "$subpkgdir"/lib/ \ - "$subpkgdir"/usr/lib || return 1 - mv "$pkgdir"/lib/libgudev* "$subpkgdir"/lib/ || return 1 - mv "$pkgdir"/usr/lib/girepository-* \ - "$subpkgdir"/usr/lib/ +EOF } -md5sums="2fc9c1efcbde98e3d73ffee7a77aea47 udev-175.tar.bz2 -d1a116770ca52765f2521bb27c1a093a get_pw_r_size.patch -c9de7581099cdfdcd105666cd98a0f0a write_root_link_rule -a725871bf3bab6430718fa22a1607293 udev-mount.initd -fbb31c795abc79091ca67b3d46782fc0 udev-postmount.initd -e636c4e5b5e46dd3345f5ab704311d41 udev.initd" -sha256sums="4c7937fe5a1521316ea571188745b9a00a9fdf314228cffc53a7ba9e5968b7ab udev-175.tar.bz2 -1298d15ed74a33d283df2de41ef35464f3f71cca8efe3f19760fd2831477b0c0 get_pw_r_size.patch -f8cff0e73ef40c6a9f642aba35136eac6e60d4cdfb54027aad59f6b770c01915 write_root_link_rule -8280ab0ff36e004b020da0a9242e51346244a7a22f25f71e9389cab516585a14 udev-mount.initd -7cff09cf881bfcb8ce1e6e950468ae409564de3b4b15660bd49c632631b8cb92 udev-postmount.initd -101977a7ab6d10ee96230fca4e2b9ff04264835d47e4099012285f054fa1f87a udev.initd" -sha512sums="1e2b3fd385d2b53b42949c83ecad7bd63244f865b6fa4c6fc96fe62b1c23be305f6d47c9c51cdfef4cb3b290f3dbb46b6fea12dfeedc01700fcd07a319c6a7fd udev-175.tar.bz2 -68188c54b866cf0d551aa52e9333d34224f8c4b59c225a24d3bdf19e248a89748b8ae39efcd7aa0ce3b41e4b60f6115798d7a1cc678c790623b6296eb559e970 get_pw_r_size.patch -f3dc810e41e8123a1004108afb98406aa7f44cb69072a6deb0dce75ed2de1d79304b3cbfc38ca3c3d7289db6695f65f3c87162c83f87a2052b404e901a344703 write_root_link_rule -fc8e32631e58dd9d6f6b9e242336b7c4bdb4e5c7293b6b7767fc0dd8b1bf8f90afcefa814c3d5ab1257f81daa4f54c3d7f4fb271e6bd2f45f965739b22fe5cda udev-mount.initd -969936c98f76e32683a1cf8f9ed94f66193d8f63c10b8e73091f296b074c0cac45d1ef6de1e2fcade71a2d22680d608a8528648f0ac273a014865025f446dda2 udev-postmount.initd -7fcfddc9d5b6326a20e30bebfec23d60ed980c62620b4a318ef7e4c44354b946c0fb85b80a030c87c0f0f457a748194a0ba4cf9c9f09bf607c915a86c9e4d33b udev.initd" diff --git a/main/udev/get_pw_r_size.patch b/main/udev/get_pw_r_size.patch deleted file mode 100644 index 3462920dfc..0000000000 --- a/main/udev/get_pw_r_size.patch +++ /dev/null @@ -1,32 +0,0 @@ -diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c -index 2d7f8dc..19b67a4 100644 ---- a/libudev/libudev-util-private.c -+++ b/libudev/libudev-util-private.c -@@ -133,8 +133,8 @@ int util_unlink_secure(struct udev *udev, const char *filename) - uid_t util_lookup_user(struct udev *udev, const char *user) - { - char *endptr; -- size_t buflen = sysconf(_SC_GETPW_R_SIZE_MAX); -- char buf[buflen]; -+ long buflen = sysconf(_SC_GETPW_R_SIZE_MAX); -+ char buf[buflen > 0 ? buflen : 1024]; - struct passwd pwbuf; - struct passwd *pw; - uid_t uid; -@@ -158,12 +158,15 @@ uid_t util_lookup_user(struct udev *udev, const char *user) - gid_t util_lookup_group(struct udev *udev, const char *group) - { - char *endptr; -- size_t buflen = sysconf(_SC_GETGR_R_SIZE_MAX); -+ long buflen = sysconf(_SC_GETGR_R_SIZE_MAX); - char *buf; - struct group grbuf; - struct group *gr; - gid_t gid = 0; - -+ if (buflen < 0) -+ buflen = 1024; -+ - if (strcmp(group, "root") == 0) - return 0; - gid = strtoul(group, &endptr, 10); diff --git a/main/udev/udev-mount.initd b/main/udev/udev-mount.initd deleted file mode 100644 index 025ba75cd9..0000000000 --- a/main/udev/udev-mount.initd +++ /dev/null @@ -1,63 +0,0 @@ -#!/sbin/openrc-run -# 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 - rm -rf /dev/fd - ln -snf /proc/self/fd /dev/fd - 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/main/udev/udev-postmount.initd b/main/udev/udev-postmount.initd deleted file mode 100644 index b716af228b..0000000000 --- a/main/udev/udev-postmount.initd +++ /dev/null @@ -1,49 +0,0 @@ -#!/sbin/openrc-run -# 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/164/udev-postmount.initd,v 1.1 2010/10/30 13:53:54 zzam Exp $ - -depend() { - need localmount -} - -dir_writeable() -{ - touch "$1"/.test.$$ 2>/dev/null && rm "$1"/.test.$$ -} - -# store persistent-rules that got created while booting -# when / was still read-only -store_persistent_rules() { - # only continue if rules-directory is writable - dir_writeable /etc/udev/rules.d || return 0 - - 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 -} - - -start() { - # check if this system uses udev - [ -d /dev/.udev/ ] || return 0 - - einfo "Doing udev cleanups" - - # store persistent-rules that got created while booting - # when / was still read-only - store_persistent_rules -} - -stop() { - : -} - -# vim:ts=4 diff --git a/main/udev/udev.confd b/main/udev/udev.confd deleted file mode 100644 index 7c3d3eb229..0000000000 --- a/main/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/main/udev/udev.initd b/main/udev/udev.initd deleted file mode 100644 index 70debb5c1f..0000000000 --- a/main/udev/udev.initd +++ /dev/null @@ -1,241 +0,0 @@ -#!/sbin/openrc-run -# 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 -} - -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 and not yet loaded, Bug #363549 - if [ ! -e /proc/net/unix ]; then - if ! modprobe unix; then - eerror "Cannot load the unix domain socket module" - fi - 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" --type="subsystems" - udevadm trigger --action="add" --type="devices" - 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/main/udev/write_root_link_rule b/main/udev/write_root_link_rule deleted file mode 100755 index 8eaea11769..0000000000 --- a/main/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}" - |