diff options
author | Till Kamppeter <tkamppeter@mandriva.com> | 2001-08-11 01:44:26 +0000 |
---|---|---|
committer | Till Kamppeter <tkamppeter@mandriva.com> | 2001-08-11 01:44:26 +0000 |
commit | 3e2814af22221ae54b8c20d8237fce5865af0d24 (patch) | |
tree | 511c860a6842ba4e32ccf9a986616f581672fc54 /perl-install/printer.pm | |
parent | 24a468a5410a2987c580b9359927ad9203c0614b (diff) | |
download | drakx-backup-do-not-use-3e2814af22221ae54b8c20d8237fce5865af0d24.tar drakx-backup-do-not-use-3e2814af22221ae54b8c20d8237fce5865af0d24.tar.gz drakx-backup-do-not-use-3e2814af22221ae54b8c20d8237fce5865af0d24.tar.bz2 drakx-backup-do-not-use-3e2814af22221ae54b8c20d8237fce5865af0d24.tar.xz drakx-backup-do-not-use-3e2814af22221ae54b8c20d8237fce5865af0d24.zip |
Restructuring continued and debugged
Diffstat (limited to 'perl-install/printer.pm')
-rw-r--r-- | perl-install/printer.pm | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/perl-install/printer.pm b/perl-install/printer.pm index 7425885a9..208fd55b6 100644 --- a/perl-install/printer.pm +++ b/perl-install/printer.pm @@ -51,11 +51,21 @@ sub spooler { return @spooler_inv{qw(cups lpd lprng pdq)}; } sub printer_type($) { - for ($_[0]{SPOOLER}) { - /cups/ && return @printer_type_inv{qw(LOCAL CUPS LPD SOCKET SMB), $::expert ? qw(URI) : ()}; - /lpd/ && return @printer_type_inv{qw(LOCAL LPD SOCKET SMB NCP), $::expert ? qw(POSTPIPE URI) : ()}; - /lprng/ && return @printer_type_inv{qw(LOCAL LPD SOCKET SMB NCP), $::expert ? qw(POSTPIPE URI) : ()}; - /pdq/ && return @printer_type_inv{qw(LOCAL LPD SOCKET), $::expert ? qw(URI) : ()}; + my ($printer) = @_; + for ($printer->{SPOOLER}) { + # In the case of CUPS as spooler only present the "Remote CUPS + # server" option when one adds a new printer, not when one modifies + # an already configured one. + /cups/ && return @printer_type_inv{qw(LOCAL), + $printer->{configured}{$printer->{OLD_QUEUE}} ? + () : qw(CUPS), qw(LPD SOCKET SMB), + $::expert ? qw(URI) : ()}; + /lpd/ && return @printer_type_inv{qw(LOCAL LPD SOCKET SMB NCP), + $::expert ? qw(POSTPIPE URI) : ()}; + /lprng/ && return @printer_type_inv{qw(LOCAL LPD SOCKET SMB NCP), + $::expert ? qw(POSTPIPE URI) : ()}; + /pdq/ && return @printer_type_inv{qw(LOCAL LPD SOCKET), + $::expert ? qw(URI) : ()}; } } @@ -292,9 +302,11 @@ sub read_printer_db(;$) { } } } + close DBPATH; #- Load CUPS driver database if CUPS is used as spooler if (($spooler) && ($spooler eq "cups") && ($::expert)) { + #&$install('cups-drivers') unless $::testing; #my $w; #if ($in) { @@ -309,6 +321,7 @@ sub read_printer_db(;$) { #%descr_to_help = map { $printer::thedb{$_}{DESCR}, $printer::thedb{$_}{ABOUT} } @entries_db_short; #@entry_db_description = keys %descr_to_db; #db_to_descr = reverse %descr_to_db; + } sub read_foomatic_options ($) { @@ -588,10 +601,15 @@ sub configure_queue($) { my ($printer) = @_; if ($printer->{currentqueue}{foomatic}) { - #- Create the queue with "foomatic-configure" + #- Create the queue with "foomatic-configure", in case of queue + #- renaming copy the old queue run_program::rooted($prefix, "foomatic-configure", "-s", $printer->{SPOOLER}, "-n", $printer->{currentqueue}{'queue'}, + (($printer->{currentqueue}{'queue'} ne + $printer->{OLD_QUEUE}) && + ($printer->{configured}{$printer->{OLD_QUEUE}}) ? + ("-C", $printer->{OLD_QUEUE}) : ()), "-c", $printer->{currentqueue}{'connect'}, "-p", $printer->{currentqueue}{'id'}, "-d", $printer->{currentqueue}{'driver'}, @@ -615,6 +633,15 @@ sub configure_queue($) { ("-L", $printer->{currentqueue}{'loc'}) : (), @{$printer->{OPTIONS}} ) or die "lpadmin failed"; + # Copy the old queue's PPD file to the new queue when it is renamed, + # to conserve the option settings + if (($printer->{currentqueue}{'queue'} ne + $printer->{OLD_QUEUE}) && + ($printer->{configured}{$printer->{OLD_QUEUE}})) { + run_program::rooted($prefix, "cp", "-f", + "/etc/cups/ppd/$printer->{OLD_QUEUE}.ppd", + "/etc/cups/ppd/$printer->{currentqueue}{'queue'}.ppd"); + } } my $useUSB = 0; |