On 08/31/2016 10:38 AM, fsmithred wrote: > On 08/31/2016 07:17 AM, fsmithred wrote:
>> On 08/31/2016 05:03 AM, Ralph Ronnquist wrote:
>>> Ralph Ronnquist wrote on 31/08/16 15:54:
>>>> Ralph Ronnquist wrote on 31/08/16 10:21:
>>>>>
>>>>>
>>>>> fsmithred wrote on 31/08/16 07:54:
>>>>>> ...
>>>>>> I got it to work. Here's the action file and the helper script. The
>>>>>> helper
>>>>>> script is a modified permissions.sh. I added a test for $VDEV_MAJOR and
>>>>>> $VDEV_MINOR to trigger setfacl. Scanner now works on my installation.
>>>>>> ...
>>>>>
>>>>> Great. I'll roll it into the package.
>>>>
>>>> On looking at this, I saw the action file was rather different from
>>>> other action files, and (as I'm slowly picking on this up) I'd like to
>>>> check with you whether the following action file might do the work:
>>>>
>>>> /etc/vdev/actions/scanner.act
>>>> [vdev-action]
>>>> event=add
>>>> path=^bus/usb/*/[001-999]
>>>> OS_SUBSYSTEM=usb
>>>> VAR_PERMISSIONS_OWNER=root
>>>> VAR_PERMISSIONS_GROUP=scanner
>>>> VAR_PERMISSIONS_MODE=0664
>>>> helper=permissions.sh
>>>> daemonlet=true
>>>>
>>>> Afaict, the acls should follow the file permissions and you shouldn't
>>>> need to set those.
>>>>
>>>> Ralph.
>>>
>>> oops, I seem to have lost the "OS_TYPE=255/255/255" line. Probably important.
>>>
>>> Ralph.
>>
>>
>> That didn't work, even with the OS_TYPE=255/255/255. The file permissions
>> get set, but not the acl. I played with some variations, and the following
>> works, but only if I add the lines for setfacl to permissions.sh. (i.e.
>> test for major and minor number then run setfacl)
>>
>> /etc/vdev/actions/scanner.act
>> [vdev-action]
>> event=add
>> path=^bus/usb/*/[001-999]
>> OS_SUBSYSTEM=usb
>> OS_TYPE=255/255/255
>> VAR_PERMISSIONS_OWNER=root
>> VAR_PERMISSIONS_GROUP=scanner
>> VAR_PERMISSIONS_MODE=0664
>> helper=permissions.sh
>> if_exists=run
>>
>>
>> One other problem with all the ways I've tried is that if I unplug the
>> scanner and plug it in again, the acl does not get set. A reboot is
>> required for that.
>>
>> -fsr
>>
>>
>
> Our discussion in irc was productive. The following works with the stock
> permissions.sh (without the lines for setfacl). The acl does not get set,
> but the scanner works. And if I unplug and re-plug the usb cable, the
> scanner gets the next device number, and it works!
>
> cat /etc/vdev/actions/scanner.act
>
> [vdev-action]
> event=add
> path=^bus/usb/*/[001-999]
> OS_SUBSYSTEM=usb
> OS_TYPE=255/255/255
> VAR_PERMISSIONS_OWNER=root
> VAR_PERMISSIONS_GROUP=scanner
> VAR_PERMISSIONS_MODE=0664
> helper=permissions.sh
> if_exists=run
> daemonlet=true
>
> -fsr
>
>
It now works on a live-usb, too. :)
(note: this is a multi-boot usb, which might possibly act differently from
a dd'd isohybrid.)