Bugzilla – Attachment 72575 Details for
Bug 157055
no resmgr permissions for scanners after update
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
IDP Log In
|
Forgot Password
the content of the RPM post-install script regarding this bug
update-resmgr-scanner-permissions (text/plain), 3.81 KB, created by
Johannes Meixner
on 2006-03-13 15:10:05 UTC
(
hide
)
Description:
the content of the RPM post-install script regarding this bug
Filename:
MIME Type:
Creator:
Johannes Meixner
Created:
2006-03-13 15:10:05 UTC
Size:
3.81 KB
patch
obsolete
>#! /bin/bash >set -x ># try to update resmgr permissions for scanners ># in particular for an update from 10.0 to 10.1 (see Suse Bugzilla bug #157055) ># but do not depend on any hal stuff because SANE can work without HAL: ># exit silently if any new HAL config file(s) for resmgr already exists: >ls /etc/hal/fdi/policy/10osvendor/*-scanner.fdi &>/dev/null && exit 0 ># the HAL fdi file triggers resmgr only during booting or when the scanner is plugged into USB ># to get resmgr permissions without reboot or without the need to re-plug the scanner ># resmgr is called directly (see Suse Bugzilla bug #153705): ># determine the connected USB scanners and exit silently if not possible >test -x /usr/bin/sane-find-scanner || exit 0 ># set up a time-bomb background process to avoid that sane-find-scanner may not return >( sleep 3 ; killall -9 sane-find-scanner &>/dev/null ) & ># only USB scaners are found because an output line must contain 'libusb': >SCANNERS="$( /usr/bin/sane-find-scanner -q \ > | sed -n -e 's/^.*vendor=0x\([0-9A-Fa-f]*\).*product=0x\([0-9A-Fa-f]*\).*libusb:\([0-9]*:[0-9]*\)/\1,\2;\3/p' )" ># try to do the resmgr calls and exit silently if not possible: >test -x /sbin/resmgr || exit 0 >for SCANNER in $( echo "$SCANNERS" ) >do # make fallback IDS for the HAL fdi file (used below): > ID="${SCANNER%%;*}" > IDS="$IDS $ID" > # get the USB devices for the resmgr call: > DEVICE="${SCANNER##*;}" > BUSNUMBER="${DEVICE%%:*}" > DEVICENUMBER="${DEVICE##*:}" > if test -n "$BUSNUMBER" -a -n "$DEVICENUMBER" > then # call resmgr: > /sbin/resmgr add /dev/bus/usb/$BUSNUMBER/$DEVICENUMBER scanner usb > fi >done ># try to set up the HAL fdi file and exit silently if it fails ># (do not pre-require any hal package because SANE can work without it): >mkdir -p -m u=rwx,g=rx,o=rx /etc/hal/fdi/policy/10osvendor || exit 0 >OUT="/etc/hal/fdi/policy/10osvendor/80-scanner.fdi" >cat /dev/null >$OUT || exit 0 >chmod u=rw,g=r,o=r $OUT || exit 0 ># write the header with a comment how to make entries manually: >echo '<?xml version="1.0" encoding="ISO-8859-1"?>' >>$OUT >echo '<deviceinfo version="0.2">' >>$OUT >echo ' <device>' >>$OUT >echo '' >>$OUT >echo '<!-- To grant access to USB scanners create entries like:' >>$OUT >echo ' <match key="info.category" string="usbraw">' >>$OUT >echo ' <match key="@info.parent:usb_device.vendor_id" int="0x1a2b">' >>$OUT >echo ' <match key="@info.parent:usb_device.product_id" int="0x3c4d">' >>$OUT >echo ' <merge key="resmgr.class" type="string">scanner</merge>' >>$OUT >echo ' </match>' >>$OUT >echo ' </match>' >>$OUT >echo ' </match>' >>$OUT >echo '"1a2b" and "3c4d" stand for the USB device IDs' >>$OUT >echo 'as displayed by the command /usr/sbin/lsusb -->' >>$OUT >echo '' >>$OUT ># if an old resmgr config file(s) exist (e.g.from 10.0), extract the USB IDs from there ># otherwise use the fallback IDS from the connected scanners (made above): >if ls /etc/resmgr.conf.d/*-scanner.conf &>/dev/null >then IDS="$( cat /etc/resmgr.conf.d/*-scanner.conf \ > | sed -n -e 's/^add usb:vendor=0x\([0-9A-Fa-f]*\),product=0x\([0-9A-Fa-f]*\) scanner$/\1,\2/p' )" >fi >for ID in $( echo "$IDS" ) >do VENDOR="${ID%%,*}" > PRODUCT="${ID##*,}" > if test -n "$VENDOR" -a -n "$PRODUCT" > then # write an entry: > echo ' <match key="info.category" string="usbraw">' >>$OUT > echo " <match key=\"@info.parent:usb_device.vendor_id\" int=\"0x$VENDOR\">" >>$OUT > echo " <match key=\"@info.parent:usb_device.product_id\" int=\"0x$PRODUCT\">" >>$OUT > echo ' <merge key="resmgr.class" type="string">scanner</merge>' >>$OUT > echo ' </match>' >>$OUT > echo ' </match>' >>$OUT > echo ' </match>' >>$OUT > echo '' >>$OUT > fi >done ># write the footer: >echo ' </device>' >>$OUT >echo '</deviceinfo>' >>$OUT ># exit successfully in any case: >exit 0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
Attachments on
bug 157055
: 72575