summaryrefslogtreecommitdiffstats
path: root/perl-install/printer/services.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-04-25 12:26:16 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-04-25 12:26:16 +0000
commit126777bc019a54afb4ec51299f2cf9d2841698aa (patch)
tree97f76e571902ead55ba138f1156a4b4f00b9b779 /perl-install/printer/services.pm
parentf1f67448efc714873378dfeb8279fae68054a90a (diff)
downloaddrakx-126777bc019a54afb4ec51299f2cf9d2841698aa.tar
drakx-126777bc019a54afb4ec51299f2cf9d2841698aa.tar.gz
drakx-126777bc019a54afb4ec51299f2cf9d2841698aa.tar.bz2
drakx-126777bc019a54afb4ec51299f2cf9d2841698aa.tar.xz
drakx-126777bc019a54afb4ec51299f2cf9d2841698aa.zip
re-sync after the big svn loss
Diffstat (limited to 'perl-install/printer/services.pm')
-rw-r--r--perl-install/printer/services.pm63
1 files changed, 0 insertions, 63 deletions
diff --git a/perl-install/printer/services.pm b/perl-install/printer/services.pm
deleted file mode 100644
index f94cc5af5..000000000
--- a/perl-install/printer/services.pm
+++ /dev/null
@@ -1,63 +0,0 @@
-package printer::services;
-
-use strict;
-use services;
-use run_program;
-
-sub restart ($) {
- my ($service) = @_;
- if (services::restart($service)) {
- # CUPS needs some time to come up.
- wait_for_cups() if $service eq "cups";
- return 1;
- } else { return 0 }
-}
-
-sub start ($) {
- my ($service) = @_;
- if (services::start($service)) {
- # CUPS needs some time to come up.
- wait_for_cups() if $service eq "cups";
- return 1;
- } else { return 0 }
-}
-
-sub start_not_running_service ($) {
- my ($service) = @_;
- # The exit status is not zero when the service is not running
- if (services::start_not_running_service($service)) {
- return 0;
- } else {
- 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;
- }
- }
-}
-
-sub wait_for_cups() {
- # CUPS needs some time to come up. Wait up to 30 seconds, checking
- # whether CUPS is ready.
- my $cupsready = 0;
- my $i;
- for ($i = 0; $i < 30; $i++) {
- # Check whether CUPS is running without any console output
- system(($::testing ? $::prefix : "chroot $::prefix/ ") .
- "/usr/bin/lpstat -r >/dev/null 2>&1");
- if (($? >> 8) != 0) {
- # CUPS is not ready, continue
- sleep 1;
- } else {
- # CUPS is ready, quit
- $cupsready = 1;
- last;
- }
- }
- return $cupsready;
-}
-
-1;