From 18df03007b63e603bd46eaacd8404c2e34fe4ca9 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Mon, 9 Sep 2002 08:43:55 +0000 Subject: - harddrake: o don't pollute sbin namespace with one shot scripts o add run wrapper script for harddrake service o disable ?dm part o timeout configurator offer to 5 seconds --- perl-install/drakxtools.spec | 30 +++++++++++++----- perl-install/standalone/service_harddrake | 52 +++++++++++++++++-------------- 2 files changed, 51 insertions(+), 31 deletions(-) (limited to 'perl-install') diff --git a/perl-install/drakxtools.spec b/perl-install/drakxtools.spec index eb775d4da..925c1426b 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: 42mdk +Release: 43mdk Url: http://www.linux-mandrake.com/en/drakx.php3 Source0: %name-%version.tar.bz2 License: GPL @@ -184,7 +184,7 @@ cat > $RPM_BUILD_ROOT%_menudir/harddrake-ui < $RPM_BUILD_ROOT%_sbindir/convert-harddrake < $RPM_BUILD_ROOT%_datadir/harddrake/convert < $RPM_BUILD_ROOT%_sysconfdir/X11/xinit.d/harddrake2 < $RPM_BUILD_ROOT%_datadir/harddrake/confirm <vnew; +my $res = \$in->ask_okcancel(\$ARGV[0], \$ARGV[1], 1); +$in->exit($res); +EOF + +chmod +x $RPM_BUILD_ROOT{%_datadir/harddrake/*,%_sysconfdir/X11/xinit.d/harddrake2} %find_lang libDrakX cat libDrakX.lang >> %name.list @@ -236,7 +247,7 @@ done %_preun_service harddrake %postun -n harddrake -file /etc/sysconfig/harddrake2/previous_hw | fgrep -q perl && %_sbindir/convert-harddrake || : +file /etc/sysconfig/harddrake2/previous_hw | fgrep -q perl && %_datadir/harddrake/convert || : %files newt -f %name.list %defattr(-,root,root) @@ -255,9 +266,8 @@ file /etc/sysconfig/harddrake2/previous_hw | fgrep -q perl && %_sbindir/convert- %config(noreplace) %_initrddir/harddrake %dir /etc/sysconfig/harddrake2/ %config(noreplace) /etc/sysconfig/harddrake2/previous_hw -%_datadir/harddrake/service_harddrake -%_sbindir/convert-harddrake -%_sysconfdir/X11/xinit.d/harddrake2 +%_datadir/harddrake/* +#%_sysconfdir/X11/xinit.d/harddrake2 %files -n harddrake-ui %defattr(-,root,root) @@ -279,6 +289,12 @@ file /etc/sysconfig/harddrake2/previous_hw | fgrep -q perl && %_sbindir/convert- %config(noreplace) %_sysconfdir/logrotate.d/drakxtools-http %changelog +* Sun Sep 8 2002 Thierry Vignaud 1.1.9-43mdk +- harddrake: + o don't pollute sbin namespace with one shot scripts + o add run wrapper script for harddrake service + o disable ?dm part + * Sat Sep 7 2002 Daouda LO 1.1.9-42mdk - cvs up before packaging (fix messy drakboot conf). diff --git a/perl-install/standalone/service_harddrake b/perl-install/standalone/service_harddrake index b5e39b843..fe9750e8f 100755 --- a/perl-install/standalone/service_harddrake +++ b/perl-install/standalone/service_harddrake @@ -9,15 +9,16 @@ use interactive; use harddrake::data; use Storable qw(store retrieve); -my $hw_sysconfdir = "/etc/sysconfig/harddrake2"; +my $invert_do_it = $ARGV[0] eq 'X11' ? 1 : 0; +my ($hw_sysconfdir, $timeout) = ("/etc/sysconfig/harddrake2", $invert_do_it ? 600 : 5); my $last_boot_config = $hw_sysconfdir."/previous_hw"; -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); +my (%config, $wait); +my $in = interactive->vnew; # For each hw, class, detect device, compare and offer to reconfigure if needed foreach (@harddrake::data::tree) { @@ -38,33 +39,36 @@ foreach (@harddrake::data::tree) { 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 .= "- ". harddrake::data::custom_id($oldconfig->{$_}, $item) ." was removed\n" foreach @was_removed; + if (@was_removed) { + $msg .= _("Some devices in the \"%s\" hardware class were removed:\n", $item) . + "- ". harddrake::data::custom_id($oldconfig->{$_}, $item) ." was removed\n" foreach @was_removed . "\n"; + } my @added = difference2([ keys %ID ], [ keys %$oldconfig ]); - $msg .= _("\nSome devices in the %s class were added:\n", $item) if @added; + $msg .= _("Some devices were added:\n", $item) if @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 { undef $in; undef $res; next }; #die "TIMED OUT\n" }; - undef $@; - eval { - 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) unless $invert_do_it; - }; - next if ($@ || !$res); # timed out || canceled - if (my $pid = fork) { - require POSIX; - POSIX::wait(); - } else { exec("$configurator 2>/dev/null") or die "$configurator missing\n" } + my ($pid, $no); + $SIG{ALRM} = sub { $no = 1; kill 15, $pid }; + unless ($pid = fork) { + exec("/usr/share/harddrake/confirm 'Hardware changes in $Ident class ($timeout seconds to answer)' '" . $msg . "Do you want to run the appropriate config tool ?'"); + } + alarm($timeout); + wait; + my $res = $?; + alarm(0); + if ($no) { + require interactive; + undef $wait; + $wait = $in->wait_message(_('Please wait'), _('Hardware probing in progress')); + } elsif ($res) { + if (my $pid = fork) { + 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; +$in->exit(0); -- cgit v1.2.1