summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2002-09-06 21:36:02 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2002-09-06 21:36:02 +0000
commitbf209b0d26153b1c8f4d51f26c20d60d9107e2f5 (patch)
tree8596c6590c1f93a73c5cd081ce4831fc70d2f0b4
parent100f950ee539ce7a88e4ea39d487dfb019a8298f (diff)
downloaddrakx-bf209b0d26153b1c8f4d51f26c20d60d9107e2f5.tar
drakx-bf209b0d26153b1c8f4d51f26c20d60d9107e2f5.tar.gz
drakx-bf209b0d26153b1c8f4d51f26c20d60d9107e2f5.tar.bz2
drakx-bf209b0d26153b1c8f4d51f26c20d60d9107e2f5.tar.xz
drakx-bf209b0d26153b1c8f4d51f26c20d60d9107e2f5.zip
- harddrake::data : consolidate common code in custom_id()
- do some detection in dm stage - fix bad test - display better name
-rw-r--r--perl-install/drakxtools.spec15
-rw-r--r--perl-install/harddrake/data.pm5
-rw-r--r--perl-install/harddrake/ui.pm2
-rwxr-xr-xperl-install/standalone/service_harddrake31
4 files changed, 33 insertions, 20 deletions
diff --git a/perl-install/drakxtools.spec b/perl-install/drakxtools.spec
index 6ee56f490..2e742ef1a 100644
--- a/perl-install/drakxtools.spec
+++ b/perl-install/drakxtools.spec
@@ -1,7 +1,7 @@
Summary: The drakxtools (XFdrake, diskdrake, keyboarddrake, mousedrake...)
Name: drakxtools
Version: 1.1.9
-Release: 40mdk
+Release: 41mdk
Url: http://www.linux-mandrake.com/en/drakx.php3
Source0: %name-%version.tar.bz2
License: GPL
@@ -155,7 +155,7 @@ hardware classes.
rm -rf $RPM_BUILD_ROOT
%make PREFIX=$RPM_BUILD_ROOT install
-mkdir -p $RPM_BUILD_ROOT/{%_initrddir,etc/sysconfig/harddrake2}
+mkdir -p $RPM_BUILD_ROOT/{%_initrddir,%_sysconfdir/{X11/xinit.d,sysconfig/harddrake2}}
touch $RPM_BUILD_ROOT/etc/sysconfig/harddrake2/previous_hw
mv $RPM_BUILD_ROOT%_sbindir/net_monitor \
@@ -193,7 +193,12 @@ my \$last_boot_config = "/etc/sysconfig/harddrake2/previous_hw";
my \$config = do \$last_boot_config;
store \$config, \$last_boot_config;
EOF
-chmod +x $RPM_BUILD_ROOT%_sbindir/convert-harddrake
+
+cat > $RPM_BUILD_ROOT%_sysconfdir/X11/xinit.d/harddrake2 <<EOF
+#!/bin/sh
+exec /usr/share/harddrake/service_harddrake X11
+EOF
+chmod +x $RPM_BUILD_ROOT{%_sbindir/convert-harddrake,%_sysconfdir/X11/xinit.d/harddrake2}
%find_lang libDrakX
cat libDrakX.lang >> %name.list
@@ -252,6 +257,7 @@ file /etc/sysconfig/harddrake2/previous_hw | fgrep -q perl && %_sbindir/convert-
%config(noreplace) /etc/sysconfig/harddrake2/previous_hw
%_datadir/harddrake/service_harddrake
%_sbindir/convert-harddrake
+%_sysconfdir/X11/xinit.d/harddrake2
%files -n harddrake-ui
%defattr(-,root,root)
@@ -273,6 +279,9 @@ file /etc/sysconfig/harddrake2/previous_hw | fgrep -q perl && %_sbindir/convert-
%config(noreplace) %_sysconfdir/logrotate.d/drakxtools-http
%changelog
+* Fri Sep 6 2002 Thierry Vignaud <tvignaud@mandrakesoft.com> 1.1.9-41mdk
+- fix harddrake service, run non essential checks after dm start
+
* Fri Sep 6 2002 Thierry Vignaud <tvignaud@mandrakesoft.com> 1.1.9-40mdk
- harddrake:
o fix usb mouse detection
diff --git a/perl-install/harddrake/data.pm b/perl-install/harddrake/data.pm
index d88925014..0da8974fa 100644
--- a/perl-install/harddrake/data.pm
+++ b/perl-install/harddrake/data.pm
@@ -82,4 +82,9 @@ our @tree =
);
+sub custom_id {
+ my ($device, $str) = @_;
+ defined($device->{device}) ? $device->{device} : (defined($device->{description}) ? $device->{description} : $str);
+}
+
1;
diff --git a/perl-install/harddrake/ui.pm b/perl-install/harddrake/ui.pm
index 49b48caaf..e8feb1395 100644
--- a/perl-install/harddrake/ui.pm
+++ b/perl-install/harddrake/ui.pm
@@ -209,7 +209,7 @@ sub new {
}
foreach my $i (qw(vendor id subvendor subid pci_bus pci_device pci_function MOUSETYPE XMOUSETYPE unsafe val devfs_prefix wacom auxmouse)) { delete $_->{$i} }
$_->{device} = '/dev/'.$_->{device} if exists $_->{device};
- my $custom_id = defined($_->{device}) ? $_->{device} : (defined($_->{description}) ? $_->{description} : $title);
+ my $custom_id = harddrake::data::custom_id($_, $title);
my $hw_item = $tree->insert_node($hw_class_tree, $prev_item, [$custom_id ], 5, (undef) x 4, 1, 0);
$tree->set_row_data($hw_item, [data => $_, configurator => $configurator ]);
$tree->{data}{$custom_id} = $_;
diff --git a/perl-install/standalone/service_harddrake b/perl-install/standalone/service_harddrake
index 6c46720d4..b5e39b843 100755
--- a/perl-install/standalone/service_harddrake
+++ b/perl-install/standalone/service_harddrake
@@ -12,53 +12,52 @@ use Storable qw(store retrieve);
my $hw_sysconfdir = "/etc/sysconfig/harddrake2";
my $last_boot_config = $hw_sysconfdir."/previous_hw";
-# first run ? if not read old hw config
-my %previous_config = (-f $last_boot_config && -s $last_boot_config) ? retrieve($last_boot_config) : {};
+my $invert_do_it = $ARGV[0] eq 'X11' ? 1 : 0;
+$last_boot_config .= '_X11' if $invert_do_it;
+# first run ? if not read old hw config
+my $previous_config = (-f $last_boot_config && -s $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, $do_it) = @$_;
- next unless $do_it;
+ next unless $do_it ^ $invert_do_it;
# No detector ? (should never happen but who know ?)
ref($detector) eq 'CODE' or next;
my %ID = map {
my $i = $_;
- my $name = if_(defined $i->{device}, [$i->{device}, join ':', map { $i->{$_} } qw(vendor id subvendor subid)]);
- $name => $i;
+ my $id = defined $i->{device} ? $i->{device} : join(':', map { $i->{$_} } qw(vendor id subvendor subid));
+ $id => $i;
} &$detector;
$config{$Ident} = \%ID;
+ next if is_empty_hash_ref $previous_config; # don't fsck on first run
- next if is_empty_hash_ref %previous_config;
- my $oldconfig = $previous_config{$Ident};
+ 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;
-
+ $msg .= "- ". harddrake::data::custom_id($oldconfig->{$_}, $item) ." 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;
+ $msg .= "- ". harddrake::data::custom_id($ID{$_}, $item) ." was added\n" foreach (@added);
@added || @was_removed or next;
-
next unless (-x $configurator);
my $res;
- $SIG{ALRM} = sub { die "TIMED OUT\n" };
+ $SIG{ALRM} = sub { undef $in; undef $res; next }; #die "TIMED OUT\n" };
undef $@;
eval {
- alarm (5);
+ alarm (5) unless $invert_do_it;
$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);
+ alarm (0) unless $invert_do_it;
};
-
- next unless ($@ && $res); # timed out || canceled
+ next if ($@ || !$res); # timed out || canceled
if (my $pid = fork) {
require POSIX;
POSIX::wait();