summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/drakxtools.spec30
-rwxr-xr-xperl-install/standalone/service_harddrake52
2 files changed, 51 insertions, 31 deletions
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 <<EOF
icon="harddrake.png"
EOF
-cat > $RPM_BUILD_ROOT%_sbindir/convert-harddrake <<EOF
+cat > $RPM_BUILD_ROOT%_datadir/harddrake/convert <<EOF
#!/usr/bin/perl
use Storable;
@@ -198,7 +198,18 @@ 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}
+
+cat > $RPM_BUILD_ROOT%_datadir/harddrake/confirm <<EOF
+#!/usr/bin/perl
+use lib qw(/usr/lib/libDrakX);
+use interactive;
+
+my \$in = interactive->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 <tvignaud@mandrakesoft.com> 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 <daouda@mandrakesoft.com> 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);