summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2002-07-23 09:35:45 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2002-07-23 09:35:45 +0000
commite2889facfca0f6c6f64e2194f913a6b525f255e0 (patch)
tree1a6a31cac250bc7456664b1b4700587d50ca19b5 /perl-install
parent7ec6169f18805dc3b211e9604d7e318f46973ce3 (diff)
downloaddrakx-backup-do-not-use-e2889facfca0f6c6f64e2194f913a6b525f255e0.tar
drakx-backup-do-not-use-e2889facfca0f6c6f64e2194f913a6b525f255e0.tar.gz
drakx-backup-do-not-use-e2889facfca0f6c6f64e2194f913a6b525f255e0.tar.bz2
drakx-backup-do-not-use-e2889facfca0f6c6f64e2194f913a6b525f255e0.tar.xz
drakx-backup-do-not-use-e2889facfca0f6c6f64e2194f913a6b525f255e0.zip
faster service startup
Diffstat (limited to 'perl-install')
-rwxr-xr-xperl-install/standalone/service_harddrake19
1 files changed, 8 insertions, 11 deletions
diff --git a/perl-install/standalone/service_harddrake b/perl-install/standalone/service_harddrake
index 1235ae539..bfc652d13 100755
--- a/perl-install/standalone/service_harddrake
+++ b/perl-install/standalone/service_harddrake
@@ -1,18 +1,16 @@
#!/usr/bin/perl -w
-# harddrake2 This service runs the HardDrake hardware probe.
use lib qw(/usr/lib/libDrakX);
use strict;
use standalone; #- warning, standalone must be loaded very first, for 'explanations'
use MDK::Common;
-use POSIX;
use interactive;
use harddrake::data;
-use Data::Dumper;
+use Storable qw(store retrieve);
my $hw_sysconfdir = "/etc/sysconfig/harddrake2";
-my $last_boot_config = "$hw_sysconfdir/previous_hw";
+my $last_boot_config = $hw_sysconfdir."/previous_hw";
my $str = '#!/usr/bin/perl -w
#
@@ -26,7 +24,7 @@ my $str = '#!/usr/bin/perl -w
';
# first run ? if not read old hw config
-my $previous_config = -f $last_boot_config ? do $last_boot_config : {};
+my %previous_config = -f $last_boot_config ? retrieve($last_boot_config) : {};
my (%config, $in);
@@ -55,8 +53,8 @@ foreach (@harddrake::data::tree) {
} &$detector;
$config{$Ident} = \%ID;
- next if is_empty_hash_ref $previous_config;
- my $oldconfig = $previous_config->{$Ident};
+ next if is_empty_hash_ref %previous_config;
+ my $oldconfig = $previous_config{$Ident};
my $msg;
my @was_removed = difference2([ keys %$oldconfig ], [ keys %ID ]);
@@ -86,15 +84,14 @@ foreach (@harddrake::data::tree) {
print "CANCELED\n" if $res;
next unless ($res); # canceled
if (my $pid = fork) {
+ require POSIX;
POSIX::wait();
} else {
exec("$configurator 2>/dev/null") or die "$configurator missing\n";
}
}
-
-$Data::Dumper::Terse = 1; # don't output names where feasible
-$Data::Dumper::Purity = 1; # fill in the holes for eval
# output new hw config
-output("$last_boot_config", $str . Dumper(\%config) . ";\n");
+standalone::explanations "created file $last_boot_config";
+store \%config, $last_boot_config;
$in->exit(0) if defined $in; exit 0;