summaryrefslogtreecommitdiffstats
path: root/perl-install/install_steps_gtk.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2003-02-02 12:59:12 +0000
committerPascal Rigaux <pixel@mandriva.com>2003-02-02 12:59:12 +0000
commitb141dd78aa3498f8f492e678ed80355a1c5e9103 (patch)
tree0c0843d58c834d2202b47141d3b9e002981d72ee /perl-install/install_steps_gtk.pm
parent919291c6a9b02174dd43e76325013a52ac47de7a (diff)
downloaddrakx-b141dd78aa3498f8f492e678ed80355a1c5e9103.tar
drakx-b141dd78aa3498f8f492e678ed80355a1c5e9103.tar.gz
drakx-b141dd78aa3498f8f492e678ed80355a1c5e9103.tar.bz2
drakx-b141dd78aa3498f8f492e678ed80355a1c5e9103.tar.xz
drakx-b141dd78aa3498f8f492e678ed80355a1c5e9103.zip
- add Xnest feature when testing
- cleanup and re-indent
Diffstat (limited to 'perl-install/install_steps_gtk.pm')
-rw-r--r--perl-install/install_steps_gtk.pm141
1 files changed, 79 insertions, 62 deletions
diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm
index 7098756b2..aef7ab91a 100644
--- a/perl-install/install_steps_gtk.pm
+++ b/perl-install/install_steps_gtk.pm
@@ -32,75 +32,92 @@ sub new($$) {
$SIG{__DIE__} = sub { $_[0] !~ /ugtk2\.pm/ and goto $old };
$ENV{DISPLAY} ||= $o->{display} || ":0";
- unless ($::testing) {
- if ($ENV{DISPLAY} eq ":0" && !$::live) {
- my $f = "/tmp/Xconf";
+ my $wanted_DISPLAY = $::testing && -x '/usr/X11R6/bin/Xnest' ? ':1' : $ENV{DISPLAY};
+
+ if ($ENV{DISPLAY} =~ /^:\d/ || $ENV{DISPLAY} ne $wanted_DISPLAY) { #- is the display local or distant?
+ my $f = "/tmp/Xconf";
+ if (!$::testing) {
install_gtk::createXconf($f, @{$o->{mouse}}{"XMOUSETYPE", "device"}, $o->{mouse}{wacom}[0]);
devices::make("/dev/kbd");
-
- my $launchX = sub {
- my $ok = 1;
- my $xpmac_opts = cat_("/proc/cmdline");
- unless (-d "/var/log") { mkdir("/var/log") }
- local $SIG{CHLD} = sub { $ok = 0 if waitpid(-1, c::WNOHANG()) > 0 };
- unless (fork()) {
- exec $_[0], if_(arch() !~ /^sparc/ && arch() ne "ppc", "-kb"), 'tty7', "-dpms", "-s", "240",
- ($_[0] =~ /Xpmac/ ? $xpmac_opts !~ /ofonly/ ? ("-mode", "17", "-depth", "32") : "-mach64" : ()),
- ($_[0] =~ /Xsun/ || $_[0] =~ /Xpmac/ ? ("-fp", "/usr/X11R6/lib/X11/fonts:unscaled") :
- ("-allowMouseOpenFail", "-xf86config", $f)) or exit 1;
- }
- foreach (1..60) {
- sleep 1;
- log::l("Server died"), return 0 if !$ok;
- if (c::Xtest($ENV{DISPLAY})) {
- fork() || exec("aewm-drakx") || exec("true");
- return 1;
- }
- }
- log::l("Timeout!!");
- 0;
- };
- my @servers = qw(FBDev VGA16); #-)
- if (arch() eq "alpha") {
- require Xconfig::card;
- my ($card) = Xconfig::card::probe();
- Xconfig::card::add_to_card__using_Cards($card, $card->{type}) if $card && $card->{type};
- @servers = $card->{server} || "TGA";
- #-@servers = qw(SVGA 3DLabs TGA)
- } elsif (arch() =~ /^sparc/) {
- local $_ = cat_("/proc/fb");
- if (/Mach64/) { @servers = qw(Mach64) }
- elsif (/Permedia2/) { @servers = qw(3DLabs) }
- else { @servers = qw(Xsun24) }
- } elsif (arch() =~ /ia64/) {
- @servers = 'XFree86';
- } elsif (arch() eq "ppc") {
- @servers = qw(Xpmac);
- }
-
- foreach (@servers) {
- log::l("Trying with server $_");
- my $dir = "/usr/X11R6/bin";
- my $prog = /Xsun|Xpmac|XFree86/ ? $_ : "XF86_$_";
- unless (-x "$dir/$prog") {
- unlink $_ foreach glob_("$dir/X*");
- install_any::getAndSaveFile("Mandrake/mdkinst$dir/$prog", "$dir/$prog") or die "failed to get server $prog: $!";
- chmod 0755, "$dir/$prog";
- }
- if (/FB/) {
- !$o->{vga16} && $o->{allowFB} or next;
-
- $o->{allowFB} = &$launchX($prog) #- keep in mind FB is used.
- and goto OK;
- } else {
- $o->{vga16} = 1 if /VGA16/;
- &$launchX($prog) and goto OK;
+ }
+ my $launchX = sub {
+ my ($server) = @_;
+ my $ok = 1;
+ my $xpmac_opts = cat_('/proc/cmdline');
+ mkdir '/var/log' if !-d '/var/log';
+ local $SIG{CHLD} = sub { $ok = 0 if waitpid(-1, c::WNOHANG()) > 0 };
+
+ my @options = (
+ if_(arch() !~ /^sparc/ && arch() ne 'ppc' && $server ne 'Xnest',
+ '-kb', '-allowMouseOpenFail', '-xf86config', $f),
+ ($wanted_DISPLAY, 'tty7', '-dpms', '-s', '240'),
+ );
+
+ push @options, $xpmac_opts !~ /ofonly/ ? ('-mode', '17', '-depth', '32') : '-mach64' if $server =~ /Xpmac/;
+ push @options, '-fp', '/usr/X11R6/lib/X11/fonts:unscaled' if $server =~ /Xsun|Xpmac/;
+ push @options, '-geometry', '800x600' if $server eq 'Xnest';
+
+ unless (fork()) {
+ exec $server, @options or exit 1;
+ }
+ foreach (1..60) {
+ sleep 1;
+ log::l("Server died"), return 0 if !$ok;
+ if (c::Xtest($wanted_DISPLAY)) {
+ fork() || exec("aewm-drakx") || exec("true");
+ return 1;
}
}
- return undef;
+ log::l("Timeout!!");
+ 0;
+ };
+ my @servers = qw(FBDev VGA16); #-)
+ if ($::testing) {
+ @servers = 'Xnest';
+ } elsif (arch() eq "alpha") {
+ require Xconfig::card;
+ my ($card) = Xconfig::card::probe();
+ Xconfig::card::add_to_card__using_Cards($card, $card->{type}) if $card && $card->{type};
+ @servers = $card->{server} || "TGA";
+ #-@servers = qw(SVGA 3DLabs TGA)
+ } elsif (arch() =~ /^sparc/) {
+ local $_ = cat_("/proc/fb");
+ if (/Mach64/) {
+ @servers = qw(Mach64);
+ } elsif (/Permedia2/) {
+ @servers = qw(3DLabs);
+ } else {
+ @servers = qw(Xsun24);
+ }
+ } elsif (arch() =~ /ia64/) {
+ @servers = 'XFree86';
+ } elsif (arch() eq "ppc") {
+ @servers = qw(Xpmac);
+ }
+
+ foreach (@servers) {
+ log::l("Trying with server $_");
+ my $dir = "/usr/X11R6/bin";
+ my $prog = /Xsun|Xpmac|XFree86|Xnest/ ? $_ : "XF86_$_";
+ unless (-x "$dir/$prog") {
+ unlink $_ foreach glob_("$dir/X*");
+ install_any::getAndSaveFile("Mandrake/mdkinst$dir/$prog", "$dir/$prog") or die "failed to get server $prog: $!";
+ chmod 0755, "$dir/$prog";
+ }
+ if (/FB/) {
+ !$o->{vga16} && $o->{allowFB} or next;
+
+ $o->{allowFB} = &$launchX($prog) #- keep in mind FB is used.
+ and goto OK;
+ } else {
+ $o->{vga16} = 1 if /VGA16/;
+ &$launchX($prog) and goto OK;
+ }
}
+ return undef;
}
OK:
+ $ENV{DISPLAY} = $wanted_DISPLAY;
install_gtk::init_gtk();
install_gtk::init_sizes();
install_gtk::install_theme($o, install_gtk::default_theme($o));