]> Frank Brehm's Git Trees - config/helga/etc.git/commitdiff
saving uncommitted changes in /etc prior to emerge run
authorroot <root@helga.brehm-online.com>
Mon, 15 May 2017 13:20:15 +0000 (15:20 +0200)
committerroot <root@helga.brehm-online.com>
Mon, 15 May 2017 13:20:15 +0000 (15:20 +0200)
.etckeeper
conf.d/udev
conf.d/udev-settle [new file with mode: 0644]
conf.d/udev-trigger [new file with mode: 0644]
init.d/udev
init.d/udev-settle [new file with mode: 0755]
init.d/udev-trigger [new file with mode: 0755]

index 64d858ecdd804f719fa9119d6f3a09adef010069..62939a94d61d499806d97a98c699b328b862fc12 100755 (executable)
@@ -476,6 +476,8 @@ maybe chmod 0644 'conf.d/teamspeak3-server'
 maybe chmod 0644 'conf.d/tmpfiles'
 maybe chmod 0644 'conf.d/twistd'
 maybe chmod 0644 'conf.d/udev'
+maybe chmod 0644 'conf.d/udev-settle'
+maybe chmod 0644 'conf.d/udev-trigger'
 maybe chmod 0644 'conf.d/unbound'
 maybe chmod 0644 'conf.d/urandom'
 maybe chmod 0700 'config-archive'
@@ -1751,6 +1753,8 @@ maybe chmod 0755 'init.d/termencoding'
 maybe chmod 0755 'init.d/tmpfiles.dev'
 maybe chmod 0755 'init.d/tmpfiles.setup'
 maybe chmod 0755 'init.d/udev'
+maybe chmod 0755 'init.d/udev-settle'
+maybe chmod 0755 'init.d/udev-trigger'
 maybe chmod 0755 'init.d/ulogd'
 maybe chmod 0755 'init.d/unbound'
 maybe chmod 0755 'init.d/urandom'
index 41f6b9bc83776d815346821afd47381ef78cca9a..a714032fa9db282df5b35ec8b7c4249314ba98e3 100644 (file)
@@ -1,31 +1,5 @@
 # /etc/conf.d/udev: config file for udev
 
-# 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"
-
-# Expert options:
-
-# 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=""
@@ -33,15 +7,3 @@
 # Run udevd --debug and write output to /run/udevdebug.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 /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/conf.d/udev-settle b/conf.d/udev-settle
new file mode 100644 (file)
index 0000000..cb995e4
--- /dev/null
@@ -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/conf.d/udev-trigger b/conf.d/udev-trigger
new file mode 100644 (file)
index 0000000..5850b8b
--- /dev/null
@@ -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"
index 72b2be226a5fc7b863b05ac4557c5ca986ce0f69..6ff21b2ef989eb39a8252dae2f5cdd1a8a65e18a 100755 (executable)
@@ -1,4 +1,4 @@
-#!/sbin/runscript
+#!/sbin/openrc-run
 # Copyright 1999-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
@@ -7,18 +7,24 @@ description="udev manages device permissions and symbolic links in /dev"
 extra_started_commands="reload"
 description_reload="Reload the udev rules and databases"
 
-udev_monitor="${udev_monitor:-no}"
-udevmonitor_log=/run/udevmonitor.log
-udevmonitor_pid=/run/udevmonitor.pid
-
 depend()
 {
-       provide dev
        need sysfs dev-mount
        before checkfs fsck
+       keyword -lxc -systemd-nspawn -vserver
+}
 
-       # udev does not work inside vservers
-       keyword -vserver -lxc
+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()
@@ -52,16 +58,7 @@ start_pre()
                fi
        fi
 
-       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
+       get_udevd_binary || return 1
 
        if [ -e /proc/sys/kernel/hotplug ]; then
                echo "" >/proc/sys/kernel/hotplug
@@ -74,94 +71,6 @@ start_pre()
        return 0
 }
 
-start_udevmonitor()
-{
-       yesno "${udev_monitor}" || return 0
-
-       einfo "udev: 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}
-}
-
-# 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
-}
-
-populate_dev()
-{
-       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
-               ewarn "Skipping udev coldplug sequence"
-               return 0
-       fi
-
-       ebegin "Populating /dev with existing devices through uevents"
-       udevadm trigger --type=subsystems --action=add
-       udevadm trigger --type=devices --action=add
-       eend $?
-
-       ebegin "Waiting for uevents to be processed"
-       udevadm settle --timeout=${udev_settle_timeout:-60}
-       eend $?
-       return 0
-}
-
-stop_udevmonitor()
-{
-       yesno "${udev_monitor}" || 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 /bin/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}"
-}
-
-start_post()
-{
-       start_udevmonitor
-       populate_dev
-       stop_udevmonitor
-       display_hotplugged_services
-       return 0
-}
-
 stop()
 {
        local rc=0
@@ -170,8 +79,9 @@ stop()
        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 /sbin/udevd
+               start-stop-daemon --stop --exec ${command}
                rc=$?
        fi
        eend $rc "Failed to stop $RC_SVCNAME"
diff --git a/init.d/udev-settle b/init.d/udev-settle
new file mode 100755 (executable)
index 0000000..c495769
--- /dev/null
@@ -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/init.d/udev-trigger b/init.d/udev-trigger
new file mode 100755 (executable)
index 0000000..bdd4884
--- /dev/null
@@ -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 $?
+}