This commit is contained in:
parent
31b9d5cd59
commit
4fbb935106
@ -1,84 +0,0 @@
|
||||
#! /bin/bash
|
||||
#
|
||||
# Johannes Meixner <jsmeix@suse.de>, 2004, 2005, 2006
|
||||
|
||||
#set -x
|
||||
|
||||
export PATH="/sbin:/usr/sbin:/usr/bin:/bin"
|
||||
export LC_ALL="POSIX"
|
||||
export LANG="POSIX"
|
||||
umask 022
|
||||
|
||||
MY_NAME=${0##*/}
|
||||
|
||||
# Input:
|
||||
|
||||
# Create temporary files:
|
||||
TMP_DATA=$(mktemp -u /tmp/$MY_NAME.XXXXXX)
|
||||
TMP_DATA_UNIQUE=$(mktemp -u /tmp/$MY_NAME.XXXXXX)
|
||||
cat /dev/null >$TMP_DATA
|
||||
|
||||
# Function to extract USB entries from a description file with SANE syntax.
|
||||
Extract()
|
||||
{ grep -o '^[[:space:]]*:usbid[[:space:]]*"0x[0-9A-Fa-f]*"[[:space:]]*"0x[0-9A-Fa-f]*"' $1 | tr '[:upper:]' '[:lower:]' | sed -e 's/^[^"]*"\([^"]*\)"[[:space:]]*"\([^"]*\)"/\1 \2/'
|
||||
}
|
||||
|
||||
# Process the SANE description files:
|
||||
# At least the SANE description files must exist:
|
||||
DESCRIPTION_FILES="/usr/share/sane/descriptions/*.desc"
|
||||
ls $DESCRIPTION_FILES &>/dev/null || { echo "Error: Required SANE description files $DESCRIPTION_FILES not found." 1>&2 ; exit 3 ; }
|
||||
# Extract USB entries from SANE description files:
|
||||
for DESCRIPTION_FILE in $DESCRIPTION_FILES
|
||||
do Extract $DESCRIPTION_FILE
|
||||
done >>$TMP_DATA
|
||||
# Extract USB entries from optional SANE external description files:
|
||||
# In particular:
|
||||
# /usr/share/sane/descriptions-external/hpaio.desc when package hplip is installed
|
||||
# /usr/share/sane/descriptions-external/hpoj.desc when package hp-officeJet is installed
|
||||
# /usr/share/sane/descriptions-external/epkowa.desc when package iscan or iscan-free is installed
|
||||
DESCRIPTION_FILES="/usr/share/sane/descriptions-external/*.desc"
|
||||
for DESCRIPTION_FILE in $DESCRIPTION_FILES
|
||||
do Extract $DESCRIPTION_FILE
|
||||
done >>$TMP_DATA
|
||||
|
||||
# Remove duplicates:
|
||||
sort -u $TMP_DATA >$TMP_DATA_UNIQUE && mv -f $TMP_DATA_UNIQUE $TMP_DATA
|
||||
|
||||
# Output:
|
||||
|
||||
# Output header:
|
||||
echo '<?xml version="1.0" encoding="ISO-8859-1"?>'
|
||||
echo '<deviceinfo version="0.2">'
|
||||
echo ' <device>'
|
||||
echo
|
||||
|
||||
# Output generic SCSI scanner entry for those SCSI scanners which show up with scsi.type = scanner:
|
||||
echo ' <match key="info.category" string="scsi_generic">'
|
||||
echo ' <match key="@info.parent:scsi.type" string="scanner">'
|
||||
echo ' <append key="info.capabilities" type="strlist">scanner</append>'
|
||||
echo ' </match>'
|
||||
echo ' </match>'
|
||||
echo
|
||||
|
||||
# Output model specific USB scanner entries:
|
||||
exec <$TMP_DATA
|
||||
while read VENDOR PRODUCT
|
||||
do echo ' <match key="info.bus" string="usb_device">'
|
||||
echo " <match key=\"usb_device.vendor_id\" int=\"$VENDOR\">"
|
||||
echo " <match key=\"usb_device.product_id\" int=\"$PRODUCT\">"
|
||||
echo ' <append key="info.capabilities" type="strlist">scanner</append>'
|
||||
echo ' </match>'
|
||||
echo ' </match>'
|
||||
echo ' </match>'
|
||||
echo
|
||||
done
|
||||
|
||||
# Output footer:
|
||||
echo ' </device>'
|
||||
echo '</deviceinfo>'
|
||||
|
||||
# Remove the temporary file
|
||||
rm $TMP_DATA
|
||||
|
||||
exit 0
|
||||
|
61
create_hal_global_fdi_from_libsane.rules
Normal file
61
create_hal_global_fdi_from_libsane.rules
Normal file
@ -0,0 +1,61 @@
|
||||
#! /bin/bash
|
||||
#
|
||||
# Johannes Meixner <jsmeix@suse.de>, 2004, 2005, 2006
|
||||
|
||||
#set -x
|
||||
|
||||
export PATH="/sbin:/usr/sbin:/usr/bin:/bin"
|
||||
export LC_ALL="POSIX"
|
||||
export LANG="POSIX"
|
||||
umask 022
|
||||
|
||||
MY_NAME=${0##*/}
|
||||
|
||||
# Input:
|
||||
|
||||
# Create temporary files:
|
||||
TMP_DATA=$(mktemp -u /tmp/$MY_NAME.XXXXXX)
|
||||
|
||||
# Extract USB entries from the libsane.rules file:
|
||||
test -n "$1" && RULES_FILE="$1" || RULES_FILE="libsane.rules"
|
||||
ls $RULES_FILE &>/dev/null || { echo "$MY_NAME error: Required libsane.rules file $RULRS_FILE not found." 1>&2 ; exit 3 ; }
|
||||
sed -n -e 's/^SYSFS{idVendor}=="\([^"]*\)", SYSFS{idProduct}=="\([^"]*\)",.*/\1 \2/p' $RULES_FILE | tr '[:upper:]' '[:lower:]' | sort -u >$TMP_DATA
|
||||
|
||||
# Output:
|
||||
|
||||
# Output header:
|
||||
echo '<?xml version="1.0" encoding="ISO-8859-1"?>'
|
||||
echo '<deviceinfo version="0.2">'
|
||||
echo ' <device>'
|
||||
echo
|
||||
|
||||
# Output generic SCSI scanner entry for those SCSI scanners which show up with scsi.type = scanner:
|
||||
echo ' <match key="info.category" string="scsi_generic">'
|
||||
echo ' <match key="@info.parent:scsi.type" string="scanner">'
|
||||
echo ' <append key="info.capabilities" type="strlist">scanner</append>'
|
||||
echo ' </match>'
|
||||
echo ' </match>'
|
||||
echo
|
||||
|
||||
# Output model specific USB scanner entries:
|
||||
exec <$TMP_DATA
|
||||
while read VENDOR PRODUCT
|
||||
do echo ' <match key="info.bus" string="usb_device">'
|
||||
echo " <match key=\"usb_device.vendor_id\" int=\"0x$VENDOR\">"
|
||||
echo " <match key=\"usb_device.product_id\" int=\"0x$PRODUCT\">"
|
||||
echo ' <append key="info.capabilities" type="strlist">scanner</append>'
|
||||
echo ' </match>'
|
||||
echo ' </match>'
|
||||
echo ' </match>'
|
||||
echo
|
||||
done
|
||||
|
||||
# Output footer:
|
||||
echo ' </device>'
|
||||
echo '</deviceinfo>'
|
||||
|
||||
# Remove the temporary file
|
||||
rm $TMP_DATA
|
||||
|
||||
exit 0
|
||||
|
@ -1,3 +1,11 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Aug 14 16:07:08 CEST 2007 - jsmeix@suse.de
|
||||
|
||||
- Replaced create_hal_global_fdi_for_scanners by
|
||||
create_hal_global_fdi_from_libsane.rules which creates the
|
||||
global HAL 70-scanner.fdi file during build-time from the
|
||||
libsane.rules file (see Novell/Suse Bugzilla bug 298878).
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Aug 10 14:48:13 CEST 2007 - jsmeix@suse.de
|
||||
|
||||
|
@ -17,7 +17,7 @@ Group: Hardware/Scanner
|
||||
Autoreqprov: on
|
||||
Summary: SANE (Scanner Access Now Easy) scanner drivers
|
||||
Version: 1.0.18
|
||||
Release: 57
|
||||
Release: 61
|
||||
URL: http://www.sane-project.org/
|
||||
# URL for Source0: http://alioth.debian.org/download.php/1669/sane-backends-1.0.18.tar.gz
|
||||
Source0: sane-backends-%{version}.tar.bz2
|
||||
@ -49,10 +49,12 @@ Source104: hpaio.desc
|
||||
# This file is a copy of doc/epkowa.desc in the sources of the iscan package
|
||||
# but for compliance with the rest the manufacturer name is changed from "EPSON" to "Epson":
|
||||
Source105: epkowa.desc
|
||||
# Script which outputs a global HAL fdi file for scanners which are known to SANE:
|
||||
Source106: create_hal_global_fdi_for_scanners
|
||||
# Since openSUSE 10.3 "Source106: create_hal_global_fdi_for_scanners" is dropped because
|
||||
# it is replaced by "Source108: create_hal_global_fdi_from_libsane.rules".
|
||||
# Readymade udev rules for openSUSE 10.3 derived from sane-backends 1.0.18-cvs:
|
||||
Source107: libsane.rules.CVS-2007-07-29.using-lp
|
||||
# Script which outputs a global HAL fdi file for scanners which are known to SANE:
|
||||
Source108: create_hal_global_fdi_from_libsane.rules
|
||||
# Patch1 does locale rename: no -> nb:
|
||||
Patch1: sane-backends-1.0.16-nb.patch
|
||||
# Patch2 fixes a too small char array which causes a buffer overflow if SANE_DEBUG_EPSON is set:
|
||||
@ -288,14 +290,16 @@ sed -i -e '/:model "SnapScan 1236u"/,/:firmware "required"/s/required//' %{build
|
||||
# because we use our udev/HAL/hal-resmgr machinery to grant USB access for normal users:
|
||||
install -m644 tools/hotplug/libsane.usermap %{buildroot}%{_datadir}/sane/
|
||||
install -m755 tools/hotplug/libusbscanner %{buildroot}%{_datadir}/sane/
|
||||
# Install the script which outputs a global HAL fdi file for scanners which are known to SANE.
|
||||
# Calling it as postinstall script should obsolete /etc/init.d/sane-dev.
|
||||
install -m755 %{SOURCE106} %{buildroot}%{_datadir}/sane/
|
||||
# Have sane-dev still available in case of backward compatibility problems:
|
||||
install -m755 %{SOURCE100} %{buildroot}%{_datadir}/sane/
|
||||
# Install the readymade udev rules for openSUSE 10.3:
|
||||
install -d %{buildroot}%{_sysconfdir}/udev/rules.d
|
||||
install -m644 %{SOURCE107} %{buildroot}%{_sysconfdir}/udev/rules.d/55-libsane.rules
|
||||
# Run the script which outputs a global HAL fdi file for scanners which are known to SANE
|
||||
# and install its output as /etc/hal/fdi/policy/10osvendor/70-scanner.fdi:
|
||||
%{SOURCE108} %{SOURCE107} >70-scanner.fdi
|
||||
install -d %{buildroot}%{_sysconfdir}/hal/fdi/policy/10osvendor
|
||||
install -m644 70-scanner.fdi %{buildroot}%{_sysconfdir}/hal/fdi/policy/10osvendor/70-scanner.fdi
|
||||
# xinetd stuff:
|
||||
install -d -m755 %{buildroot}%{_sysconfdir}/xinetd.d/
|
||||
install -m644 %{SOURCE101} %{buildroot}%{_sysconfdir}/xinetd.d/
|
||||
@ -305,14 +309,6 @@ install -m644 %{SOURCE102} %{buildroot}%{_sysconfdir}/slp.reg.d
|
||||
|
||||
%post
|
||||
/sbin/ldconfig
|
||||
# Run the script which outputs a global HAL fdi file for scanners which are known to SANE
|
||||
# so that resmgr permissions for most scanner models are predefined out-of-the box.
|
||||
# (Over)Write the predefined entries to /etc/hal/fdi/policy/10osvendor/70-scanner.fdi
|
||||
# so that /etc/hal/fdi/policy/10osvendor/80-scanner.fdi is unchanged (in case of an update)
|
||||
# and 80-scanner.fdi is still available for special additional entries
|
||||
# (e.g. when YaST creates 80-scanner.fdi for models which are not in 70-scanner.fdi):
|
||||
mkdir -p -m755 /etc/hal/fdi/policy/10osvendor
|
||||
/usr/share/sane/create_hal_global_fdi_for_scanners >/etc/hal/fdi/policy/10osvendor/70-scanner.fdi
|
||||
# exit successfully in any case:
|
||||
exit 0
|
||||
|
||||
@ -327,7 +323,12 @@ exit 0
|
||||
%config(noreplace) %{_sysconfdir}/xinetd.d/sane-port
|
||||
%dir %{_sysconfdir}/udev
|
||||
%dir %{_sysconfdir}/udev/rules.d
|
||||
%config %{_sysconfdir}/udev/rules.d/55-libsane.rules
|
||||
%{_sysconfdir}/udev/rules.d/55-libsane.rules
|
||||
%dir %{_sysconfdir}/hal
|
||||
%dir %{_sysconfdir}/hal/fdi
|
||||
%dir %{_sysconfdir}/hal/fdi/policy
|
||||
%dir %{_sysconfdir}/hal/fdi/policy/10osvendor
|
||||
%{_sysconfdir}/hal/fdi/policy/10osvendor/70-scanner.fdi
|
||||
%{_sbindir}/saned
|
||||
%{_bindir}/scanimage
|
||||
%{_bindir}/sane-config
|
||||
@ -349,6 +350,11 @@ exit 0
|
||||
%doc %{_mandir}/man8/saned.8.gz
|
||||
|
||||
%changelog
|
||||
* Tue Aug 14 2007 - jsmeix@suse.de
|
||||
- Replaced create_hal_global_fdi_for_scanners by
|
||||
create_hal_global_fdi_from_libsane.rules which creates the
|
||||
global HAL 70-scanner.fdi file during build-time from the
|
||||
libsane.rules file (see Novell/Suse Bugzilla bug 298878).
|
||||
* Fri Aug 10 2007 - jsmeix@suse.de
|
||||
- Removed hpoj.desc completely to avoid confusion with its
|
||||
successor hpaio.desc because since openSUSE 10.3 the package
|
||||
|
Loading…
Reference in New Issue
Block a user