Hello community,
here is the log from the commit of package yast2-scanner
checked in at Tue Oct 31 15:54:49 CET 2006.
--------
--- yast2-scanner/yast2-scanner.changes 2006-09-11 15:24:18.000000000 +0200
+++ /mounts/work_src_done/NOARCH/yast2-scanner/yast2-scanner.changes 2006-10-31 15:47:23.000000000 +0100
@@ -1,0 +2,13 @@
+Tue Oct 31 15:14:14 CET 2006 - jsmeix@suse.de
+
+- V 2.14.4
+- Replaced complicated SetUsbScannerAccessPermissions()
+ and SetScsiScannerAccessPermissions() functions by a simpler
+ test_and_set_scanner_access_permissions script and call this
+ script from a simple SetScannerAccessPermissions() function
+ (for background info see Suse Bugzilla bug 160899).
+- Added user information regarding outdated hpoj driver.
+- Fixed possible tmp races in some scripts (only $TMP_DATA
+ was created using mktemp but not $TMP_DATA.raw).
+
+-------------------------------------------------------------------
Old:
----
yast2-scanner-2.14.3.tar.bz2
New:
----
yast2-scanner-2.14.4.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-scanner.spec ++++++
--- /var/tmp/diff_new_pack.cjgJzK/_old 2006-10-31 15:54:39.000000000 +0100
+++ /var/tmp/diff_new_pack.cjgJzK/_new 2006-10-31 15:54:39.000000000 +0100
@@ -1,5 +1,5 @@
#
-# spec file for package yast2-scanner (Version 2.14.3)
+# spec file for package yast2-scanner (Version 2.14.4)
#
# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
@@ -11,12 +11,12 @@
# norootforbuild
Name: yast2-scanner
-Version: 2.14.3
+Version: 2.14.4
Release: 1
-License: GPL
+License: GNU General Public License (GPL) - all versions
Group: System/YaST
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-Source0: yast2-scanner-2.14.3.tar.bz2
+Source0: yast2-scanner-2.14.4.tar.bz2
prefix: /usr
BuildRequires: docbook-xsl-stylesheets doxygen libxslt perl-XML-Writer sgml-skel update-desktop-files yast2 yast2-devtools yast2-testsuite
Requires: yast2
@@ -41,7 +41,7 @@
Johannes Meixner
%prep
-%setup -n yast2-scanner-2.14.3
+%setup -n yast2-scanner-2.14.4
%build
%{prefix}/bin/y2tool y2autoconf
@@ -75,6 +75,16 @@
%doc %{prefix}/share/doc/packages/yast2-scanner
%changelog -n yast2-scanner
+* Tue Oct 31 2006 - jsmeix@suse.de
+- V 2.14.4
+- Replaced complicated SetUsbScannerAccessPermissions()
+ and SetScsiScannerAccessPermissions() functions by a simpler
+ test_and_set_scanner_access_permissions script and call this
+ script from a simple SetScannerAccessPermissions() function
+ (for background info see Suse Bugzilla bug 160899).
+- Added user information regarding outdated hpoj driver.
+- Fixed possible tmp races in some scripts (only $TMP_DATA
+ was created using mktemp but not $TMP_DATA.raw).
* Mon Sep 11 2006 - jsmeix@suse.de
- V 2.14.3
- Disable showing Progress from SuSEFirewall::Read call and
++++++ yast2-scanner-2.14.3.tar.bz2 -> yast2-scanner-2.14.4.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-scanner-2.14.3/VERSION new/yast2-scanner-2.14.4/VERSION
--- old/yast2-scanner-2.14.3/VERSION 2006-09-11 15:19:51.000000000 +0200
+++ new/yast2-scanner-2.14.4/VERSION 2006-10-31 15:14:08.000000000 +0100
@@ -1 +1 @@
-2.14.3
+2.14.4
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-scanner-2.14.3/configure new/yast2-scanner-2.14.4/configure
--- old/yast2-scanner-2.14.3/configure 2006-09-11 15:20:01.000000000 +0200
+++ new/yast2-scanner-2.14.4/configure 2006-10-31 15:39:51.000000000 +0100
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for yast2-scanner 2.14.3.
+# Generated by GNU Autoconf 2.59 for yast2-scanner 2.14.4.
#
# Report bugs to http://bugs.opensuse.org/.
#
@@ -269,8 +269,8 @@
# Identity of this package.
PACKAGE_NAME='yast2-scanner'
PACKAGE_TARNAME='yast2-scanner'
-PACKAGE_VERSION='2.14.3'
-PACKAGE_STRING='yast2-scanner 2.14.3'
+PACKAGE_VERSION='2.14.4'
+PACKAGE_STRING='yast2-scanner 2.14.4'
PACKAGE_BUGREPORT='http://bugs.opensuse.org/'
ac_unique_file="RPMNAME"
@@ -728,7 +728,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures yast2-scanner 2.14.3 to adapt to many kinds of systems.
+\`configure' configures yast2-scanner 2.14.4 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -795,7 +795,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of yast2-scanner 2.14.3:";;
+ short | recursive ) echo "Configuration of yast2-scanner 2.14.4:";;
esac
cat <<\_ACEOF
@@ -908,7 +908,7 @@
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
-yast2-scanner configure 2.14.3
+yast2-scanner configure 2.14.4
generated by GNU Autoconf 2.59
Copyright (C) 2003 Free Software Foundation, Inc.
@@ -922,7 +922,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by yast2-scanner $as_me 2.14.3, which was
+It was created by yast2-scanner $as_me 2.14.4, which was
generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@
@@ -1652,7 +1652,7 @@
# Define the identity of the package.
PACKAGE='yast2-scanner'
- VERSION='2.14.3'
+ VERSION='2.14.4'
cat >>confdefs.h <<_ACEOF
@@ -1863,7 +1863,7 @@
-VERSION="2.14.3"
+VERSION="2.14.4"
RPMNAME="yast2-scanner"
MAINTAINER="Johannes Meixner "
@@ -2693,7 +2693,7 @@
} >&5
cat >&5 <<_CSEOF
-This file was extended by yast2-scanner $as_me 2.14.3, which was
+This file was extended by yast2-scanner $as_me 2.14.4, which was
generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -2748,7 +2748,7 @@
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-yast2-scanner config.status 2.14.3
+yast2-scanner config.status 2.14.4
configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-scanner-2.14.3/configure.in new/yast2-scanner-2.14.4/configure.in
--- old/yast2-scanner-2.14.3/configure.in 2006-09-11 15:19:58.000000000 +0200
+++ new/yast2-scanner-2.14.4/configure.in 2006-10-31 15:39:48.000000000 +0100
@@ -3,7 +3,7 @@
dnl -- This file is generated by y2autoconf 2.13.21 - DO NOT EDIT! --
dnl (edit configure.in.in instead)
-AC_INIT(yast2-scanner, 2.14.3, http://bugs.opensuse.org/, yast2-scanner)
+AC_INIT(yast2-scanner, 2.14.4, http://bugs.opensuse.org/, yast2-scanner)
dnl Check for presence of file 'RPMNAME'
AC_CONFIG_SRCDIR([RPMNAME])
@@ -17,7 +17,7 @@
AM_INIT_AUTOMAKE(tar-ustar) dnl searches for some needed programs
dnl Important YaST2 variables
-VERSION="2.14.3"
+VERSION="2.14.4"
RPMNAME="yast2-scanner"
MAINTAINER="Johannes Meixner "
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-scanner-2.14.3/src/Scanner.ycp new/yast2-scanner-2.14.4/src/Scanner.ycp
--- old/yast2-scanner-2.14.3/src/Scanner.ycp 2006-09-11 15:23:58.000000000 +0200
+++ new/yast2-scanner-2.14.4/src/Scanner.ycp 2006-10-31 15:45:06.000000000 +0100
@@ -4,7 +4,7 @@
* Summary: Scanner settings, input and output functions
* Authors: Johannes Meixner
*
- * $Id: Scanner.ycp 32802 2006-09-11 13:25:35Z jsmeix $
+ * $Id: Scanner.ycp 33942 2006-10-31 14:45:01Z jsmeix $
*
* Representation of the configuration of scanner.
* Input and output routines.
@@ -234,6 +234,7 @@
string network_scanning_config_filename = "/var/lib/YaST2/network_scanning_config.ycp";
string determine_network_scanning_config_commandline = "/usr/lib/YaST2/bin/determine_network_scanner_config YCP >" + network_scanning_config_filename;
string setup_network_scanning_config_commandline = "/usr/lib/YaST2/bin/setup_network_scanner_config";
+string test_and_set_scanner_access_permissions_commandline = "/usr/lib/YaST2/bin/test_and_set_scanner_access_permissions";
// The result map is used as a simple common local store for whatever additional results
// (in particular commandline exit code, stdout, stderr, and whatever messages)
// so that the local functions in this module can be of easy-to-use boolean type.
@@ -524,215 +525,26 @@
}
/**
- * Search the autodetected_scanners list for USB scanners
- * and if at least one USB scanner was found,
- * then do the following:
- * 1.
- * Notify resmgr to grant access for locally logged in users via the command:
- * /sbin/resmgr add /dev/bus/usb/<bus-number>/<device-number> scanner usb
- * This would grant resmgr access as long as the system runs
- * and as long as the scanner is not unplugged from the USB and re-plugged
- * without the need to reboot or to unplug the scanner from the USB
- * and re-plug it again which would trigger the udev -> HAL -> resmgr machinery.
- * 2.
- * Create the file /etc/hal/fdi/policy/10osvendor/80-scanner.fdi
- * with an entry for each autodetected USB scanner like
- * -----------------------------------------------------------------------------------
- * <match key="info.category" string="usbraw">
- * <match key="@info.parent:usb.vendor_id" int="0x1a2b">
- * <match key="@info.parent:usb.product_id" int="0x3c4d">
- * <merge key="resmgr.class" type="string">scanner</merge>
- * </match>
- * </match>
- * </match>
- * -----------------------------------------------------------------------------------
- * Regardless whether or not there is an autodetected USB scanner,
- * /etc/hal/fdi/policy/10osvendor/80-scanner.fdi will be (re)-created.
- * If there is no autodetected USB scanner or USB vendor or product ID is missing
- * for all autodetected USB scanners, at least the header, a comment, and the footer
- * is written to have all XML tags there so that at least the comment
- * how to create entries manually is available for the user.
- * Ignore whether or not an autodetected USB scanner appears in the active_scanners list
- * (i.e. simply grant access to all autodetected USB scanners)
- * because on x86_64 "scanimage -L" cannot find scanners using the 32-bit epkowa backend
- * when it comes from the proprietary 32-bit-only "iscan" package for Epson scanners
- * (but it would work if the 64-bit epkowa backend from iscan-free is used)
- * so that in this case the scanner cannot appear in the active_scanners list
- * but "sane-find-scanner" finds (almost all) Epson USB scanners
- * so that the scanner is in the autodetected_scanners list.
+ * Test and set scanner access permissions for USB scanners and SCSI scanners
+ * for resmgr via HAL by calling a bash script which does all the work.
* @return true on success
*/
-boolean SetUsbScannerAccessPermissions()
-{ // First of all the multi-line strings because such strings cannot be indented:
- string content = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>
-
- <device>
-
-<!-- To grant access to USB scanners create entries like:
- <match key=\"info.category\" string=\"usbraw\">
- <match key=\"@info.parent:usb_device.vendor_id\" int=\"0x1a2b\">
- <match key=\"@info.parent:usb_device.product_id\" int=\"0x3c4d\">
- <merge key=\"resmgr.class\" type=\"string\">scanner</merge>
- </match>
- </match>
- </match>
-\"1a2b\" and \"3c4d\" stand for the USB device IDs
-as displayed by the command /usr/sbin/lsusb -->
-";
- string content_entry = "
-
-
-
- scanner</merge>
- </match>
- </match>
- </match>
-";
- string content_footer = "
- </device>
-</deviceinfo>
-";
- string resmgr_scanner_config_dir = "/etc/hal/fdi/policy/10osvendor";
- string resmgr_scanner_config_file = resmgr_scanner_config_dir + "/80-scanner.fdi";
- boolean autodetected_usb_scanner_with_missing_ids = false;
- string usb_vendor_and_product_id = "";
- list< string > usb_vendor_and_product_ids = [];
- SCR::Execute( .target.mkdir, resmgr_scanner_config_dir );
- foreach( map< string, string > autodetected_scanner,
- autodetected_scanners,
- { if( "USB" == autodetected_scanner["connection"]:"unknown" )
- { // This autodetected scanner is a USB scanner.
- // Notify resmgr to grant access for locally logged in users.
- // This would grant resmgr access as long as the system runs
- // and as long as the scanner is not unplugged from the USB and re-plugged
- // without the need to reboot or to unplug the scanner from the USB
- // and re-plug it again which would trigger the udev -> HAL -> resmgr machinery.
- list< string > device_parts = splitstring( autodetected_scanner["device"]:"libusb:000:000", ":" );
- string usb_bus_number = device_parts[1]:"000";
- string usb_device_number = device_parts[2]:"000";
- if( "000" != usb_bus_number
- && "000" != usb_device_number
- )
- { // Don't show a user information if the following command fails
- // because if the user has stopped resmgr, he should know what he does
- // and if resmgr fails to add it, I don't know what I should tell the user
- // except a very long explanation how all the stuff works:
- ExecuteBashCommand( "/sbin/resmgr add /dev/bus/usb/"
- + usb_bus_number
- + "/"
- + usb_device_number
- + " scanner usb"
- );
- }
- // Set up the stuff for HAL so that also after a reboot
- // or when the user unplugs the scanner from the USB and re-plugs it again
- // the udev -> HAL -> resmgr machinery will grant the same kind of access:
- string usb_vendor_id = autodetected_scanner["usb_vendor_id"]:"";
- string usb_product_id = autodetected_scanner["usb_product_id"]:"";
- string description = autodetected_scanner["description"]:"no description";
- if( "" == usb_vendor_id
- || "" == usb_product_id
- )
- { // No USB vendor ID or no USB product ID:
- autodetected_usb_scanner_with_missing_ids = true;
- y2milestone( "No USB vendor ID or no USB product ID for '%1'. Therefore no entry in %2",
- description,
- resmgr_scanner_config_file
- );
- }
- else
- { // USB vendor ID and USB product ID exist:
- usb_vendor_and_product_id = usb_vendor_id + usb_product_id;
- // Avoid duplicate entries in the content (e.g. when several same models are connected):
- if( ! contains( usb_vendor_and_product_ids, usb_vendor_and_product_id ) )
- { // The USB vendor product ID was not yet added to the content
- // i.e. the current scanner is not a second or third same model:
- content = content + sformat( content_entry, usb_vendor_id, usb_product_id );
- usb_vendor_and_product_ids = add( usb_vendor_and_product_ids, usb_vendor_and_product_id );
- }
- }
- }
- }
- );
- // Regardless whether or not there is an autodetected USB scanner,
- // /etc/hal/fdi/policy/10osvendor/80-scanner.fdi will be (re)-created.
- // If there is no content_entry (i.e. there is no autodetected USB scanner
- // or USB vendor or product ID is missing for all autodetected USB scanners),
- // the content_footer is added to have all XML tags closed and then at least
- // the comment how to create entries manually is available for the user:
- content = content + content_footer;
- if( ! (boolean)SCR::Write( .target.string, resmgr_scanner_config_file, content ) )
- { y2milestone( "Failed to (re)-create %1", resmgr_scanner_config_file );
- // Displayed in error dialog of ActivateBackend function:
- result["stderr"] = sformat( // Displayed in an error dialog (%1 is a filename).
- // Only a simple message because this error does not happen on a normal system
- // (i.e. a system which is not totally broken or totally messed up).
- _("Cannot write file %1."),
- resmgr_scanner_config_file
- );
- return false;
- }
- y2milestone( "(Re)-created %1", resmgr_scanner_config_file );
- if( autodetected_usb_scanner_with_missing_ids )
- { // There is at least one autodetected USB scanner with no USB vendor or product ID
- // so that there is no normal user access for this scanner.
- // Displayed in error dialog of ActivateBackend function:
- result["stderr"] = sformat( // Displayed in an error dialog (%1 is a filename).
- // Only a simple message because this error does not happen on a normal system.
- _("Cannot add scanner to %1 (USB vendor or product ID missing)."),
- resmgr_scanner_config_file
- );
- return false;
- }
- return true;
-}
-
-/**
- * Search the active_scanners list for possible SCSI scanners (":/dev/" in SANE device)
- * and if at least one possible SCSI scanner was found,
- * then run /etc/init.d/sane-dev (using "restart" to be safe that outdated permissions are reset)
- * and enable it for reboot ("insserv")
- * otherwise stop it and disable it for reboot ("insserv -r").
- * Note that it must search for ":/dev/" to find only SCSI scanners ("backend:/dev/sg...")
- * because for example the hpaio backend may have also "/dev/" in its device,
- * e.g.: "hpaio:/usb/HP_LaserJet_1220?device=/dev/usb/lp0",
- * this depends on the particular model (e.g. when it doesn't report a serial number).
- * @return true on success
- */
-boolean SetScsiScannerAccessPermissions()
-{ boolean active_scsi_scanner = false;
+boolean SetScannerAccessPermissions()
+{ // Build the command line parameter:
+ string sane_devices = "";
foreach( map< string, string > active_scanner,
active_scanners,
- { if( issubstring( active_scanner["sane_device"]:"", ":/dev/" ) )
- { active_scsi_scanner = true;
- }
+ { sane_devices = sane_devices + active_scanner["sane_device"]:"unknown" + ";";
}
);
- if( active_scsi_scanner )
- { if( ! Service::Enable( "sane-dev" ) )
- { y2milestone( "Service::Enable('sane-dev') failed." );
- result["stderr"] = Service::Error();
- return false;
- }
- if( ! Service::Restart( "sane-dev" ) )
- { y2milestone( "Service::Restart('sane-dev') failed." );
- result["stderr"] = Service::Error();
- return false;
- }
- y2milestone( "Service sane-dev (re)-started and enabled." );
- }
- else
- { if( ! Service::Stop( "sane-dev" ) )
- { y2milestone( "Service::Stop('sane-dev') failed." );
- result["stderr"] = Service::Error();
- return false;
- }
- if( ! Service::Disable( "sane-dev" ) )
- { y2milestone( "Service::Disable('sane-dev') failed." );
- result["stderr"] = Service::Error();
- return false;
- }
- y2milestone( "Service sane-dev stopped and disabled." );
+ // Execute the command line:
+ if( ! ExecuteBashCommand( test_and_set_scanner_access_permissions_commandline
+ + " '"
+ + sane_devices
+ + "'"
+ )
+ )
+ { return false;
}
return true;
}
@@ -1561,12 +1373,17 @@
Alternatively proceed and change the printer configuration to use the hplip service.
");
string hpoj_message =
- // Message of a Popup::YesNo for scanners which should be set up with the hpoj driver
+ // Message of a Popup::ContinueCancel for scanners which should be set up with the hpoj driver
// Do not change or translate "hpoj", it is a driver name.
// Do not change or translate "PTAL", it is a subsystem name.
// Do not change or translate "ptal", it is a service name.
// Do not change or translate "hplip", it is a service name.
-_("The hpoj driver requires the PTAL system to be set up and running.
+_("The hpoj driver is outdated and no longer maintained.
+To use the up-to-date driver hpaio do not proceed, go back and select the driver hpaio.
+
+If the hpaio driver does not work for you and you must use the hpoj driver:
+
+The hpoj driver requires the PTAL system to be set up and running.
In particular, the ptal service must be up and running.
Before the ptal service can be started, the PTAL system must be initialized.
@@ -1760,20 +1577,15 @@
if( "hpoj" == backend_name
&& user_confirmation
)
- { if( ! Popup::YesNo( hpoj_message ) )
+ { if( ! Popup::ContinueCancel( hpoj_message ) )
{ // The user has decided not to initialize/activate/start the PTAL system:
- // Don't abort (i.e. return false) in this case because it is no error
- // when the user has decided not to initialize/activate/start the PTAL system
- // because it may be already up and running or the user may want to set it up manually.
- // Regardless of the state of the PTAL system the backend can be activated in /etc/sane.d/dll.conf
- Report::Warning(
- // Message of a Report::Warning for scanners which should be set up with the hpoj backend.
- // Only a simple message because before there was a Popup::YesNo
- // which asked the user whether he wants to let YaST activate the ptal service
- // so that this message is shown if the user has explicitely rejected to do it.
- // Do not change or translate "ptal", it is a service name.
- _("If the ptal service is not running, the scanner cannot work.")
+ // Usually this is because of the hpoj_message which explains that hpoj is outdated
+ // and that the user should cancel and try hpaio instead.
+ y2milestone( "Set up hpoj SANE backend cancelled by user." );
+ Progress::Title( // Last progress step progress bar title when the Progress was aborted:
+ _("Cancelled")
);
+ return false;
}
else
{ // The user has decided to initialize/activate/start the PTAL system:
@@ -1832,26 +1644,14 @@
}
else
{ Progress::NextStage();
- if( ! SetUsbScannerAccessPermissions()
+ if( ! SetScannerAccessPermissions()
&& user_confirmation
)
- { Report::Warning( sformat( // Message of a Report::Warning when setting USB scanner access permissions failed
+ { Report::Warning( sformat( // Message of a Report::Warning when setting scanner access permissions failed
// where %1 can be replaced by an error message if such an error message exists.
// Only a simple message because this error does not happen on a normal system
// (i.e. a system which is not totally broken or totally messed up).
- _("Failed to set USB scanner access permissions.\n%1"),
- OnlyMeaningfulErrorMessage( result["stderr"]:"" )
- )
- );
- }
- if( ! SetScsiScannerAccessPermissions()
- && user_confirmation
- )
- { Report::Warning( sformat( // Message of a Report::Warning when setting SCSI scanner access permissions failed
- // where %1 can be replaced by an error message if such an error message exists.
- // Only a simple message because this error does not happen on a normal system
- // (i.e. a system which is not totally broken or totally messed up).
- _("Failed to set SCSI scanner access permissions.\n%1"),
+ _("Failed to set scanner access permissions.\n%1"),
OnlyMeaningfulErrorMessage( result["stderr"]:"" )
)
);
@@ -2057,26 +1857,14 @@
{ active_scanners = [];
}
else
- { if( ! SetUsbScannerAccessPermissions()
- && user_confirmation
- )
- { Report::Warning( sformat( // Message of a Report::Warning when setting USB scanner access permissions failed
- // where %1 can be replaced by an error message if such an error message exists.
- // Only a simple message because this error does not happen on a normal system
- // (i.e. a system which is not totally broken or totally messed up).
- _("Failed to set USB scanner access permissions.\n%1"),
- OnlyMeaningfulErrorMessage( result["stderr"]:"" )
- )
- );
- }
- if( ! SetScsiScannerAccessPermissions()
+ { if( ! SetScannerAccessPermissions()
&& user_confirmation
)
- { Report::Warning( sformat( // Message of a Report::Warning when re-setting SCSI scanner access permissions failed
+ { Report::Warning( sformat( // Message of a Report::Warning when setting scanner access permissions failed
// where %1 can be replaced by an error message if such an error message exists.
// Only a simple message because this error does not happen on a normal system
// (i.e. a system which is not totally broken or totally messed up).
- _("Failed to reset SCSI scanner access permissions.\n%1"),
+ _("Failed to set scanner access permissions.\n%1"),
OnlyMeaningfulErrorMessage( result["stderr"]:"" )
)
);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-scanner-2.14.3/tools/Makefile.am new/yast2-scanner-2.14.4/tools/Makefile.am
--- old/yast2-scanner-2.14.3/tools/Makefile.am 2006-08-15 11:24:12.000000000 +0200
+++ new/yast2-scanner-2.14.4/tools/Makefile.am 2006-10-31 14:10:05.000000000 +0100
@@ -11,6 +11,7 @@
setup_ptal_scanner_service \
setup_hplip_scanner_service \
determine_network_scanner_config \
- setup_network_scanner_config
+ setup_network_scanner_config \
+ test_and_set_scanner_access_permissions
EXTRA_DIST = $(ybin_SCRIPTS)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-scanner-2.14.3/tools/Makefile.in new/yast2-scanner-2.14.4/tools/Makefile.in
--- old/yast2-scanner-2.14.3/tools/Makefile.in 2006-09-11 15:20:02.000000000 +0200
+++ new/yast2-scanner-2.14.4/tools/Makefile.in 2006-10-31 15:39:52.000000000 +0100
@@ -168,7 +168,8 @@
setup_ptal_scanner_service \
setup_hplip_scanner_service \
determine_network_scanner_config \
- setup_network_scanner_config
+ setup_network_scanner_config \
+ test_and_set_scanner_access_permissions
EXTRA_DIST = $(ybin_SCRIPTS)
all: all-am
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-scanner-2.14.3/tools/activate_scanner_backend new/yast2-scanner-2.14.4/tools/activate_scanner_backend
--- old/yast2-scanner-2.14.3/tools/activate_scanner_backend 2006-08-15 11:24:12.000000000 +0200
+++ new/yast2-scanner-2.14.4/tools/activate_scanner_backend 2006-10-31 14:16:13.000000000 +0100
@@ -1,6 +1,6 @@
#! /bin/bash
#
-# Johannes Meixner , 2004, 2005
+# Johannes Meixner , 2004, 2005, 2006
#set -x
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-scanner-2.14.3/tools/autodetect_scanners new/yast2-scanner-2.14.4/tools/autodetect_scanners
--- old/yast2-scanner-2.14.3/tools/autodetect_scanners 2006-08-16 14:20:13.000000000 +0200
+++ new/yast2-scanner-2.14.4/tools/autodetect_scanners 2006-10-31 14:16:13.000000000 +0100
@@ -1,6 +1,6 @@
#! /bin/bash
#
-# Johannes Meixner , 2004, 2005
+# Johannes Meixner , 2004, 2005, 2006
#set -x
@@ -16,13 +16,14 @@
# Input:
-# Create a temporary file:
+# Create temporary file names:
TMP_DATA=$(mktemp -u /tmp/$MY_NAME.XXXXXX)
+TMP_DATA_RAW=$(mktemp -u /tmp/$MY_NAME.XXXXXX)
# Get the raw data
MAXIMUM_WAIT="10"
if [ -x /usr/bin/sane-find-scanner ]
-then sane-find-scanner -q >${TMP_DATA}.raw &
+then sane-find-scanner -q >$TMP_DATA_RAW &
sanefindscannerPID=$!
for i in $( seq $MAXIMUM_WAIT )
do ps hp $sanefindscannerPID | grep -q sane-find-scanner || break
@@ -31,12 +32,11 @@
if ps hp $sanefindscannerPID | grep -q sane-find-scanner
then kill -9 $sanefindscannerPID &>/dev/null
fi
-else
- echo "Cannot execute /usr/bin/sane-find-scanner" 1>&2
- exit 2
+else echo "Cannot execute /usr/bin/sane-find-scanner" 1>&2
+ exit 2
fi
# Only USB and SCSI scanners are taken into account:
-cat ${TMP_DATA}.raw | egrep '^found SCSI |^found USB ' | sort -u | sed -e 's/^found //' | tr \" \' >$TMP_DATA && rm ${TMP_DATA}.raw
+egrep '^found SCSI |^found USB ' <$TMP_DATA_RAW | sort -u | sed -e 's/^found //' | tr \" \' >$TMP_DATA
# Output:
@@ -82,7 +82,7 @@
then echo -e " \$[]\n]"
fi
-# Remove the temporary file
-rm $TMP_DATA
+# Remove the temporary files
+rm $TMP_DATA $TMP_DATA_RAW
exit 0
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-scanner-2.14.3/tools/create_scanner_database new/yast2-scanner-2.14.4/tools/create_scanner_database
--- old/yast2-scanner-2.14.3/tools/create_scanner_database 2006-08-16 12:34:22.000000000 +0200
+++ new/yast2-scanner-2.14.4/tools/create_scanner_database 2006-10-31 14:16:13.000000000 +0100
@@ -1,6 +1,6 @@
#! /bin/bash
#
-# Johannes Meixner , 2004, 2005
+# Johannes Meixner , 2004, 2005, 2006
#set -x
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-scanner-2.14.3/tools/deactivate_scanner_backend new/yast2-scanner-2.14.4/tools/deactivate_scanner_backend
--- old/yast2-scanner-2.14.3/tools/deactivate_scanner_backend 2006-08-15 11:24:12.000000000 +0200
+++ new/yast2-scanner-2.14.4/tools/deactivate_scanner_backend 2006-10-31 14:16:13.000000000 +0100
@@ -1,6 +1,6 @@
#! /bin/bash
#
-# Johannes Meixner , 2004, 2005
+# Johannes Meixner , 2004, 2005, 2006
#set -x
export PATH="/sbin:/usr/sbin:/usr/bin:/bin"
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-scanner-2.14.3/tools/determine_active_scanner_backends new/yast2-scanner-2.14.4/tools/determine_active_scanner_backends
--- old/yast2-scanner-2.14.3/tools/determine_active_scanner_backends 2006-08-15 11:24:12.000000000 +0200
+++ new/yast2-scanner-2.14.4/tools/determine_active_scanner_backends 2006-10-31 14:16:13.000000000 +0100
@@ -1,6 +1,6 @@
#! /bin/bash
#
-# Johannes Meixner , 2004, 2005
+# Johannes Meixner , 2004, 2005, 2006
#set -x
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-scanner-2.14.3/tools/determine_active_scanners new/yast2-scanner-2.14.4/tools/determine_active_scanners
--- old/yast2-scanner-2.14.3/tools/determine_active_scanners 2006-08-15 11:24:12.000000000 +0200
+++ new/yast2-scanner-2.14.4/tools/determine_active_scanners 2006-10-31 14:16:13.000000000 +0100
@@ -1,6 +1,6 @@
#! /bin/bash
#
-# Johannes Meixner , 2004, 2005
+# Johannes Meixner , 2004, 2005, 2006
#set -x
@@ -16,13 +16,14 @@
# Input:
-# Create a temporary file:
+# Create temporary file names:
TMP_DATA=$(mktemp -u /tmp/$MY_NAME.XXXXXX)
+TMP_DATA_RAW=$(mktemp -u /tmp/$MY_NAME.XXXXXX)
# Get the raw data
MAXIMUM_WAIT="60"
if [ -x /usr/bin/scanimage ]
-then scanimage -f '%d,%v,%m;' >${TMP_DATA}.raw &
+then scanimage -f '%d,%v,%m;' >$TMP_DATA_RAW &
scanimagePID=$!
for i in $( seq $MAXIMUM_WAIT )
do ps $scanimagePID &>/dev/null || break
@@ -35,7 +36,7 @@
echo "Cannot execute /usr/bin/scanimage" 1>&2
exit 2
fi
-tr ';' '\n' <${TMP_DATA}.raw | sort -u >$TMP_DATA && rm ${TMP_DATA}.raw
+tr ';' '\n' <$TMP_DATA_RAW | sort -u >$TMP_DATA
# Output:
@@ -63,7 +64,7 @@
then echo -e " \$[]\n]"
fi
-# Remove the temporary file
-rm $TMP_DATA
+# Remove the temporary files:
+rm $TMP_DATA $TMP_DATA_RAW
exit 0
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-scanner-2.14.3/tools/determine_network_scanner_config new/yast2-scanner-2.14.4/tools/determine_network_scanner_config
--- old/yast2-scanner-2.14.3/tools/determine_network_scanner_config 2006-08-15 11:24:12.000000000 +0200
+++ new/yast2-scanner-2.14.4/tools/determine_network_scanner_config 2006-10-31 14:16:13.000000000 +0100
@@ -1,6 +1,6 @@
#! /bin/bash
#
-# Johannes Meixner , 2004, 2005
+# Johannes Meixner , 2004, 2005, 2006
#set -x
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-scanner-2.14.3/tools/setup_hplip_scanner_service new/yast2-scanner-2.14.4/tools/setup_hplip_scanner_service
--- old/yast2-scanner-2.14.3/tools/setup_hplip_scanner_service 2006-08-15 11:24:12.000000000 +0200
+++ new/yast2-scanner-2.14.4/tools/setup_hplip_scanner_service 2006-10-31 14:16:13.000000000 +0100
@@ -1,6 +1,6 @@
#! /bin/bash
#
-# Johannes Meixner , 2004, 2005
+# Johannes Meixner , 2004, 2005, 2006
#set -x
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-scanner-2.14.3/tools/setup_network_scanner_config new/yast2-scanner-2.14.4/tools/setup_network_scanner_config
--- old/yast2-scanner-2.14.3/tools/setup_network_scanner_config 2006-08-15 11:24:12.000000000 +0200
+++ new/yast2-scanner-2.14.4/tools/setup_network_scanner_config 2006-10-31 14:16:13.000000000 +0100
@@ -1,6 +1,6 @@
#! /bin/bash
#
-# Johannes Meixner , 2004, 2005
+# Johannes Meixner , 2004, 2005, 2006
#set -x
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-scanner-2.14.3/tools/setup_ptal_scanner_service new/yast2-scanner-2.14.4/tools/setup_ptal_scanner_service
--- old/yast2-scanner-2.14.3/tools/setup_ptal_scanner_service 2006-08-15 11:24:12.000000000 +0200
+++ new/yast2-scanner-2.14.4/tools/setup_ptal_scanner_service 2006-10-31 14:16:13.000000000 +0100
@@ -1,6 +1,6 @@
#! /bin/bash
#
-# Johannes Meixner , 2004, 2005
+# Johannes Meixner , 2004, 2005, 2006
#set -x
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-scanner-2.14.3/tools/test_and_set_scanner_access_permissions new/yast2-scanner-2.14.4/tools/test_and_set_scanner_access_permissions
--- old/yast2-scanner-2.14.3/tools/test_and_set_scanner_access_permissions 1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-scanner-2.14.4/tools/test_and_set_scanner_access_permissions 2006-10-31 15:37:51.000000000 +0100
@@ -0,0 +1,123 @@
+#! /bin/bash
+#
+# Johannes Meixner , 2004, 2005, 2006
+
+#set -x
+
+export PATH="/sbin:/usr/sbin:/usr/bin:/bin"
+export LC_ALL="POSIX"
+export LANG="POSIX"
+umask 022
+
+# When the package "sane" is installed, this file is created
+# which lists all known USB scanners:
+HAL_GLOBAL_FILE="/etc/hal/fdi/policy/10osvendor/70-scanner.fdi"
+# This file is written by this script for those scanners
+# which are not listed in HAL_GLOBAL_FILE:
+HAL_LOCAL_FILE="/etc/hal/fdi/policy/10osvendor/80-scanner.fdi"
+
+# Create temporary file names:
+MY_NAME=${0##*/}
+TMP_DATA=$(mktemp -u /tmp/$MY_NAME.XXXXXX)
+TMP_DATA_RAW=$(mktemp -u /tmp/$MY_NAME.XXXXXX)
+
+# Get the raw data (i.e. the SANE devices for the active scanners).
+# Either it is specified as command line parameter $1
+# (this is how YaST calls it to avoid duplicate time-consuming "scanimage" calls
+# because it knows the SANE devices from its determine_active_scanners call)
+# or (if $1 is empty) then run "scanimage" to determine the SANE devices:
+if [ -n "$1" ]
+then echo "$1" >$TMP_DATA_RAW
+else MAXIMUM_WAIT="60"
+ if [ -x /usr/bin/scanimage ]
+ then scanimage -f '%d;' >$TMP_DATA_RAW &
+ scanimagePID=$!
+ for i in $( seq $MAXIMUM_WAIT )
+ do ps $scanimagePID &>/dev/null || break
+ sleep 1
+ done
+ if ps $scanimagePID &>/dev/null
+ then kill -9 $scanimagePID &>/dev/null
+ fi
+ else echo "Cannot execute /usr/bin/scanimage" 1>&2
+ exit 2
+ fi
+fi
+# Split it into seperated lines, remove the SANE backend name, and remove duplicates
+# (duplicates happen when different SANE backends are active for the same scanner):
+tr ';' '\n' <$TMP_DATA_RAW | cut -d ':' -s -f 2- | sort -u >$TMP_DATA
+# TMP_DATA should contain lines with plain device infos for scanners like
+# libusb:001:002
+# libusb:004:005
+# /dev/sg0
+# /dev/sg2
+# A detailed syntax check is not done here because it happens later,
+# see "Test for USB and SCSI scanners and ignore anything else" below.
+
+# Write header to HAL_LOCAL_FILE
+# and exit silently if this fails for whatever reason
+# (e.g. no hal package installed):
+cat /dev/null >$HAL_LOCAL_FILE || exit 0
+echo '<?xml version="1.0" encoding="ISO-8859-1"?>' >>$HAL_LOCAL_FILE
+echo '<deviceinfo version="0.2">' >>$HAL_LOCAL_FILE
+echo ' <device>' >>$HAL_LOCAL_FILE
+echo '' >>$HAL_LOCAL_FILE
+echo '<!-- To grant access to USB scanners create entries like:' >>$HAL_LOCAL_FILE
+echo ' <match key="info.category" string="usbraw">' >>$HAL_LOCAL_FILE
+echo ' <match key="@info.parent:usb_device.vendor_id" int="0x1a2b">' >>$HAL_LOCAL_FILE
+echo ' <match key="@info.parent:usb_device.product_id" int="0x3c4d">' >>$HAL_LOCAL_FILE
+echo ' <append key="info.capabilities" type="strlist">scanner</append>' >>$HAL_LOCAL_FILE
+echo ' </match>' >>$HAL_LOCAL_FILE
+echo ' </match>' >>$HAL_LOCAL_FILE
+echo ' </match>' >>$HAL_LOCAL_FILE
+echo '"1a2b" and "3c4d" stand for the USB device IDs' >>$HAL_LOCAL_FILE
+echo 'as displayed by the command /usr/sbin/lsusb -->' >>$HAL_LOCAL_FILE
+echo '' >>$HAL_LOCAL_FILE
+
+# Test and set scanner access permissions:
+exec <$TMP_DATA
+while read LINE
+do # Test for USB and SCSI scanners and ignore anything else:
+ if echo $LINE | grep -q '^libusb:[0-9][0-9]*:[0-9][0-9]*$'
+ then # It is a USB scanner:
+ # Determine the USB vendor and product IDs:
+ BUS_DEVICE=$( echo $LINE | cut -d ':' -s -f 2- )
+ VENDOR_PRODUCT=$( lsusb -s $BUS_DEVICE | grep -o 'ID [0-9A-Fa-f]*:[0-9A-Fa-f]*' | cut -b 4- )
+ VENDOR=$( echo $VENDOR_PRODUCT | cut -d ':' -s -f 1 )
+ PRODUCT=$( echo $VENDOR_PRODUCT | cut -d ':' -s -f 2 )
+ # Test if this scanner is not already listed in the global HAL file:
+ if ! grep -i -A 1 "usb_device.vendor_id\" int=\"0x$VENDOR\"" $HAL_GLOBAL_FILE | grep -q -i "usb_device.product_id\" int=\"0x$PRODUCT\""
+ then # Write an entry to the local HAL file:
+ echo ' <match key="info.category" string="usbraw">' >>$HAL_LOCAL_FILE
+ echo " " >>$HAL_LOCAL_FILE
+ echo " " >>$HAL_LOCAL_FILE
+ echo ' <append key="info.capabilities" type="strlist">scanner</append>' >>$HAL_LOCAL_FILE
+ echo ' </match>' >>$HAL_LOCAL_FILE
+ echo ' </match>' >>$HAL_LOCAL_FILE
+ echo ' </match>' >>$HAL_LOCAL_FILE
+ echo '' >>$HAL_LOCAL_FILE
+ fi
+ fi
+ if echo $LINE | grep -q '^/dev/sg[0-9][0-9]*$'
+ then # It is a SCSI scanner:
+ # Test if this scanner does not show up as "scanner" but as "processor":
+ if ! lsscsi -g | grep $LINE | grep -i 'scanner'
+ then # Write an entry to the local HAL file:
+ echo ' <match key="info.category" string="scsi_generic">' >>$HAL_LOCAL_FILE
+ echo ' <match key="@info.parent:scsi.type" string="processor">' >>$HAL_LOCAL_FILE
+ echo ' <append key="info.capabilities" type="strlist">scanner</append>' >>$HAL_LOCAL_FILE
+ echo ' </match>' >>$HAL_LOCAL_FILE
+ echo ' </match>' >>$HAL_LOCAL_FILE
+ echo '' >>$HAL_LOCAL_FILE
+ fi
+ fi
+done
+
+# Write footer to HAL_LOCAL_FILE:
+echo ' </device>' >>$HAL_LOCAL_FILE
+echo '</deviceinfo>' >>$HAL_LOCAL_FILE
+
+# Remove the temporary files:
+rm $TMP_DATA $TMP_DATA_RAW
+exit 0
+
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-scanner-2.14.3/tools/test_scanner_backend new/yast2-scanner-2.14.4/tools/test_scanner_backend
--- old/yast2-scanner-2.14.3/tools/test_scanner_backend 2006-08-15 11:45:36.000000000 +0200
+++ new/yast2-scanner-2.14.4/tools/test_scanner_backend 2006-10-31 14:16:13.000000000 +0100
@@ -1,6 +1,6 @@
#! /bin/bash
#
-# Johannes Meixner , 2004, 2005
+# Johannes Meixner , 2004, 2005, 2006
#set -x
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org