* Re: feature request (if possible): symlink name in environment
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
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Kay Sievers @ 2004-12-21 15:11 UTC (permalink / raw)
To: linux-hotplug
On Tue, 2004-12-21 at 16:02 +0100, martin f krafft wrote:
> I am not sure this is possible, but if it is...
>
> Would you consider making the name of any symlinks to be added to
> a device available in the environment (e.g. a :-separated list in
> $SYMLINKS), when the /dev/dev.d hooks are called?
>
> This would allow me to write a hook for permissions.d, making it
> optional and still supporting all it should be able to do.
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
Kay
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: feature request (if possible): symlink name in environment
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
2004-12-21 16:04 ` Greg KH
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: martin f krafft @ 2004-12-21 15:38 UTC (permalink / raw)
To: linux-hotplug
[-- 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 --]
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: feature request (if possible): symlink name in environment
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
@ 2004-12-21 16:04 ` Greg KH
2004-12-21 16:08 ` martin f krafft
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Greg KH @ 2004-12-21 16:04 UTC (permalink / raw)
To: linux-hotplug
On Tue, Dec 21, 2004 at 04:38:44PM +0100, martin f krafft wrote:
> 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?
No, the hook should run after.
greg k-h
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: feature request (if possible): symlink name in environment
2004-12-21 15:02 feature request (if possible): symlink name in environment martin f krafft
` (2 preceding siblings ...)
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
5 siblings, 0 replies; 7+ messages in thread
From: martin f krafft @ 2004-12-21 16:08 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1: Type: text/plain, Size: 1011 bytes --]
also sprach Greg KH <greg@kroah.com> [2004.12.21.1704 +0100]:
> No, the hook should run after.
This is what I gathered from the code as well. However, it does not
appear to work.
Would you consider trying it out? Maybe I am just on crack...
Drop it into /etc/dev.d/default/permissions.dev with 755
permissions.
Create a file in permissions.d, the way it used to be.
See if the permissions are applied (symlinks should be followed, and
the last symlink shown by
udevinfo -r -q symlink -p $DEVPATH
has the highest priority.
Thanks,
--
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
"i like wagner's music better than anybody's. it is so loud that one
can talk the whole time without other people hearing what one says."
-- oscar wilde
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: feature request (if possible): symlink name in environment
2004-12-21 15:02 feature request (if possible): symlink name in environment martin f krafft
` (3 preceding siblings ...)
2004-12-21 16:08 ` martin f krafft
@ 2004-12-21 17:36 ` Kay Sievers
2004-12-21 17:48 ` martin f krafft
5 siblings, 0 replies; 7+ messages in thread
From: Kay Sievers @ 2004-12-21 17:36 UTC (permalink / raw)
To: linux-hotplug
On Tue, 2004-12-21 at 17:08 +0100, martin f krafft wrote:
> also sprach Greg KH <greg@kroah.com> [2004.12.21.1704 +0100]:
> > No, the hook should run after.
>
> This is what I gathered from the code as well. However, it does not
> appear to work.
>
> Would you consider trying it out? Maybe I am just on crack...
>
> Drop it into /etc/dev.d/default/permissions.dev with 755
> permissions.
>
> Create a file in permissions.d, the way it used to be.
>
> See if the permissions are applied (symlinks should be followed, and
> the last symlink shown by
>
> udevinfo -r -q symlink -p $DEVPATH
>
> has the highest priority.
Any other scripts running after that, which change may it back?
And
name=${node#/dev/}
perms=$(grep -h "^$name" $udev_permissions/*.permissions | tail -1)
will not return the "name*:..." line for a device named "name0" what it
should, right?
Kay
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: feature request (if possible): symlink name in environment
2004-12-21 15:02 feature request (if possible): symlink name in environment martin f krafft
` (4 preceding siblings ...)
2004-12-21 17:36 ` Kay Sievers
@ 2004-12-21 17:48 ` martin f krafft
5 siblings, 0 replies; 7+ messages in thread
From: martin f krafft @ 2004-12-21 17:48 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1: Type: text/plain, Size: 1125 bytes --]
also sprach Kay Sievers <kay.sievers@vrfy.org> [2004.12.21.1836 +0100]:
> Any other scripts running after that, which change may it back?
Not that I know. Maybe permissions.d itself is getting int the way,
but the problem persists if I clean out everything else from
permissions.d. Apart, those should (have) be(en) applied before the
dev.d hooks, right?
> And
> name=${node#/dev/}
> perms=$(grep -h "^$name" $udev_permissions/*.permissions | tail -1)
>
> will not return the "name*:..." line for a device named "name0" what it
> should, right?
Good spot. The final colon ':' should be part of the regexp:
> perms=$(grep -h "^${name}:" $udev_permissions/*.permissions | tail -1)
Does it work for anyone yet?
--
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
"common sense is the collection of prejudices
acquired by age eighteen."
-- albert einstein
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread