summaryrefslogtreecommitdiffstats
path: root/perl-install/scanner.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/scanner.pm')
-rw-r--r--perl-install/scanner.pm48
1 files changed, 12 insertions, 36 deletions
diff --git a/perl-install/scanner.pm b/perl-install/scanner.pm
index f57c7001c..777f7192f 100644
--- a/perl-install/scanner.pm
+++ b/perl-install/scanner.pm
@@ -1,5 +1,4 @@
package scanner;
-# scanner.pm $Id: scanner.pm 257130 2009-04-28 13:10:22Z tv $
# Yves Duret <yduret at mandriva.com>
# Till Kamppeter <till at mandriva.com>
# Copyright (C) 2001-2008 Mandriva
@@ -35,7 +34,7 @@ our $scannerDB = readScannerDB("$scannerDBdir/ScannerDB");
sub confScanner {
my ($model, $port, $vendor, $product, $firmware) = @_;
- $port ||= "$::prefix/dev/scanner";
+ $port ||= "/dev/scanner";
my $a = $scannerDB->{$model}{server};
#print "file:[$a]\t[$model]\t[$port]\n| ", (join "\n| ", @{$scannerDB->{$model}{lines}}),"\n";
my @driverconf = cat_("$sanedir/$a.conf");
@@ -178,9 +177,9 @@ sub nonroot_access_for_parport {
# Desired state of this facility: 1: Enable, 0: Disable
my ($enable, $in) = @_;
# Is saned running?
- my $sanedrunning = services::starts_on_boot("saned");
+ my $sanedrunning = services::starts_on_boot("saned.socket");
# Is the "net" SANE backend active
- my $netbackendactive = grep { /^\s*net\s*$/ }
+ my $netbackendactive = find { /^\s*net\s*$/ }
cat_("/etc/sane.d/dll.conf");
# Set this to 1 to tell the caller that the list of locally available
# scanners has changed (Here if the SANE client configuration has
@@ -192,11 +191,9 @@ sub nonroot_access_for_parport {
# Install/start saned
if (!$sanedrunning) {
- # Make sure saned and xinetd is installed and
- # running
- if (!files_exist('/usr/sbin/xinetd',
- '/usr/sbin/saned')) {
- if (!$in->do_pkgs->install('xinetd', 'saned')) {
+ # Make sure saned is installed and running
+ if (!files_exist('/usr/sbin/saned')) {
+ if (!$in->do_pkgs->install('saned')) {
$in->ask_warn(N("Scannerdrake"),
N("Could not install the packages needed to share your scanner(s).") . " " .
N("Your scanner(s) will not be available for non-root users."));
@@ -205,12 +202,6 @@ sub nonroot_access_for_parport {
}
}
- # Modify /etc/xinetd.d/saned to let saned run as root
- my @sanedxinetdconf = cat_("/etc/xinetd.d/saned");
- s/(user\s*=\s*).*$/$1root/ foreach @sanedxinetdconf;
- s/(group\s*=\s*).*$/$1root/ foreach @sanedxinetdconf;
- output("/etc/xinetd.d/saned", @sanedxinetdconf);
-
# Read list of hosts to where to export the local scanners
my @exports = cat_("/etc/sane.d/saned.conf");
# Read list of hosts from where to import scanners
@@ -231,22 +222,7 @@ sub nonroot_access_for_parport {
# (Re)start saned and make sure that it gets started on
# every boot
- services::start_service_on_boot("saned");
- services::start_service_on_boot("xinetd");
- services::restart("xinetd");
-
- } else {
- # Disable non-root access
-
- if (-r "/etc/xinetd.d/saned") {
- # Modify /etc/xinetd.d/saned to let saned run as saned
- my @sanedxinetdconf = cat_("/etc/xinetd.d/saned");
- s/(user\s*=\s*).*$/$1saned/ foreach @sanedxinetdconf;
- s/(group\s*=\s*).*$/$1saned/ foreach @sanedxinetdconf;
- output("/etc/xinetd.d/saned", @sanedxinetdconf);
- # Restart xinetd
- services::restart("xinetd") if $sanedrunning;
- }
+ services::enable("saned.socket");
}
return 1;
@@ -279,13 +255,13 @@ sub detect {
$productid = $3;
}
if ($vendorid && $productid) {
- my ($vendor) = ($vendorid =~ /0x([0-9a-f]+)/);
- my ($id) = ($productid =~ /0x([0-9a-f]+)/);
+ my ($vendor) = $vendorid =~ /0x([0-9a-f]+)/;
+ my ($id) = $productid =~ /0x([0-9a-f]+)/;
my ($device) = grep { sprintf("%04x", $_->{vendor}) eq $vendor && sprintf("%04x", $_->{id}) eq $id } @devices;
if ($device) {
$driver = $device->{driver};
- $real_device = $device
+ $real_device = $device;
} else {
#warn "Failed to lookup $vendorid and $productid!\n";
}
@@ -567,10 +543,10 @@ sub updateScannerDBfromSane {
next if $f =~ /unsupported.desc$/;
# Treat unsupported.desc in the end
$f = "$sanesrcdir/doc/descriptions/unsupported.desc" if
- ($f eq "UNSUPPORTED");
+ $f eq "UNSUPPORTED";
my $F = common::openFileMaybeCompressed($f);
$to_add .= "\n# from $f";
- my ($lineno, $cmd, $val) = 0;
+ my ($lineno, $cmd, $val);
my ($name, $intf, $comment, $mfg, $backend);
my $fs = {
backend => sub { $backend = $val },