summaryrefslogtreecommitdiff
path: root/etc/dev.d/default
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2004-12-07 22:55:08 +0100
committerGreg KH <gregkh@suse.de>2005-04-26 23:06:10 -0700
commite4b5f339c7b63e9f67fccf2d0ef549ca34d56a7d (patch)
tree492a0eeafe7d1f9cd3d1456594aa7a4311b83756 /etc/dev.d/default
parentc64081980e7dc693327ad18995bc25e3eec61eea (diff)
[PATCH] update Fedora dev.d/ example and remove unused conf.d/ directory
Diffstat (limited to 'etc/dev.d/default')
-rw-r--r--etc/dev.d/default/pam_console.dev56
1 files changed, 45 insertions, 11 deletions
diff --git a/etc/dev.d/default/pam_console.dev b/etc/dev.d/default/pam_console.dev
index 563051d7f6..4c69ea3576 100644
--- a/etc/dev.d/default/pam_console.dev
+++ b/etc/dev.d/default/pam_console.dev
@@ -1,18 +1,52 @@
#!/bin/sh
-if [ -f /etc/sysconfig/udev ]; then
- . /etc/sysconfig/udev
-fi
+# Fedora solution to set the ownership/permissions of s device to the local
+# logged in user. Uses the program pam_console_setowner to match the names of
+# the device node and the symlinks against a device list and applies the
+# configured ownership and permission to the node.
-if [ -f /etc/conf.d/udev ]; then
- . /etc/conf.d/udev
-fi
+[ "$ACTION" != "add" ] && exit 0
+
+# we do not have console users in rc.sysinit
+[ -n "$IN_INITLOG" ] && exit 0
+
+if [ -x /sbin/pam_console_setowner -a -f /var/run/console/console.lock \
+ -a -e "$DEVNAME" ]; then
-[ "$UDEV_CONSOLE" != "yes" ] && exit 0
+ if [ -x /usr/bin/logger ]; then
+ LOGGER=/usr/bin/logger
+ elif [ -x /bin/logger ]; then
+ LOGGER=/bin/logger
+ else
+ unset LOGGER
+ fi
+ #
+ # for diagnostics
+ #
+ if [ -t 1 -o -z "$LOGGER" ]; then
+ mesg () {
+ echo "$@"
+ }
+ else
+ mesg () {
+ $LOGGER -t $(basename $0)"[$$]" "$@"
+ }
+ fi
-if [ -x /sbin/pam_console_setowner ]; then
- if [ "$UDEV_LOG" = "yes" ] && [ -x /usr/bin/logger ]; then
- /usr/bin/logger -p auth.debug "Restoring console permissions for $DEVNAME"
+ debug_mesg () {
+ test "$udev_log" = "" -o "$udev_log" = "no" && return
+ mesg "$@"
+ }
+
+ if [ -f /etc/udev/udev.conf ]; then
+ . /etc/udev/udev.conf
fi
- exec /sbin/pam_console_setowner $DEVNAME
+
+ SYMLINKS=""
+ for i in $(/usr/bin/udevinfo -q symlink -p "$DEVPATH"); do
+ [ $? -gt 0 ] && break
+ SYMLINKS="$SYMLINKS ${udev_root%%/}/$i"
+ done
+ debug_mesg "Restoring console permissions for $DEVNAME $SYMLINKS"
+ /sbin/pam_console_setowner "$DEVNAME" $SYMLINKS
fi