summaryrefslogtreecommitdiff
path: root/user/eudev
diff options
context:
space:
mode:
Diffstat (limited to 'user/eudev')
-rw-r--r--user/eudev/APKBUILD117
-rw-r--r--user/eudev/default-rules.patch9
-rw-r--r--user/eudev/load-fbcon.patch10
-rw-r--r--user/eudev/setup-udev28
-rw-r--r--user/eudev/udev-postmount.initd55
-rw-r--r--user/eudev/udev-settle.confd5
-rw-r--r--user/eudev/udev-settle.initd19
-rw-r--r--user/eudev/udev-trigger.confd32
-rw-r--r--user/eudev/udev-trigger.initd96
-rw-r--r--user/eudev/udev.confd9
-rw-r--r--user/eudev/udev.initd97
11 files changed, 477 insertions, 0 deletions
diff --git a/user/eudev/APKBUILD b/user/eudev/APKBUILD
new file mode 100644
index 000000000..ea5cdbd8b
--- /dev/null
+++ b/user/eudev/APKBUILD
@@ -0,0 +1,117 @@
+# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
+# Maintainer:
+pkgname=eudev
+pkgver=3.2.5
+pkgrel=2
+pkgdesc="OpenRC compatible fork of systemd-udev"
+url="https://wiki.gentoo.org/wiki/Project:Eudev"
+arch="all"
+options="!checkroot"
+license="GPL-2.0-only"
+depends=""
+depends_dev=""
+replaces="udev udev-init-scripts"
+provides="udev=176"
+makedepends="gperf glib-dev linux-headers kmod-dev gobject-introspection-dev
+ util-linux-dev"
+checkdepends="tree xz"
+subpackages="$pkgname-dev $pkgname-doc $pkgname-libs $pkgname-openrc
+ $pkgname-netifnames::noarch"
+source="http://dev.gentoo.org/~blueness/$pkgname/$pkgname-$pkgver.tar.gz
+ default-rules.patch
+ load-fbcon.patch
+ udev-postmount.initd
+ setup-udev
+ udev.initd
+ udev-settle.initd
+ udev-trigger.initd
+ udev.confd
+ udev-settle.confd
+ udev-trigger.confd
+ "
+builddir="$srcdir/$pkgname-$pkgver"
+
+build() {
+ cd "$builddir"
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --sysconfdir=/etc \
+ --with-rootprefix= \
+ --with-rootrundir=/run \
+ --with-rootlibexecdir=/lib/udev \
+ --libdir=/usr/lib \
+ --enable-split-usr \
+ --enable-manpages \
+ --disable-hwdb \
+ --enable-kmod \
+ --exec-prefix=/
+ make
+}
+
+check() {
+ cd "$builddir"
+ make check
+}
+
+package() {
+ cd "$builddir"
+
+ make DESTDIR="$pkgdir" sharepkgconfigdir=/usr/lib/pkgconfig \
+ install
+
+ local i
+ for i in udev udev-settle udev-trigger; do
+ install -Dm755 "$srcdir"/$i.initd \
+ "$pkgdir"/etc/init.d/$i
+ install -Dm644 "$srcdir"/$i.confd \
+ "$pkgdir"/etc/conf.d/$i
+ done
+
+ install -Dm755 "$srcdir"/udev-postmount.initd \
+ "$pkgdir"/etc/init.d/udev-postmount
+ install -Dm755 "$srcdir"/setup-udev \
+ "$pkgdir"/sbin/setup-udev
+}
+
+dev() {
+ replaces="udev-dev"
+ default_dev
+}
+
+libs() {
+ pkgdesc="Dynamic library to access udev device information"
+ replaces="libudev"
+ depends=""
+
+ mkdir -p "$subpkgdir"/lib
+ local i; for i in "$pkgdir"/usr/lib/libudev.so.*; do
+ mv $i "$subpkgdir"/lib
+ ln -s ../../lib/${i##*/} "$pkgdir"/usr/lib/${i##*/}
+ done
+}
+
+netifnames() {
+ pkgdesc="udev rules for systemd-style interface names"
+
+ mkdir -p "$subpkgdir"/lib/udev/rules.d
+ mv "$pkgdir"/lib/udev/rules.d/80-net-name-slot.rules \
+ "$subpkgdir"/lib/udev/rules.d/
+}
+
+openrc() {
+ replaces="udev-init-scripts-openrc"
+ default_openrc
+}
+
+sha512sums="f73efde0d2dafcf79be4ebe9f6e6abb44329ea4ae45ccc4d9662c1d5ca6f4d45c27ca0b3135d7fa85f305bf7c5825dc1000079eb93fe7179c36a229fe63e372c eudev-3.2.5.tar.gz
+683e3c26ca4f058303f8db7d4977e436d728386ee6866719c4f11ff31db27572d3f486f51d3173310e1ec2cf995fa4c396f2415bdf45dabdd80e6e55e798a314 default-rules.patch
+ff5928fd555e095d9f3234dd004ac4c5925405d308777e9b018e8e03112cd109935b51d75a3bc4a2a1018eb486e8a5e5ef6ee978860002a8fff93b116e9721f5 load-fbcon.patch
+8ef1b911843ab13acb1c1b9b7a0a5cd76659f395c3db9e579429556f23eacebb414507dc0231e2455e7589bc70054fa1e6b6dd93dd833f7101c0da0597aabf88 udev-postmount.initd
+d79c44e2879f00a0f87cdfb4971936ec201706690014b2a11634deb564cba0d53aba37b97b5595e6bc2f4bd258be33c52aba6236dc2f1a79fbb37027fde60a3d setup-udev
+5f171985505630bc7147c6c4180ce009b772b2b00ffc876693a839b02479e820dbd44644653e2adf16b8fecd8ea94da9cfb07cd239343211b2ddafa64568aacf udev.initd
+24fb7fcc37f73f3275141178e436917fc988dd7bfd97321b7603824ffbf84c5bed6573de2b9447f68c75ce704af96b45cafca27e07acd8754a6f6bc597684445 udev-settle.initd
+a4dd32e702ea522095e42794568a624556ff07187161805f77f569d1d1df0eb08ea25b943afceff0c2f8d71c93aece0bbc9fe2e69f525b2af249713609e2e715 udev-trigger.initd
+731eeb358ff0b25d524c6108087d0a61368e3aeabbda07f49d67e44b70ac4183cc1f4b14608351bd4572b5a9c215e7235340e634cdcfce8072bc330da3498e07 udev.confd
+fa9d1e9b071b0038d9869f8be92322baea86ff6f26d4bdf254622aae156bb19afb3135f06321cd2350f0e7501d39d1f70dc1760f77b78858787ef24d4664c16b udev-settle.confd
+6f953f9a3dbe0f9ff8ce1950411a8cc77453a3d1cd4c98520ba670b1aba520e666b1d64b7e9db5480e569673d9f9440e619f8af6b81e6ce140c0a363422c2a95 udev-trigger.confd"
diff --git a/user/eudev/default-rules.patch b/user/eudev/default-rules.patch
new file mode 100644
index 000000000..0786a9826
--- /dev/null
+++ b/user/eudev/default-rules.patch
@@ -0,0 +1,9 @@
+--- a/rules/50-udev-default.rules
++++ b/rules/50-udev-default.rules
+@@ -73,5 +73,6 @@ KERNEL=="rfkill", MODE="0664"
+ KERNEL=="tun", MODE="0666", OPTIONS+="static_node=net/tun"
+
+ KERNEL=="fuse", MODE="0666", OPTIONS+="static_node=fuse"
++KERNEL=="kvm", GROUP="kvm", MODE="0660"
+
+ LABEL="default_end"
diff --git a/user/eudev/load-fbcon.patch b/user/eudev/load-fbcon.patch
new file mode 100644
index 000000000..e5e404a48
--- /dev/null
+++ b/user/eudev/load-fbcon.patch
@@ -0,0 +1,10 @@
+--- eudev-3.2.1/rules/80-drivers.rules.orig 2017-01-24 11:00:53.174192908 +0200
++++ eudev-3.2.1/rules/80-drivers.rules 2017-01-24 11:04:01.886714118 +0200
+@@ -8,6 +8,7 @@
+ SUBSYSTEM=="memstick", RUN{builtin}+="kmod load ms_block mspro_block"
+ SUBSYSTEM=="i2o", RUN{builtin}+="kmod load i2o_block"
+ SUBSYSTEM=="module", KERNEL=="parport_pc", RUN{builtin}+="kmod load ppdev"
++SUBSYSTEM=="graphics", RUN{builtin}+="kmod load fbcon"
+ KERNEL=="mtd*ro", ENV{MTD_FTL}=="smartmedia", RUN{builtin}+="kmod load sm_ftl"
+
+ LABEL="drivers_end"
diff --git a/user/eudev/setup-udev b/user/eudev/setup-udev
new file mode 100644
index 000000000..a4d0aacf0
--- /dev/null
+++ b/user/eudev/setup-udev
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+while getopts "hn" opt; do
+ case "$opt" in
+ h) echo "remove mdev and enable udev from boot"
+ echo "usage: $0 [-n]"
+ echo "options:"
+ echo " -n Do not start udev"
+ ;;
+ n) dryrun=1
+ ;;
+ esac
+done
+
+rm -f /etc/runlevels/sysinit/hwdrivers /etc/runlevels/sysinit/mdev
+
+for i in udev-trigger udev udev-postmount; do
+ if ! [ -e /etc/runlevels/sysinit/$i ]; then
+ ln -s /etc/init.d/$i /etc/runlevels/sysinit/$i
+ fi
+done
+
+if [ -z "$dryrun" ] && ! rc-service --quiet udev status; then
+ rc-service udev start
+ rc-service udev-postmount start
+ rc-service udev-trigger start
+ rc-service udev-settle start
+fi
diff --git a/user/eudev/udev-postmount.initd b/user/eudev/udev-postmount.initd
new file mode 100644
index 000000000..f1f94f489
--- /dev/null
+++ b/user/eudev/udev-postmount.initd
@@ -0,0 +1,55 @@
+#!/sbin/openrc-run
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend()
+{
+ need localmount
+ keyword -vserver -lxc
+}
+
+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()
+{
+ # create /etc/udev/rules.d if it does not exist and /etc/udev is writable
+ [ -d /etc/udev/rules.d ] || \
+ dir_writeable /etc/udev && \
+ mkdir -p /etc/udev/rules.d
+
+ # only continue if rules-directory is writable
+ dir_writeable /etc/udev/rules.d || return 0
+
+ local file dest
+ for file in /run/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 /run/udev ] || return 0
+
+ # store persistent-rules that got created while booting
+ # when / was still read-only
+ store_persistent_rules
+}
+
+stop()
+{
+ return 0
+}
+
+# vim:ts=4
diff --git a/user/eudev/udev-settle.confd b/user/eudev/udev-settle.confd
new file mode 100644
index 000000000..cb995e410
--- /dev/null
+++ b/user/eudev/udev-settle.confd
@@ -0,0 +1,5 @@
+# /etc/conf.d/udev-settle: config file for udev-settle
+
+# Timeout in seconds to wait for processing of uevents at boot.
+# There should be no need to change this.
+#udev_settle_timeout=120
diff --git a/user/eudev/udev-settle.initd b/user/eudev/udev-settle.initd
new file mode 100644
index 000000000..c495769e6
--- /dev/null
+++ b/user/eudev/udev-settle.initd
@@ -0,0 +1,19 @@
+#!/sbin/openrc-run
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend()
+{
+ need udev
+ after udev-trigger
+ provide dev-settle
+ keyword -lxc -systemd-nspawn -vserver
+}
+
+start()
+{
+ ebegin "Waiting for uevents to be processed"
+ udevadm settle \
+ ${udev_settle_timeout:+--timeout=}$udev_settle_timeout
+ eend $?
+}
diff --git a/user/eudev/udev-trigger.confd b/user/eudev/udev-trigger.confd
new file mode 100644
index 000000000..5850b8be6
--- /dev/null
+++ b/user/eudev/udev-trigger.confd
@@ -0,0 +1,32 @@
+# /etc/conf.d/udev-trigger: config file for udev-trigger
+
+# 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"
+
+# We can create a /dev/root symbolic link to point to the root device in
+# some situations. This is on by default because some software relies on
+# it,. However, this software should be fixed to not do this.
+# For more information, see
+# https://bugs.gentoo.org/show_bug.cgi?id=438380.
+# If you are not using any affected software, you do not need this, so
+# feel free to turn it off.
+#rc_dev_root_symlink="YES"
+
+# Run udevadmin monitor to get a log of all events
+# in /run/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/user/eudev/udev-trigger.initd b/user/eudev/udev-trigger.initd
new file mode 100644
index 000000000..bdd4884a3
--- /dev/null
+++ b/user/eudev/udev-trigger.initd
@@ -0,0 +1,96 @@
+#!/sbin/openrc-run
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+description="udev Coldplug all Devices"
+
+udevmonitor_log=/run/udevmonitor.log
+udevmonitor_pid=/run/udevmonitor.pid
+
+depend()
+{
+ need udev
+ provide dev
+ keyword -lxc -systemd-nspawn -vserver
+}
+
+start_pre()
+{
+ if yesno "${udev_monitor:-no}"; then
+ einfo "Running udevadm monitor ${udev_monitor_opts} to log all events"
+ start-stop-daemon --start --stdout "${udevmonitor_log}" \
+ --make-pidfile --pidfile "${udevmonitor_pid}" \
+ --background --exec /bin/udevadm -- monitor ${udev_monitor_opts}
+ fi
+ return 0
+}
+
+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}"
+ return 0
+}
+
+start_post()
+{
+ if yesno "${udev_monitor:-no}"; then
+ if yesno "${udev_monitor_keep_running:-no}"; then
+ ewarn "udevmonitor is still writing into ${udevmonitor_log}"
+ else
+ einfo "Stopping udevmonitor: Log is in ${udevmonitor_log}"
+ start-stop-daemon --stop --pidfile "${udevmonitor_pid}" \
+ --exec /bin/udevadm
+ fi
+ fi
+ display_hotplugged_services
+ return 0
+}
+
+# This is here because some software expects /dev/root to exist.
+# For more information, see this bug:
+# https://bugs.gentoo.org/show_bug.cgi?id=438380
+dev_root_link()
+{
+ local RULESDIR=/run/udev/rules.d
+ [ -d $RULESDIR ] || mkdir -p $RULESDIR
+ eval $(udevadm info --export --export-prefix=ROOT_ --device-id-of-file=/ ||
+ true)
+ [ "$ROOT_MAJOR" -a "$ROOT_MINOR" ] || return 0
+
+ # btrfs filesystems have bogus major/minor numbers
+ [ "$ROOT_MAJOR" != 0 ] || return 0
+
+ echo 'ACTION=="add|change", SUBSYSTEM=="block", ENV{MAJOR}=="'$ROOT_MAJOR'", ENV{MINOR}=="'$ROOT_MINOR'", SYMLINK+="root"' > $RULESDIR/61-dev-root-link.rules
+ return 0
+}
+
+start()
+{
+ if yesno ${rc_dev_root_symlink:-yes}; then
+ ebegin "Generating a rule to create a /dev/root symlink"
+ dev_root_link
+ eend $?
+ fi
+
+ get_bootparam "nocoldplug" && rc_coldplug="no"
+ if ! yesno ${rc_coldplug:-${RC_COLDPLUG:-yes}}; then
+ einfo "Setting /dev permissions and symbolic links"
+ udevadm trigger --attr-match=dev --action=add
+ udevadm trigger --subsystem-match=net --action=add
+ rc=$?
+ ewarn "Skipping udev coldplug sequence"
+ return $rc
+ fi
+
+ ebegin "Populating /dev with existing devices through uevents"
+ udevadm trigger --type=subsystems --action=add
+ udevadm trigger --type=devices --action=add
+ eend $?
+}
diff --git a/user/eudev/udev.confd b/user/eudev/udev.confd
new file mode 100644
index 000000000..a714032fa
--- /dev/null
+++ b/user/eudev/udev.confd
@@ -0,0 +1,9 @@
+# /etc/conf.d/udev: config file for udev
+
+# Add extra command line options to udevd, use with care
+# udevd --help for possible values
+#udev_opts=""
+
+# Run udevd --debug and write output to /run/udevdebug.log
+# Should not be kept on as it fills diskspace slowly
+#udev_debug="YES"
diff --git a/user/eudev/udev.initd b/user/eudev/udev.initd
new file mode 100644
index 000000000..796453ee8
--- /dev/null
+++ b/user/eudev/udev.initd
@@ -0,0 +1,97 @@
+#!/sbin/openrc-run
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+command_args="--daemon ${udev_opts}"
+description="udev manages device permissions and symbolic links in /dev"
+extra_started_commands="reload"
+description_reload="Reload the udev rules and databases"
+
+depend()
+{
+ use modloop
+ need sysfs dev-mount
+ before checkfs fsck
+ keyword -lxc -systemd-nspawn -vserver
+ provide dev
+}
+
+get_udevd_binary() {
+ local bins="/sbin/udevd /lib/systemd/systemd-udevd /usr/lib/systemd/systemd-udevd"
+ for f in ${bins}; do
+ if [ -x "$f" -a ! -L "$f" ]; then
+ command="$f"
+ fi
+ done
+ if [ -z "$command" ]; then
+ eerror "Unable to find udev executable."
+ return 1
+ fi
+}
+
+start_pre()
+{
+ # make sure devtmpfs is in the kernel
+ if ! grep -qs devtmpfs /proc/filesystems; then
+ eerror "CONFIG_DEVTMPFS=y is required in your kernel configuration"
+ eerror "for this version of udev to run successfully."
+ eerror "This requires immediate attention."
+ if ! mountinfo -q /dev; then
+ mount -n -t tmpfs dev /dev
+ busybox mdev -s
+ mkdir /dev/pts
+ fi
+ return 1
+ fi
+
+ # make sure /dev is a mounted devtmpfs
+ if ! mountinfo -q -f devtmpfs /dev; then
+ eerror "Udev requires /dev to be a mounted devtmpfs."
+ eerror "Please reconfigure your system."
+ return 1
+ fi
+
+ # 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"
+ return 1
+ fi
+ fi
+
+ get_udevd_binary || return 1
+
+ if [ -e /proc/sys/kernel/hotplug ]; then
+ echo "" >/proc/sys/kernel/hotplug
+ fi
+
+ if yesno "${udev_debug:-NO}"; then
+ command_args="${command_args} --debug 2> /run/udevdebug.log"
+ fi
+
+ return 0
+}
+
+stop()
+{
+ local rc=0
+ ebegin "Stopping ${name:-$RC_SVCNAME}"
+ udevadm control --exit
+ rc=$?
+ if [ $rc -ne 0 ]; then
+ eend $rc "Failed to stop $RC_SVCNAME using udevadm"
+ get_udevd_binary || return 1
+ ebegin "Trying with start-stop-daemon"
+ start-stop-daemon --stop --exec ${command}
+ rc=$?
+ fi
+ eend $rc "Failed to stop $RC_SVCNAME"
+}
+
+reload()
+{
+ ebegin "reloading udev rules and databases"
+ udevadm control --reload
+ eend $?
+}