summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorTill Kamppeter <tkamppeter@mandriva.com>2004-08-25 15:40:45 +0000
committerTill Kamppeter <tkamppeter@mandriva.com>2004-08-25 15:40:45 +0000
commit6e888e8de1d951f0aecedca5d3a0d17c54635b1a (patch)
tree5d304b77430f2a0febb29eec6891abacdab95343 /perl-install
parent54ecd6f2b1d6ad3543d6d208e0967cf5556c1a21 (diff)
downloaddrakx-backup-do-not-use-6e888e8de1d951f0aecedca5d3a0d17c54635b1a.tar
drakx-backup-do-not-use-6e888e8de1d951f0aecedca5d3a0d17c54635b1a.tar.gz
drakx-backup-do-not-use-6e888e8de1d951f0aecedca5d3a0d17c54635b1a.tar.bz2
drakx-backup-do-not-use-6e888e8de1d951f0aecedca5d3a0d17c54635b1a.tar.xz
drakx-backup-do-not-use-6e888e8de1d951f0aecedca5d3a0d17c54635b1a.zip
- Moved initial package installation by printerdrake into "install_spooler()" function, so all package installation done by printerdrake (except printer/queue-type-specific, as HPOJ) is done in one step.
- First changes for daemonless CUPS client support.
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/printer/data.pm51
-rw-r--r--perl-install/printer/printerdrake.pm58
2 files changed, 65 insertions, 44 deletions
diff --git a/perl-install/printer/data.pm b/perl-install/printer/data.pm
index 4a64ead75..25cacbe26 100644
--- a/perl-install/printer/data.pm
+++ b/perl-install/printer/data.pm
@@ -6,35 +6,55 @@ use vars qw(@ISA @EXPORT);
@ISA = qw(Exporter);
@EXPORT = qw(%spoolers %spooler_inv %shortspooler_inv
- $kernelversion $usbprintermodule);
+ $kernelversion $usbprintermodule
+ $commonpackages $localqueuepackages);
+# Kernel-specific data
our $kernelversion = `uname -r 2>/dev/null`;
$kernelversion =~ s/^(\s*)(\d+\.\d+)(\..*)$/$2/;
chomp $kernelversion;
our $usbprintermodule = ($kernelversion eq '2.6' ? "usblp" : "printer");
+# Packages which are always needed to run printerdrake
+our $commonpackages = [ [ 'foomatic-db-engine' ],
+ [ '/usr/bin/foomatic-configure' ] ];
+
+# Packages which are needed to create and manage local print queues
+our $localqueuepackages = [ [ 'foomatic-filters', 'foomatic-db',
+ 'printer-utils', 'printer-testpages', 'nmap',
+ 'scli' ],
+ [qw(/usr/bin/foomatic-rip
+ /usr/share/foomatic/db/source/driver/ljet4.xml
+ /usr/bin/escputil
+ /usr/share/printer-testpages/testprint.ps
+ /usr/bin/nmap
+ /usr/bin/scli)] ];
+
+# Spooler-specific data
our %spoolers = ('pdq' => {
'help' => "/usr/bin/pdq -h -P %s 2>&1 |",
'print_command' => 'lpr-pdq',
'print_gui' => 'xpdq',
'long_name' => N("PDQ - Print, Don't Queue"),
'short_name' => N("PDQ"),
+ 'local_queues' => 1,
'packages2add' => [ [ 'pdq' ], [qw(/usr/bin/pdq /usr/X11R6/bin/xpdq)] ],
'alternatives' => [
[ 'lpr', '/usr/bin/lpr-pdq' ],
[ 'lpq', '/usr/bin/lpq-foomatic' ],
[ 'lprm', '/usr/bin/lprm-foomatic' ]
],
- },
- 'lpd' => {
+ },
+ 'lpd' => {
'print_command' => 'lpr-lpd',
'print_gui' => 'gpr',
'long_name' => N("LPD - Line Printer Daemon"),
'short_name' => N("LPD"),
'boot_spooler' => 'lpd',
'service' => 'lpd',
+ 'local_queues' => 1,
'packages2add' => [ [qw(lpr net-tools gpr a2ps ImageMagick)],
[qw(/usr/sbin/lpf
/usr/sbin/lpd
@@ -49,7 +69,7 @@ our %spoolers = ('pdq' => {
[ 'lprm', '/usr/bin/lprm-lpd' ],
[ 'lpc', '/usr/sbin/lpc-lpd' ]
]
- },
+ },
'lprng' => {
'print_command' => 'lpr-lpd',
'print_gui' => 'gpr',
@@ -57,6 +77,7 @@ our %spoolers = ('pdq' => {
'short_name' => N("LPRng"),
'boot_spooler' => 'lpd',
'service' => 'lpd',
+ 'local_queues' => 1,
'packages2add' => [ [qw(LPRng net-tools gpr a2ps ImageMagick)],
[qw(/usr/lib/filters/lpf
/usr/sbin/lpd
@@ -74,7 +95,7 @@ our %spoolers = ('pdq' => {
[ 'lpstat', '/usr/bin/lpstat-lpd' ],
[ 'lpc', '/usr/sbin/lpc-lpd' ]
]
- },
+ },
'cups' => {
'help' => "/usr/bin/lphelp %s |",
'print_command' => 'lpr-cups',
@@ -83,6 +104,7 @@ our %spoolers = ('pdq' => {
'short_name' => N("CUPS"),
'boot_spooler' => 'cups',
'service' => 'cups',
+ 'local_queues' => 1,
'packages2add' => [ ['cups', 'net-tools', 'xpp', 'cups-drivers',
$::isInstall ? 'curl' : 'webfetch'],
[ qw(/usr/lib/cups/cgi-bin/printers.cgi
@@ -102,6 +124,25 @@ our %spoolers = ('pdq' => {
[ 'lpstat', '/usr/bin/lpstat-cups' ],
[ 'lpc', '/usr/sbin/lpc-cups' ]
]
+ },
+ 'rcups' => {
+ 'help' => "/usr/bin/lphelp %s |",
+ 'print_command' => 'lpr-cups',
+ 'print_gui' => 'xpp',
+ 'long_name' => N("CUPS - Common Unix Printing System (remote server)"),
+ 'short_name' => N("RemoteCUPS"),
+ 'local_queues' => 0,
+ 'packages2add' => [ ['cups-common'],
+ ['/usr/bin/lpr-cups'] ],
+ 'alternatives' => [
+ [ 'lpr', '/usr/bin/lpr-cups' ],
+ [ 'lpq', '/usr/bin/lpq-cups' ],
+ [ 'lprm', '/usr/bin/lprm-cups' ],
+ [ 'lp', '/usr/bin/lp-cups' ],
+ [ 'cancel', '/usr/bin/cancel-cups' ],
+ [ 'lpstat', '/usr/bin/lpstat-cups' ],
+ [ 'lpc', '/usr/sbin/lpc-cups' ]
+ ]
}
);
our %spooler_inv = map { $spoolers{$_}{long_name} => $_ } keys %spoolers;
diff --git a/perl-install/printer/printerdrake.pm b/perl-install/printer/printerdrake.pm
index 4a5a6bf19..fdf562ddc 100644
--- a/perl-install/printer/printerdrake.pm
+++ b/perl-install/printer/printerdrake.pm
@@ -3719,7 +3719,8 @@ sub install_spooler {
# If the user refuses to install the spooler in high or paranoid
# security level, exit.
return 0 unless security_check($printer, $in, $spooler);
- return 1 if $spooler !~ /^(cups|lpd|lprng|pqd)$/; # should not happen
+ # should not happen
+ return 1 if $spooler !~ /^(rcups|cups|lpd|lprng|pqd)$/;
my $w = $in->wait_message(N("Printerdrake"), N("Checking installed software..."));
# "lpr" conflicts with "LPRng", remove either "LPRng" or remove "lpr"
@@ -3736,8 +3737,17 @@ sub install_spooler {
};
}
+ # Install all packages needed to run printerdrake and the chosen spooler
$packages = $spoolers{$spooler}{packages2add};
- if ($packages && !files_exist(@{$packages->[1]})) {
+ push (@{$packages->[0]}, @{$commonpackages->[0]});
+ push (@{$packages->[0]}, @{$localqueuepackages->[0]}) if
+ $spoolers{$spooler}{local_queues};
+ push (@{$packages->[1]}, @{$commonpackages->[1]});
+ push (@{$packages->[1]}, @{$localqueuepackages->[1]}) if
+ $spoolers{$spooler}{local_queues};
+ #use Data::Dumper;
+ #print Dumper($packages);
+ if (@{$packages->[0]} && !files_exist(@{$packages->[1]})) {
undef $w;
$w = $in->wait_message(N("Printerdrake"), N("Installing %s..."), $spoolers{$spooler}{short_name});
$in->do_pkgs->install(@{$packages->[0]})
@@ -3827,7 +3837,8 @@ sub setup_default_spooler {
$printer->{SPOOLER} = $oldspooler;
return;
}
- if ($printer->{SPOOLER} ne $oldspooler) {
+ if (($printer->{SPOOLER} ne $oldspooler) &&
+ ($printer->{SPOOLER} ne 'rcups')) {
# Get the queues of this spooler
{
my $_w = $in->wait_message(N("Printerdrake"),
@@ -3961,42 +3972,11 @@ sub init {
# of Printerdrake
printer::main::set_usermode($printer->{expert});
- # printerdrake does not work without foomatic, and for more
- # convenience we install some more stuff
- {
- my $_w = $::noX ||
- $in->wait_message(N("Printerdrake"),
- N("Checking installed software..."));
- if (!$::testing &&
- !files_exist(qw(/usr/bin/foomatic-configure
- /usr/bin/foomatic-rip
- /usr/share/foomatic/db/source/driver/ljet4.xml
- /usr/bin/escputil
- /usr/share/printer-testpages/testprint.ps
- /usr/bin/nmap
- /usr/bin/scli
- ))) {
- # Do not try to install packages when installing print queues
- # in the background, simply do not install queues
- exit 0 if $::noX;
- $in->do_pkgs->install('foomatic-db-engine', 'foomatic-filters',
- 'foomatic-db', 'printer-utils',
- 'printer-testpages', 'nmap', 'scli')
- or do {
- $in->ask_warn(N("Error"),
- N("Could not install necessary packages, %s cannot be started!",
- "printerdrake"));
- exit 1;
- };
- }
-
- # only experts should be asked for the spooler also for background
- # installation of print it should not be asked for the spooler,
- # as this feature is only supported for CUPS.
- $printer->{SPOOLER} ||= 'cups'
- if !$printer->{expert} || $::noX;
-
- }
+ # only experts should be asked for the spooler also for background
+ # installation of print it should not be asked for the spooler,
+ # as this feature is only supported for CUPS.
+ $printer->{SPOOLER} ||= 'cups'
+ if !$printer->{expert} || $::noX;
# If we have chosen a spooler, install it and mark it as default
# spooler. Spooler installation is ommitted on background queue