diff options
author | Till Kamppeter <tkamppeter@mandriva.com> | 2002-07-22 23:44:13 +0000 |
---|---|---|
committer | Till Kamppeter <tkamppeter@mandriva.com> | 2002-07-22 23:44:13 +0000 |
commit | 7bf28e1f15fd5da4437cb16dc671550b45f653b2 (patch) | |
tree | 938b8c429d29f69ba53397aa933251aa935dc38c | |
parent | 2bd1d5bdc2840b6f2f8d49d678194aafcc453c82 (diff) | |
download | drakx-7bf28e1f15fd5da4437cb16dc671550b45f653b2.tar drakx-7bf28e1f15fd5da4437cb16dc671550b45f653b2.tar.gz drakx-7bf28e1f15fd5da4437cb16dc671550b45f653b2.tar.bz2 drakx-7bf28e1f15fd5da4437cb16dc671550b45f653b2.tar.xz drakx-7bf28e1f15fd5da4437cb16dc671550b45f653b2.zip |
Adapted printerdrake to CUPS 1.1.15 and Perl 5.8.0 (for Foomatic).
Let network also be started during installation when LPRng or PDQ is the spooler, so that the user can install queues to remote printers.
-rw-r--r-- | perl-install/printer.pm | 41 | ||||
-rw-r--r-- | perl-install/printerdrake.pm | 30 |
2 files changed, 60 insertions, 11 deletions
diff --git a/perl-install/printer.pm b/perl-install/printer.pm index 21793641e..60ac7036c 100644 --- a/perl-install/printer.pm +++ b/perl-install/printer.pm @@ -156,6 +156,26 @@ sub start_service ($) { } } +sub start_not_running_service ($) { + my ($service) = @_; + # Exit silently if the service is not installed + return 1 if (!(-x "$prefix/etc/rc.d/init.d/$service")); + run_program::rooted($prefix, "/etc/rc.d/init.d/$service", "status"); + # The exit status is not zero when the service is not running + if (($? >> 8) != 0) { + run_program::rooted($prefix, "/etc/rc.d/init.d/$service", "start"); + if (($? >> 8) != 0) { + return 0; + } else { + # CUPS needs some time to come up. + wait_for_cups() if ($service eq "cups"); + return 1; + } + } else { + return 1; + } +} + sub stop_service ($) { my ($service) = @_; # Exit silently if the service is not installed @@ -194,26 +214,31 @@ sub SIGHUP_daemon { # PDQ has no daemon, exit. if ($service eq "pdq") {return 1}; # CUPS needs auto-configuration - run_program::rooted($prefix, "/usr/sbin/setcupsconfig") if ($service eq "cups"); + run_program::rooted($prefix, "/usr/sbin/correctcupsconfig") if ($service eq "cups"); # Name of the daemon my %daemons = ( "lpr" => "lpd", - "lpd" => "lpr", + "lpd" => "lpd", "lprng" => "lpd", "cups" => "cupsd", "devfs" => "devfsd", ); my $daemon = $deamons{$service}; $daemon = $service if (! defined $daemon); +# if ($service eq "cups") { +# # The current CUPS (1.1.13) dies on SIGHUP, do the normal restart. +# restart_service($service); +# # CUPS needs some time to come up. +# wait_for_cups(); +# } else { + + # Send the SIGHUP + run_program::rooted($prefix, "/usr/bin/killall", "-HUP", $daemon); if ($service eq "cups") { - # The current CUPS (1.1.13) dies on SIGHUP, to the normal restart. - restart_service($service); # CUPS needs some time to come up. wait_for_cups(); - } else { - # Send the SIGHUP - run_program::rooted($prefix, "/usr/bin/killall", "-HUP", $daemon); } + return 1; } @@ -1042,7 +1067,7 @@ sub poll_ppd_base { #- if cups continue to modify it (because it reads the ppd files available), the #- poll_ppd_base program simply cores :-) run_program::rooted($prefix, "ifconfig lo 127.0.0.1"); #- else cups will not be happy! and ifup lo don't run ? - start_service("cups"); + start_not_running_service("cups"); my $driversthere = scalar(keys %thedb); foreach (1..60) { local *PPDS; open PPDS, ($::testing ? "$prefix" : "chroot $prefix/ ") . "/usr/bin/poll_ppd_base -a |"; diff --git a/perl-install/printerdrake.pm b/perl-install/printerdrake.pm index 3517eac3e..f158d5142 100644 --- a/perl-install/printerdrake.pm +++ b/perl-install/printerdrake.pm @@ -2093,7 +2093,9 @@ sub install_spooler { sleep(1); }; # Start daemon - printer::start_service("cups"); + # Avoid unnecessary restarting of CUPS, this blocks the + # startup of printerdrake for several seconds. + printer::start_not_running_service("cups"); # Set the CUPS tools as defaults for "lpr", "lpq", "lprm", ... printer::set_alternative("lpr","/usr/bin/lpr-cups"); printer::set_alternative("lpq","/usr/bin/lpq-cups"); @@ -2125,6 +2127,13 @@ sub install_spooler { /usr/bin/convert))))) { $in->do_pkgs->install(('lpr', 'net-tools', 'gpr', 'a2ps', 'ImageMagick')); } + # Start the network (especially during installation), so the + # user can set up queues to remote printers. + $upNetwork and do { + &$upNetwork(); + undef $upNetwork; + sleep(1); + }; # Start daemon printer::restart_service("lpd"); # Set the LPD tools as defaults for "lpr", "lpq", "lprm", ... @@ -2155,6 +2164,13 @@ sub install_spooler { /usr/bin/convert))))) { $in->do_pkgs->install('LPRng', 'net-tools', 'gpr', 'a2ps', 'ImageMagick'); } + # Start the network (especially during installation), so the + # user can set up queues to remote printers. + $upNetwork and do { + &$upNetwork(); + undef $upNetwork; + sleep(1); + }; # Start daemon printer::restart_service("lpd"); # Set the LPRng tools as defaults for "lpr", "lpq", "lprm", ... @@ -2178,6 +2194,13 @@ sub install_spooler { /usr/X11R6/bin/xpdq))))) { $in->do_pkgs->install('pdq'); } + # Start the network (especially during installation), so the + # user can set up queues to remote printers. + $upNetwork and do { + &$upNetwork(); + undef $upNetwork; + sleep(1); + }; # PDQ has no daemon, so nothing needs to be started # Set the PDQ tools as defaults for "lpr", "lpq", "lprm", ... @@ -2246,7 +2269,7 @@ sub install_foomatic { my ($in) = @_; if ((!$::testing) && (!printer::files_exist((qw(/usr/bin/foomatic-configure - /usr/lib/perl5/site_perl/5.6.1/Foomatic/DB.pm) + /usr/lib/perl5/vendor_perl/5.8.0/Foomatic/DB.pm) )))) { my $w = $in->wait_message('', _("Installing Foomatic...")); $in->do_pkgs->install('foomatic'); @@ -2280,7 +2303,7 @@ sub main { my $w = $in->wait_message('', _("Checking installed software...")); if ((!$::testing) && (!printer::files_exist((qw(/usr/bin/foomatic-configure - /usr/lib/perl5/site_perl/5.6.1/Foomatic/DB.pm + /usr/lib/perl5/vendor_perl/5.8.0/Foomatic/DB.pm /usr/bin/escputil /usr/share/printer-testpages/testprint.ps ), @@ -2548,6 +2571,7 @@ sub main { step_0: #if ((!$::expert) && (!$::isEmbedded) && (!$::isInstall) && if ((!$::isEmbedded) && (!$::isInstall) && + #if ((!$::isInstall) && ($in->isa('interactive_gtk'))) { $continue = 1; # Enter wizard mode |