linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: martin f krafft <madduck@madduck.net>
To: linux-hotplug@vger.kernel.org
Subject: Re: feature request (if possible): symlink name in environment
Date: Tue, 21 Dec 2004 15:38:44 +0000	[thread overview]
Message-ID: <20041221153844.GA16095@cirrus.madduck.net> (raw)
In-Reply-To: <20041221150258.GB14897@cirrus.madduck.net>


[-- Attachment #1.1: Type: text/plain, Size: 922 bytes --]

also sprach Kay Sievers <kay.sievers@vrfy.org> [2004.12.21.1611 +0100]:
> Use udevinfo in the dev.d/ script and ask with the DEVPATH for the
> symlinks:
> 
>   [kay@pim ~]$ udevinfo -r -q symlink -p /class/video4linux/video0
>   /dev/camera0 /dev/kamera0 /dev/videocam0 /dev/webcam0 

Awesome. I hacked together the attached file. However, it does not
seem to be working. The logs indicate that everything goes by plan,
but the permissions are not changed.

Am I thus to assume that the hooks run before the rules.d
permissions are applied?

-- 
martin;              (greetings from the heart of the sun.)
  \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck
 
invalid/expired pgp subkeys? use subkeys.pgp.net as keyserver!
spamtraps: madduck.bogus@madduck.net
 
"die philosophie ist eine art rache an der wirklichkeit."
                                                 - friedrich nietzsche

[-- Attachment #1.2: permissions.dev --]
[-- Type: text/plain, Size: 724 bytes --]

#!/bin/bash -e

[[ $ACTION = add ]] || exit 0

UDEV_CONF=/etc/udev/udev.conf
[[ -f $UDEV_CONF ]] && . $UDEV_CONF
[[ -z $udev_permissions ]] && udev_permissions=/etc/udev/permissions.d

REFS="$DEVNAME $(udevinfo -r -q symlink -p $DEVPATH)"
logger -t $0 -p daemon.debug -- "checking references for $DEVNAME for permission
s: $REFS"
for node in $REFS; do
  [[ ! -b $node ]] && [[ ! -c $node ]] && [[ ! -L $node ]] && continue
  name=${node#/dev/}
  perms=$(grep -h "^$name" $udev_permissions/*.permissions | tail -1)
  set -- $(echo ${perms//:/ })
  [[ -z $2 ]] && continue
  logger -t $0 -p daemon.debug -- "applying permissions $2:$3:$4 to $DEVNAME (due to reference '$1')..."
  chgrp $2:$3 $DEVNAME
  chmod $4 $DEVNAME
done

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  parent reply	other threads:[~2004-12-21 15:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-21 15:02 feature request (if possible): symlink name in environment martin f krafft
2004-12-21 15:11 ` Kay Sievers
2004-12-21 15:38 ` martin f krafft [this message]
2004-12-21 16:04 ` Greg KH
2004-12-21 16:08 ` martin f krafft
2004-12-21 17:36 ` Kay Sievers
2004-12-21 17:48 ` martin f krafft

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041221153844.GA16095@cirrus.madduck.net \
    --to=madduck@madduck.net \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).