summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/service_harddrake
diff options
context:
space:
mode:
authorMystery Man <unknown@mandriva.org>2002-08-09 10:26:12 +0000
committerMystery Man <unknown@mandriva.org>2002-08-09 10:26:12 +0000
commitfdd0c69b55f6192d1825eb8ddd95bf2806e626f8 (patch)
tree01303c8c4445a5828d744737e6c87cb973fafba6 /perl-install/standalone/service_harddrake
parent9c49e6bfb611d4a73815cfa1a6e6821cd48a9ae2 (diff)
downloaddrakx-1_1_9_9mdk.tar
drakx-1_1_9_9mdk.tar.gz
drakx-1_1_9_9mdk.tar.bz2
drakx-1_1_9_9mdk.tar.xz
drakx-1_1_9_9mdk.zip
This commit was manufactured by cvs2svn to create tag 'V1_1_9_9mdk'.V1_1_9_9mdk
Diffstat (limited to 'perl-install/standalone/service_harddrake')
-rwxr-xr-xperl-install/standalone/service_harddrake91
1 files changed, 0 insertions, 91 deletions
diff --git a/perl-install/standalone/service_harddrake b/perl-install/standalone/service_harddrake
deleted file mode 100755
index 8d84ba973..000000000
--- a/perl-install/standalone/service_harddrake
+++ /dev/null
@@ -1,91 +0,0 @@
-#!/usr/bin/perl -w
-
-use lib qw(/usr/lib/libDrakX);
-
-use strict;
-use standalone; #- warning, standalone must be loaded very first, for 'explanations'
-use MDK::Common;
-use interactive;
-use harddrake::data;
-use Storable qw(store retrieve);
-
-my $hw_sysconfdir = "/etc/sysconfig/harddrake2";
-my $last_boot_config = $hw_sysconfdir."/previous_hw";
-
-my $str = '#!/usr/bin/perl -w
-#
-# Special file generated by harddrake service (cvs revision $Revision$).
-# Do not alter it; it\'ll be overwritten by harddrake2 service
-#
-# Format is : { Config_class_ID => {
-# Device => {
-# _Fields => values} ...} ...}
-#
-';
-
-# first run ? if not read old hw config
-my %previous_config = -f $last_boot_config ? retrieve($last_boot_config) : {};
-
-my (%config, $in);
-
-# For each hw, class, detect device, compare and offer to reconfigure if
-# needed
-foreach (@harddrake::data::tree) {
- my ($Ident, $item, undef, $configurator, $detector) = @$_;
-
- # No detector ? (should never happen but who know ?)
- ref($detector) eq 'CODE' or next;
-
- my %ID = map {
- my $i = $_;
- my $name = do {
- if (defined $i->{device}) {
- $i->{device};
- } else {
- join ':', map { $i->{$_} } qw(vendor id subvendor subid);
- }
- };
- $name => $i;
- } &$detector;
- $config{$Ident} = \%ID;
-
- next if is_empty_hash_ref %previous_config;
- my $oldconfig = $previous_config{$Ident};
-
- my $msg;
- my @was_removed = difference2([ keys %$oldconfig ], [ keys %ID ]);
- $msg .= _("Some devices in the \"%s\" hardware class were removed:\n", $item) if @was_removed;
- $msg .= "- $_ was removed\n" foreach @was_removed;
-
- my @added = difference2([ keys %ID ], [ keys %$oldconfig ]);
- $msg .= _("\nSome devices in the %s class were added:\n", $item) if @added;
- $msg .= "- $_ was added\n" foreach @added;
- @added || @was_removed or next;
-
- next unless (-x $configurator);
-
- my $res;
- $SIG{ALRM} = sub { die "TIMED OUT\n" };
- undef $@;
- eval {
- alarm (5);
- $in = 'interactive'->vnew('su') unless defined $in;
- $res = $in->ask_okcancel("Hardware changes in $Ident class (5 seconds to answer)",
- $msg . "\nDo you want to run the appropriate config tool ?", 1)
- or $in->wait_message(_('Please wait'), _('Hardware probing in progress'));
- alarm (0);
- };
-
- next unless ($@ && $res); # timed out || canceled
- if (my $pid = fork) {
- require POSIX;
- POSIX::wait();
- } else {
- exec("$configurator 2>/dev/null") or die "$configurator missing\n";
- }
-}
-
-# output new hw config
-standalone::explanations "created file $last_boot_config";
-store \%config, $last_boot_config;
-$in->exit(0) if defined $in; exit 0;