summaryrefslogtreecommitdiffstats
path: root/perl-install/printer.pm
diff options
context:
space:
mode:
authorTill Kamppeter <tkamppeter@mandriva.com>2001-09-19 01:05:58 +0000
committerTill Kamppeter <tkamppeter@mandriva.com>2001-09-19 01:05:58 +0000
commit73b9912206dc32b071ebc0d8cea7b343d0b17a14 (patch)
tree7b73921dc5c269877c22c4e5e805863426b179e2 /perl-install/printer.pm
parent569d59ce614d6e6d7048152cba35aa347eace7e5 (diff)
downloaddrakx-backup-do-not-use-73b9912206dc32b071ebc0d8cea7b343d0b17a14.tar
drakx-backup-do-not-use-73b9912206dc32b071ebc0d8cea7b343d0b17a14.tar.gz
drakx-backup-do-not-use-73b9912206dc32b071ebc0d8cea7b343d0b17a14.tar.bz2
drakx-backup-do-not-use-73b9912206dc32b071ebc0d8cea7b343d0b17a14.tar.xz
drakx-backup-do-not-use-73b9912206dc32b071ebc0d8cea7b343d0b17a14.zip
Network is now only required (and checked) for remote printers.
Several buglets fixed in remote CUPS server dialog.
Diffstat (limited to 'perl-install/printer.pm')
-rw-r--r--perl-install/printer.pm73
1 files changed, 47 insertions, 26 deletions
diff --git a/perl-install/printer.pm b/perl-install/printer.pm
index 7ad0046e9..0c84cfe4c 100644
--- a/perl-install/printer.pm
+++ b/perl-install/printer.pm
@@ -111,34 +111,34 @@ sub set_permissions {
my ($file, $perms, $owner, $group) = @_;
if ($owner && $group) {
run_program::rooted($prefix, "/bin/chown", "$owner.$group", $file)
- || die "Could not restart chown!";
+ || die "Could not start chown!";
} elsif ($owner) {
run_program::rooted($prefix, "/bin/chown", $owner, $file)
- || die "Could not restart chown!";
+ || die "Could not start chown!";
} elsif ($group) {
run_program::rooted($prefix, "/bin/chgrp", $group, $file)
- || die "Could not restart chgrp!";
+ || die "Could not start chgrp!";
}
run_program::rooted($prefix, "/bin/chmod", $perms, $file)
- || die "Could not restart chmod!";
+ || die "Could not start chmod!";
}
sub restart_service ($) {
my ($service) = @_;
- run_program::rooted($prefix, "/etc/rc.d/init.d/$service", "restart")
- || die "Could not restart $service!";
+ run_program::rooted($prefix, "/etc/rc.d/init.d/$service", "restart");
+ if (($? >> 8) != 0) {return 0;} else {return 1;}
}
sub start_service ($) {
my ($service) = @_;
- run_program::rooted($prefix, "/etc/rc.d/init.d/$service", "start")
- || die "Could not start $service!";
+ run_program::rooted($prefix, "/etc/rc.d/init.d/$service", "start");
+ if (($? >> 8) != 0) {return 0;} else {return 1;}
}
sub stop_service ($) {
my ($service) = @_;
- run_program::rooted($prefix, "/etc/rc.d/init.d/$service", "stop")
- || die "Could not stop $service!";
+ run_program::rooted($prefix, "/etc/rc.d/init.d/$service", "stop");
+ if (($? >> 8) != 0) {return 0;} else {return 1;}
}
sub service_starts_on_boot ($) {
@@ -165,28 +165,49 @@ sub start_service_on_boot ($) {
return 1;
}
-sub network_status {
- # If the network is not running or not running as configured,
- # return 0, otherwise 1.
+sub SIGHUP_daemon {
+ my ($spooler) = @_;
+ # PDQ has no daemon, exit.
+ if ($spooler eq "pdq") {return 1};
+ # CUPS needs auto-configuration
+ if ($spooler eq "cups") {
+ run_program::rooted($prefix, "/usr/sbin/setcupsconfig");
+ }
+ # Name of the daemon
+ my $daemon;
+ if (($spooler eq "lpr") || ($spooler eq "lpd") || ($spooler eq "lprng")) {
+ $daemon = "lpd";
+ } elsif ($spooler eq "cups") {
+ $daemon = "cupsd";
+ } else {
+ return 1;
+ }
+ # Send the SIGHUP
+ run_program::rooted($prefix, "/usr/bin/killall", "-HUP", $daemon);
+ # CUPS needs some time to come up.
+ if ($spooler eq "cups") {
+ sleep 5;
+ }
+ return 1;
+}
+
+sub network_running {
+ # If the network is not running return 0, otherwise 1.
local *F;
open F, ($::testing ? "$prefix" : "chroot $prefix/ ") .
- "/bin/sh -c \"export LC_ALL=C; /etc/rc.d/init.d/network status\" |" ||
- die "Could not run \"/etc/rc.d/init.d/network status\"!";
+ "/bin/sh -c \"export LC_ALL=C; /sbin/ifconfig\" |" ||
+ die "Could not run \"ifconfig\"!";
while (<F>) {
- if (($_ =~ /Devices.*down/) || # Are there configured devices which
- # are down
- ($_ =~ /Devices.*modified/)) { # Configured devices which are not
- # running as configured
- my $devices = <F>;
- chomp $devices;
- if ($devices !~ /^\s*$/) { # Blank line
- close F;
- return 0;
- }
+ if (($_ !~ /^lo\s+/) && # The loopback device can have been started by
+ # the spooler's startup script
+ ($_ =~ /^(\S+)\s+/)) { # In this line starts an entry for a
+ # running network
+ close F;
+ return 1;
}
}
close F;
- return 1;
+ return 0;
}
sub get_security_level {