summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/service_harddrake
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/standalone/service_harddrake')
-rwxr-xr-xperl-install/standalone/service_harddrake107
1 files changed, 0 insertions, 107 deletions
diff --git a/perl-install/standalone/service_harddrake b/perl-install/standalone/service_harddrake
deleted file mode 100755
index 56fbfdbb5..000000000
--- a/perl-install/standalone/service_harddrake
+++ /dev/null
@@ -1,107 +0,0 @@
-#!/usr/bin/perl -w
-# harddrake2 This service runs the HardDrake hardware probe.
-#
-# chkconfig: 345 05 95
-# description: This runs the hardware probe, and optionally configures \
-# changed hardware.
-
-
-# TODO: start/stop/status/
-
-use lib qw(/usr/lib/libDrakX);
-
-use strict;
-use standalone; #- warning, standalone must be loaded very first, for 'explanations'
-
-if ($ARGV[0] !~ /^start$/) {
- print "service harddrake [start|stop]\n";
- exit 0;
-}
-
-use MDK::Common;
-use POSIX;
-
-use interactive;
-
-use harddrake::data;
-use Data::Dumper;
-
-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} ...} ...}
-#
-';
-
-my $in = 'interactive'->vnew('su');
-my $w = $in->wait_message(_("Please wait"), _("Hardware probing in progress"));
-
-# first run ? if not read old hw config
-my $previous_config = -f $last_boot_config ? do $last_boot_config : {};
-
-my %config;
-
-# 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 ($item eq "Mouse") {
- $i->{media_type} = "MOUSE";
- $i->{device};
- } elsif (defined $i->{device}) {
- $i->{media_type} = "MASS_STORAGE_MEDIA";
- $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);
- undef $w;
-
- if ($in->ask_okcancel("Hardware changes in $Ident class",
- $msg . "\nDo you want to run the appropriate config tool ?", 1)) {
-
- if (my $pid = fork) {
- POSIX::wait();
- } else {
- exec($configurator) 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");