summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2011-12-16 19:11:46 +0000
committerThierry Vignaud <tv@mageia.org>2011-12-16 19:11:46 +0000
commit0e76397c4e7a272c34526aafe15d14cc79201fcd (patch)
tree3212c95ad6a1d0ea98ba9eb704f7e8285fb86557 /perl-install
parente438b2ae5cae070f0b4ec66a1d9e9b3e34e1377c (diff)
downloaddrakx-0e76397c4e7a272c34526aafe15d14cc79201fcd.tar
drakx-0e76397c4e7a272c34526aafe15d14cc79201fcd.tar.gz
drakx-0e76397c4e7a272c34526aafe15d14cc79201fcd.tar.bz2
drakx-0e76397c4e7a272c34526aafe15d14cc79201fcd.tar.xz
drakx-0e76397c4e7a272c34526aafe15d14cc79201fcd.zip
(_launchX) split it out of new()
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/install/steps_gtk.pm98
1 files changed, 50 insertions, 48 deletions
diff --git a/perl-install/install/steps_gtk.pm b/perl-install/install/steps_gtk.pm
index a574bb6e9..adf5ceb8c 100644
--- a/perl-install/install/steps_gtk.pm
+++ b/perl-install/install/steps_gtk.pm
@@ -45,53 +45,7 @@ sub new($$) {
mkdir '/tmp/.X11-unix';
run_program::run('mount', '-t', 'tmpfs', 'none', '/tmp/.X11-unix');
- my $launchX = sub {
- my ($server, $Driver) = @_;
- mkdir '/var/log' if !-d '/var/log';
-
- my @options = $wanted_DISPLAY;
- if ($server eq 'Xnest') {
- push @options, '-ac', '-geometry', $o->{vga} || ($o->{vga16} ? '640x480' : '800x600');
- } else {
- install::gtk::createXconf($f, @{$o->{mouse}}{'Protocol', 'device'}, $o->{mouse}{wacom}[0], $Driver);
-
- push @options, '-allowMouseOpenFail', '-xf86config', $f if arch() !~ /^sparc/;
- push @options, 'vt7', '-dpi', '75';
- push @options, '-nolisten', 'tcp';
-
- #- old weird servers: Xsun
- push @options, '-fp', '/usr/share/fonts:unscaled' if $server =~ /Xsun/;
- }
-
- if (!fork()) {
- c::setsid();
- exec $server, @options or c::_exit(1);
- }
-
- #- wait for the server to start
- foreach (1..5) {
- sleep 1;
- last if fuzzy_pidofs(qr/\b$server\b/);
- log::l("$server still not running, trying again");
- }
- my $nb;
- my $start_time = time();
- foreach (1..60) {
- log::l("waiting for the server to start ($_ $nb)");
- log::l("Server died"), return 0 if !fuzzy_pidofs(qr/\b$server\b/);
- $nb++ if xf86misc::main::Xtest($wanted_DISPLAY);
- if ($nb > 2) { #- one succeeded test is not enough :-(
- log::l("AFAIK X server is up");
- return 1;
- }
- time() - $start_time < 60 or last;
- time() - $start_time > 8 and print N("Xorg server is slow to start. Please wait..."), "\n";
- sleep 1;
- }
- log::l("Timeout!!");
- 0;
- };
my @servers = qw(Driver:fbdev Driver:vesa); #-)
if ($::testing) {
@servers = 'Xnest';
@@ -115,11 +69,11 @@ sub new($$) {
if (/FB/i) {
!$o->{vga16} && $o->{allowFB} or next;
- $o->{allowFB} = &$launchX($prog, $Driver) #- keep in mind FB is used.
+ $o->{allowFB} = _launchX($o, $f, $prog, $Driver, $wanted_DISPLAY) #- keep in mind FB is used.
and goto OK;
} else {
$o->{vga16} = 1 if /VGA16/;
- &$launchX($prog, $Driver) and goto OK;
+ _launchX($o, $f, $prog, $Driver, $wanted_DISPLAY) and goto OK;
}
}
return undef;
@@ -146,6 +100,54 @@ sub new($$) {
$o;
}
+sub _launchX {
+ my ($o, $f, $server, $Driver, $wanted_DISPLAY) = @_;
+
+ mkdir '/var/log' if !-d '/var/log';
+
+ my @options = $wanted_DISPLAY;
+ if ($server eq 'Xnest') {
+ push @options, '-ac', '-geometry', $o->{vga} || ($o->{vga16} ? '640x480' : '800x600');
+ } else {
+ install::gtk::createXconf($f, @{$o->{mouse}}{'Protocol', 'device'}, $o->{mouse}{wacom}[0], $Driver);
+
+ push @options, '-allowMouseOpenFail', '-xf86config', $f if arch() !~ /^sparc/;
+ push @options, 'vt7', '-dpi', '75';
+ push @options, '-nolisten', 'tcp';
+
+ #- old weird servers: Xsun
+ push @options, '-fp', '/usr/share/fonts:unscaled' if $server =~ /Xsun/;
+ }
+
+ if (!fork()) {
+ c::setsid();
+ exec $server, @options or c::_exit(1);
+ }
+
+ #- wait for the server to start
+ foreach (1..5) {
+ sleep 1;
+ last if fuzzy_pidofs(qr/\b$server\b/);
+ log::l("$server still not running, trying again");
+ }
+ my $nb;
+ my $start_time = time();
+ foreach (1..60) {
+ log::l("waiting for the server to start ($_ $nb)");
+ log::l("Server died"), return 0 if !fuzzy_pidofs(qr/\b$server\b/);
+ $nb++ if xf86misc::main::Xtest($wanted_DISPLAY);
+ if ($nb > 2) { #- one succeeded test is not enough :-(
+ log::l("AFAIK X server is up");
+ return 1;
+ }
+ time() - $start_time < 60 or last;
+ time() - $start_time > 8 and print N("Xorg server is slow to start. Please wait..."), "\n";
+ sleep 1;
+ }
+ log::l("Timeout!!");
+ 0;
+}
+
#- if we success to start X in 640x480 using driver "vesa",
#- we configure to use fb on installed system (to ensure splashy works)
#- (useful on 800x480 netbooks)