summaryrefslogtreecommitdiffstats
path: root/source/a/udev/config/rc.d/rc.udev.new
diff options
context:
space:
mode:
author Patrick J Volkerding <volkerdi@slackware.com>2012-09-26 01:10:42 +0000
committer Eric Hameleers <alien@slackware.com>2018-05-31 22:51:55 +0200
commit9664bee729d487bcc0a0bc35859f8e13d5421c75 (patch)
treeb428a16618e36ed864a8d76ea3435e19a452bf90 /source/a/udev/config/rc.d/rc.udev.new
parent75a4a592e5ccda30715f93563d741b83e0dcf39e (diff)
downloadcurrent-9664bee729d487bcc0a0bc35859f8e13d5421c75.tar.gz
current-9664bee729d487bcc0a0bc35859f8e13d5421c75.tar.xz
Slackware 14.0slackware-14.0
Wed Sep 26 01:10:42 UTC 2012 Slackware 14.0 x86_64 stable is released! We're perfectionists here at Slackware, so this release has been a long time a-brewing. But we think you'll agree that it was worth the wait. Slackware 14.0 combines modern components, ease of use, and flexible configuration... our "KISS" philosophy demands it. The ISOs are off to be replicated, a 6 CD-ROM 32-bit set and a dual-sided 32-bit/64-bit x86/x86_64 DVD. Please consider supporting the Slackware project by picking up a copy from store.slackware.com. We're taking pre-orders now, and offer a discount if you sign up for a subscription. Thanks to everyone who helped make this happen. The Slackware team, the upstream developers, and (of course) the awesome Slackware user community. Have fun! :-)
Diffstat (limited to 'source/a/udev/config/rc.d/rc.udev.new')
-rw-r--r--source/a/udev/config/rc.d/rc.udev.new92
1 files changed, 49 insertions, 43 deletions
diff --git a/source/a/udev/config/rc.d/rc.udev.new b/source/a/udev/config/rc.d/rc.udev.new
index 6a6218f6e..2bbd9819c 100644
--- a/source/a/udev/config/rc.d/rc.udev.new
+++ b/source/a/udev/config/rc.d/rc.udev.new
@@ -4,7 +4,6 @@
# appropriate kernel modules, and configures the devices.
PATH="/sbin:/bin"
-OPT=""
. /etc/udev/udev.conf
@@ -25,26 +24,38 @@ mount_devpts() {
case "$1" in
start)
- # Sanity check #1, udev requires that the kernel support tmpfs:
+ # Sanity check #1, udev requires that the kernel support devtmpfs:
+ if ! grep -wq devtmpfs /proc/filesystems ; then
+ echo "Sorry, but you need devtmpfs support in the kernel to use udev."
+ echo "Both of these options are needed: CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS_MOUNT=y"
+ echo
+ echo "FATAL: Refusing to run /etc/rc.d/rc.udev."
+ sleep 10
+ exit 1
+ fi
+
+ # Sanity check #2, udev requires that the kernel support tmpfs:
if ! grep -wq tmpfs /proc/filesystems ; then
echo "Sorry, but you need tmpfs support in the kernel to use udev."
echo
echo "FATAL: Refusing to run /etc/rc.d/rc.udev."
+ sleep 10
exit 1
fi
- # Sanity check #2, make sure that a 2.6.x kernel is new enough:
+ # Sanity check #3, make sure that a 2.6.x kernel is new enough:
if [ "$(uname -r | cut -f 1,2 -d .)" = "2.6" ]; then
if [ "$(uname -r | cut -f 3 -d . | sed 's/[^[:digit:]].*//')" -lt "32" ]; then
echo "Sorry, but you need a 2.6.32+ kernel to use this udev."
echo "Your kernel version is only $(uname -r)."
echo
echo "FATAL: Refusing to run /etc/rc.d/rc.udev."
+ sleep 10
exit 1
fi
fi
- # Sanity check #3, make sure the udev package was not removed. If udevd
+ # Sanity check #4, make sure the udev package was not removed. If udevd
# is not there, this will also shut off this script to prevent further
# problems:
if [ ! -x /sbin/udevd ]; then
@@ -52,6 +63,7 @@ case "$1" in
echo "No udevd daemon found."
echo "Turning off udev: chmod 644 /etc/rc.d/rc.udev"
echo "FATAL: Refusing to run /etc/rc.d/rc.udev."
+ sleep 10
exit 1
fi
@@ -90,47 +102,41 @@ case "$1" in
# Mount devpts
mount_devpts
- # Start udevd.
- /sbin/udevd --daemon 2>/dev/null
-
- # If udevd was already running, then it will return !=0 exit code,
- # so we'll try to re-run failed events
- if [ $? != 0 ]; then
- OPT="--type=failed $OPT"
- ( cd ${UDEV_ROOT}/.udev
- for TMPFILE in tmp-rules-*.rules ; do
- mv $TMPFILE /etc/udev/rules.d/${TMPFILE/tmp-rules--/} 2>/dev/null
- done
- )
- else # udev is just now being started, so we'll do some initial setup:
-
- # Create rootdev rules
- DEVICENUMBER=$( /bin/stat -c %d / )
- MAJORNUMBER=$(($DEVICENUMBER / 256))
- MINORNUMBER=$(($DEVICENUMBER % 256))
-
- echo 'ACTION!="remove", SUBSYSTEM=="block", ENV{MAJOR}=="'$MAJORNUMBER'", ENV{MINOR}=="'$MINORNUMBER'", SYMLINK+="root"' > /dev/.udev/rules.d/61-dev-root-link.rules
-
- # Set OPT="--action=add" to generate add events on coldplug
- OPT="--action=add"
-
- fi
-
- echo "Triggering udev events: /sbin/udevadm trigger $OPT"
- # Call udevtrigger and udevsettle to do the device configuration:
- /sbin/udevadm trigger $OPT && /sbin/udevadm settle --timeout=120
-
- ;;
+ if ! /sbin/pidof udevd 1>/dev/null 2>/dev/null; then # start udevd
+ echo "Starting udevd: /sbin/udevd --daemon"
+ /sbin/udevd --daemon
+ # Since udev is just now being started we want to use add events:
+ echo "Triggering udev events: /sbin/udevadm trigger --action=add"
+ # Call udevtrigger and udevsettle to do the device configuration:
+ /sbin/udevadm trigger --type=subsystems --action=add
+ /sbin/udevadm trigger --type=devices --action=add
+ else # trigger changes for already running udevd
+ # If the persistent rules files do not exist, trigger an add event:
+ if [ ! -r /etc/udev/rules.d/70-persistent-net.rules ]; then
+ # Test that we can actually write to the directory first:
+ if touch /etc/udev/rules.d/testfile 2> /dev/null ; then
+ rm -f /etc/udev/rules.d/testfile
+ # This should add persistent net/cd rules:
+ echo "Triggering udev to write persistent rules to /etc/udev/rules.d/"
+ /sbin/udevadm trigger --type=devices --action=add
+ sleep 3
+ fi
+ fi
+ # Since udevd is running, most of the time we only need change events:
+ echo "Triggering udev events: /sbin/udevadm trigger --action=change"
+ /sbin/udevadm trigger --type=subsystems --action=change
+ /sbin/udevadm trigger --type=devices --action=change
+ fi
+ /sbin/udevadm settle --timeout=120
+ ;;
stop)
echo "Stopping udevd is STRONGLY discouraged and not supported."
echo "If you are sure you want to do this, use 'force-stop' instead."
;;
force-stop)
echo "Stopping udevd"
- if [ -e /proc/sys/kernel/hotplug ]; then
- echo /sbin/hotplug > /proc/sys/kernel/hotplug
- fi
- killall udevd
+ udevadm control --exit
+ killall udevd 2>/dev/null
;;
restart)
echo "Restarting udevd is STRONGLY discouraged and not supported."
@@ -138,18 +144,18 @@ case "$1" in
;;
force-restart)
echo "Restarting udevd"
- killall udevd
- sleep 5
+ udevadm control --exit
+ sleep 3
udevd --daemon
;;
reload)
echo "Reloading udev rules"
- udevadm control --reload-rules
+ udevadm control --reload
cp --preserve=all --recursive --update /lib/udev/devices/* $UDEV_ROOT
;;
force-reload)
echo "Updating all available device nodes in $UDEV_ROOT"
- udevadm control --reload-rules
+ udevadm control --reload
rm -rf $UDEV_ROOT/.udev $UDEV_ROOT/disk
cp --preserve=all --recursive --update /lib/udev/devices/* $UDEV_ROOT
;;