From 5048eb000b43e5d0692e5fbc3112600ff3011bfa Mon Sep 17 00:00:00 2001 From: Till Kamppeter Date: Fri, 13 Sep 2002 21:21:23 +0000 Subject: Do not insist on "curl" to download PPDs from a CUPS server (for Star Office/OpenOffice.org/GIMP), take the one from "curl" and "wget" which is there. Install "webfetch" when none is there. Let "cups-drivers" be installed when switching from normal to expert mode. --- perl-install/printer.pm | 83 ++++++++++++++++++++++++++++++++------------ perl-install/printerdrake.pm | 22 +++++++----- 2 files changed, 74 insertions(+), 31 deletions(-) diff --git a/perl-install/printer.pm b/perl-install/printer.pm index ccb42a65e..80a1073c8 100644 --- a/perl-install/printer.pm +++ b/perl-install/printer.pm @@ -2286,15 +2286,23 @@ sub configurestaroffice { my $configfilecontent = readsofficeconfigfile($configfilename); # Update remote CUPS queues if (0 && ($printer->{SPOOLER} eq "cups") && - (-x "$prefix/usr/bin/curl")) { + ((-x "$prefix/usr/bin/curl") || (-x "$prefix/usr/bin/wget"))) { my @printerlist = getcupsremotequeues(); for my $listentry (@printerlist) { next if !($listentry =~ /^([^\|]+)\|([^\|]+)$/); my $queue = $1; my $server = $2; - eval(run_program::rooted - ($prefix, "curl", "-o", "/etc/foomatic/$queue.ppd", - "http://$server:631/printers/$queue.ppd")); + if (-x "$prefix/usr/bin/wget") { + eval(run_program::rooted + ($prefix, "/usr/bin/wget", "-O", + "/etc/foomatic/$queue.ppd", + "http://$server:631/printers/$queue.ppd")); + } else { + eval(run_program::rooted + ($prefix, "/usr/bin/curl", "-o", + "/etc/foomatic/$queue.ppd", + "http://$server:631/printers/$queue.ppd")); + } if (-r "$prefix/etc/foomatic/$queue.ppd") { $configfilecontent = makestarofficeprinterentry($printer, $queue, @@ -2351,15 +2359,23 @@ sub configureopenoffice { my $configfilecontent = readsofficeconfigfile($configfilename); # Update remote CUPS queues if (0 && ($printer->{SPOOLER} eq "cups") && - (-x "$prefix/usr/bin/curl")) { + ((-x "$prefix/usr/bin/curl") || (-x "$prefix/usr/bin/wget"))) { my @printerlist = getcupsremotequeues(); for my $listentry (@printerlist) { next if !($listentry =~ /^([^\|]+)\|([^\|]+)$/); my $queue = $1; my $server = $2; - eval(run_program::rooted - ($prefix, "curl", "-o", "/etc/foomatic/$queue.ppd", - "http://$server:631/printers/$queue.ppd")); + if (-x "$prefix/usr/bin/wget") { + eval(run_program::rooted + ($prefix, "/usr/bin/wget", "-O", + "/etc/foomatic/$queue.ppd", + "http://$server:631/printers/$queue.ppd")); + } else { + eval(run_program::rooted + ($prefix, "/usr/bin/curl", "-o", + "/etc/foomatic/$queue.ppd", + "http://$server:631/printers/$queue.ppd")); + } if (-r "$prefix/etc/foomatic/$queue.ppd") { $configfilecontent = makeopenofficeprinterentry($printer, $queue, @@ -2416,7 +2432,7 @@ sub addcupsremotetostaroffice { my $configfilecontent = readsofficeconfigfile($configfilename); # Update remote CUPS queues if (($printer->{SPOOLER} eq "cups") && - (-x "$prefix/usr/bin/curl")) { + ((-x "$prefix/usr/bin/curl") || (-x "$prefix/usr/bin/wget"))) { my @printerlist = getcupsremotequeues(); for my $listentry (@printerlist) { next if !($listentry =~ /^([^\|]+)\|([^\|]+)$/); @@ -2425,10 +2441,17 @@ sub addcupsremotetostaroffice { my $server = $2; # Remove server name from queue name $q =~ s/^([^@]*)@.*$/$1/; - eval(run_program::rooted - ($prefix, "/usr/bin/curl", "-o", - "/etc/foomatic/$queue.ppd", - "http://$server:631/printers/$q.ppd")); + if (-x "$prefix/usr/bin/wget") { + eval(run_program::rooted + ($prefix, "/usr/bin/wget", "-O", + "/etc/foomatic/$queue.ppd", + "http://$server:631/printers/$q.ppd")); + } else { + eval(run_program::rooted + ($prefix, "/usr/bin/curl", "-o", + "/etc/foomatic/$queue.ppd", + "http://$server:631/printers/$q.ppd")); + } # Does the file exist and is it not an error message? if ((-r "$prefix/etc/foomatic/$queue.ppd") && (cat_("$prefix/etc/foomatic/$queue.ppd") =~ @@ -2459,7 +2482,7 @@ sub addcupsremotetoopenoffice { my $configfilecontent = readsofficeconfigfile($configfilename); # Update remote CUPS queues if (($printer->{SPOOLER} eq "cups") && - (-x "$prefix/usr/bin/curl")) { + ((-x "$prefix/usr/bin/curl") || (-x "$prefix/usr/bin/wget"))) { my @printerlist = getcupsremotequeues(); for my $listentry (@printerlist) { next if !($listentry =~ /^([^\|]+)\|([^\|]+)$/); @@ -2468,10 +2491,17 @@ sub addcupsremotetoopenoffice { my $server = $2; # Remove server name from queue name $q =~ s/^([^@]*)@.*$/$1/; - eval(run_program::rooted - ($prefix, "/usr/bin/curl", "-o", - "/etc/foomatic/$queue.ppd", - "http://$server:631/printers/$q.ppd")); + if (-x "$prefix/usr/bin/wget") { + eval(run_program::rooted + ($prefix, "/usr/bin/wget", "-O", + "/etc/foomatic/$queue.ppd", + "http://$server:631/printers/$q.ppd")); + } else { + eval(run_program::rooted + ($prefix, "/usr/bin/curl", "-o", + "/etc/foomatic/$queue.ppd", + "http://$server:631/printers/$q.ppd")); + } # Does the file exist and is it not an error message? if ((-r "$prefix/etc/foomatic/$queue.ppd") && (cat_("$prefix/etc/foomatic/$queue.ppd") =~ @@ -2965,7 +2995,7 @@ sub addcupsremotetogimp { my @printerlist = getcupsremotequeues(); my $ppdfile = ""; if (($printer->{SPOOLER} eq "cups") && - (-x "$prefix/usr/bin/curl")) { + ((-x "$prefix/usr/bin/curl") || (-x "$prefix/usr/bin/wget"))) { for my $listentry (@printerlist) { next if !($listentry =~ /^([^\|]+)\|([^\|]+)$/); my $q = $1; @@ -2973,10 +3003,17 @@ sub addcupsremotetogimp { my $server = $2; # Remove server name from queue name $q =~ s/^([^@]*)@.*$/$1/; - eval(run_program::rooted - ($prefix, "/usr/bin/curl", "-o", - "/etc/foomatic/$queue.ppd", - "http://$server:631/printers/$q.ppd")); + if (-x "$prefix/usr/bin/wget") { + eval(run_program::rooted + ($prefix, "/usr/bin/wget", "-O", + "/etc/foomatic/$queue.ppd", + "http://$server:631/printers/$q.ppd")); + } else { + eval(run_program::rooted + ($prefix, "/usr/bin/curl", "-o", + "/etc/foomatic/$queue.ppd", + "http://$server:631/printers/$q.ppd")); + } # Does the file exist and is it not an error message? if ((-r "$prefix/etc/foomatic/$queue.ppd") && (cat_("$prefix/etc/foomatic/$queue.ppd") =~ diff --git a/perl-install/printerdrake.pm b/perl-install/printerdrake.pm index 95ebb51c7..61bec7737 100644 --- a/perl-install/printerdrake.pm +++ b/perl-install/printerdrake.pm @@ -2747,15 +2747,16 @@ sub install_spooler { my $w = $in->wait_message(_("Printerdrake"), _("Checking installed software...")); if ((!$::testing) && - (!printer::files_exist((qw(/usr/lib/cups/cgi-bin/printers.cgi - /sbin/ifconfig - /usr/bin/xpp - /usr/bin/curl), - ($::expert ? - "/usr/share/cups/model/postscript.ppd.gz" : ()) - )))) { + ((!printer::files_exist((qw(/usr/lib/cups/cgi-bin/printers.cgi + /sbin/ifconfig + /usr/bin/xpp), + ($::expert ? + "/usr/share/cups/model/postscript.ppd.gz" : ()) + ))) || + ((!printer::files_exist((qw(/usr/bin/wget)))) && + (!printer::files_exist((qw(/usr/bin/curl))))))) { $in->do_pkgs->install(('cups', 'net-tools', 'xpp', - 'curl', + 'webfetch', ($::expert ? 'cups-drivers' : ()))); } # Try to start the network when CUPS is the spooler, so that @@ -3206,6 +3207,11 @@ sub main { # Toggle expert mode and standard mode if ($menuchoice eq "\@usermode") { printer::set_usermode(!$::expert); + # make sure that the "cups-drivers" package gets + # installed when switching into expert mode + if (($::expert) && ($printer->{SPOOLER} eq "cups")) { + install_spooler($printer, $in, $upNetwork); + } # Read printer database for the new user mode %printer::thedb = (); #my $w = $in->wait_message(_("Printerdrake"), -- cgit v1.2.1