summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>1999-07-29 15:18:54 +0000
committerPascal Rigaux <pixel@mandriva.com>1999-07-29 15:18:54 +0000
commit88a07c82cece62903ae68e1e2c482d810bbf8560 (patch)
tree5eee08b842d20f111fc82bba2e42425e253e8a50
parent5dc2835bfbf1f53ad51ba540f4423c22cc94b26c (diff)
downloaddrakx-88a07c82cece62903ae68e1e2c482d810bbf8560.tar
drakx-88a07c82cece62903ae68e1e2c482d810bbf8560.tar.gz
drakx-88a07c82cece62903ae68e1e2c482d810bbf8560.tar.bz2
drakx-88a07c82cece62903ae68e1e2c482d810bbf8560.tar.xz
drakx-88a07c82cece62903ae68e1e2c482d810bbf8560.zip
no_comment
-rw-r--r--docs/diskdrake.TODO14
-rw-r--r--docs/object_class.fig32
-rw-r--r--perl-install/Makefile5
-rw-r--r--perl-install/Xconfigurator.pm450
-rw-r--r--perl-install/Xconfigurator_consts.pm553
-rw-r--r--perl-install/common.pm31
-rw-r--r--perl-install/detect_devices.pm4
-rw-r--r--perl-install/install2.pm19
-rw-r--r--perl-install/install_any.pm3
-rw-r--r--perl-install/install_steps.pm4
-rw-r--r--perl-install/install_steps_stdio.pm148
-rw-r--r--perl-install/interactive.pm53
-rw-r--r--perl-install/interactive_gtk.pm37
-rw-r--r--perl-install/interactive_stdio.pm80
-rw-r--r--perl-install/keyboard.pm2
-rw-r--r--perl-install/log.pm4
-rw-r--r--perl-install/my_gtk.pm38
-rw-r--r--perl-install/partition_table.pm1
-rw-r--r--perl-install/partition_table_raw.pm4
-rw-r--r--perl-install/pkgs.pm24
-rw-r--r--perl-install/resize_fat/fat.pm2
-rw-r--r--perl-install/resize_fat/io.pm2
-rw-r--r--perl-install/share/diskdrake.rc2
23 files changed, 1316 insertions, 196 deletions
diff --git a/docs/diskdrake.TODO b/docs/diskdrake.TODO
new file mode 100644
index 000000000..097789747
--- /dev/null
+++ b/docs/diskdrake.TODO
@@ -0,0 +1,14 @@
+text version
+
+save/restore partitions in a file
+
+display the information about the correspondance color2type
+
+have ``undo''
+
+handle the `luke' case (main extended partition must be extended)
+
+ajouter une verif apres fdiskReadPartitionTable pour s'assurer qu'on se
+trompe pas sur la facon de calculer le start_cyl, end_cyl...
+Pas possible de le faire dans fdiskReadPartitionTable car start est relatif dans les etendues
+
diff --git a/docs/object_class.fig b/docs/object_class.fig
new file mode 100644
index 000000000..0c9ffaff5
--- /dev/null
+++ b/docs/object_class.fig
@@ -0,0 +1,32 @@
+#FIG 3.2
+Landscape
+Center
+Inches
+Letter
+100.00
+Single
+-2
+1200 2
+2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
+ 2625 1200 2625 1725
+2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
+ 7575 1125 7575 1650
+2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
+ 7575 2100 4350 3225
+2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
+ 5025 2025 4350 3225
+2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
+ 2625 2100 4350 3225
+2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
+ 5025 2025 6075 4125
+2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
+ 2625 1200 4950 1725
+2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 0 0 2
+ 7575 1125 4950 1725
+4 0 0 100 0 0 12 0.0000 4 180 1755 1800 1050 install_steps_graphical\001
+4 0 0 100 0 0 12 0.0000 4 180 1440 6900 975 install_steps_stdio\001
+4 0 0 100 0 0 12 0.0000 4 180 1140 2100 1950 interactive_gtk\001
+4 0 0 100 0 0 12 0.0000 4 180 1275 6900 1950 interactive_stdio\001
+4 0 0 100 0 0 12 0.0000 4 180 1875 4125 1950 install_steps_interactive\001
+4 0 0 100 0 0 12 0.0000 4 135 810 3975 3450 interactive\001
+4 0 0 100 0 0 12 0.0000 4 180 975 5625 4350 install_steps\001
diff --git a/perl-install/Makefile b/perl-install/Makefile
index 3eaafc310..30ea0be7f 100644
--- a/perl-install/Makefile
+++ b/perl-install/Makefile
@@ -52,7 +52,7 @@ verify_c:
./verify_c $(PMS)
gendepslist: %: %.cc
- $(CXX) -I/usr/include/rpm $(CFLAGS) $< -lrpm -ldb -lz -o $@
+ $(CXX) -I/usr/include/rpm $(CFLAGS) $< -lrpm -ldb1 -lz -o $@
depslist: gendepslist
./gendepslist $(ROOTDEST)/Mandrake/base/depslist /tmp/rhimage/Mandrake/RPMS/*.rpm
@@ -88,6 +88,7 @@ get_needed_files: $(SO_FILES)
install -d $(DEST)/usr/bin
install -d $(DEST)/usr/lib
install -d $(DEST)/usr/share
+ install -d $(ROOTDEST)/Mandrake/base
install -s $(LOCALFILES) $(DEST)/usr/bin
for i in `cat /tmp/list`; do \
@@ -138,7 +139,7 @@ full_stage2:
stage2:
$(MAKE) install_pms
cd $(ROOTDEST) ; tar cfz /tmp/instimage-full.tgz Mandrake
- cd $(ROOTDEST) ; tar cfz /tmp/instimage-light.tgz Mandrake/base/depslist Mandrake/instimage/usr/[bl]*
+ cd $(ROOTDEST) ; tar cfz /tmp/instimage-light.tgz Mandrake/base/compss Mandrake/instimage/usr/[bl]*
@#rm -rf /mnt/initrd/*
@#cp -a $(DEST)/* /mnt/initrd
diff --git a/perl-install/Xconfigurator.pm b/perl-install/Xconfigurator.pm
new file mode 100644
index 000000000..9749884d2
--- /dev/null
+++ b/perl-install/Xconfigurator.pm
@@ -0,0 +1,450 @@
+package Xconfigurator;
+
+use diagnostics;
+use strict;
+use vars qw($in $resolution_wanted @depths @resolutions @accelservers @allservers %videomemory @ramdac_name @ramdac_id @clockchip_name @clockchip_id %keymap_translate @vsync_range %standard_monitors $intro_text $finalcomment_text $s3_comment $cirrus_comment $probeonlywarning_text $monitorintro_text $hsyncintro_text $vsyncintro_text $XF86firstchunk_text $keyboardsection_start $keyboardsection_part2 $keyboardsection_end $pointersection_text1 $pointersection_text2 $monitorsection_text1 $monitorsection_text2 $monitorsection_text3 $monitorsection_text4 $modelines_text_Trident_TG_96xx $modelines_text $devicesection_text $screensection_text1);
+
+use pci_probing::main;
+use common qw(:common :file);
+use log;
+
+use Xconfigurator_consts;
+
+1;
+
+sub setVirtual($) {
+ my $vt = '';
+ local *C;
+ sysopen C, "/dev/console", 2 or die "failed to open /dev/console: $!";
+ ioctl(C, c::VT_GETSTATE(), $vt) or die "ioctl VT_GETSTATE failed";
+ ioctl(C, c::VT_ACTIVATE(), $_[0]) or die "ioctl VT_ACTIVATE failed";
+ ioctl(C, c::VT_WAITACTIVE(), $_[0]) or die "ioctl VT_WAITACTIVE failed";
+ unpack "S", $vt;
+}
+
+sub readCardsDB {
+ my ($file) = @_;
+ my ($card, %cards);
+
+ local *F;
+ open F, $file or die "file $file not found";
+
+ my $lineno = 0; foreach (<F>) { $lineno++;
+ s/\s+$//;
+ /^#/ and next;
+ /^$/ and next;
+ /^END/ and last;
+
+ my ($cmd, $val) = /(\S+)\s*(.*)/ or log::l("bad line $lineno ($_)"), next;
+
+ my $f = $ {{
+ LINE => sub { push @{$card->{lines}}, $val unless $val eq "VideoRam" },
+ NAME => sub {
+ $cards{$card->{type}} = $card if $card;
+ $card = { type => $val };
+ },
+ SEE => sub {
+ my $c = $cards{$val} or die "Error in database, invalid reference $val at line $lineno";
+
+ push @{$card->{lines}}, @{$c->{lines} || []};
+ add2hash($card->{flags}, $c->{flags});
+ add2hash($card, $c);
+ },
+ CHIPSET => sub { $card->{chipset} = $val;
+ $card->{flags}->{needVideoRam} if member($val, qw(RIVA128));
+ },
+ SERVER => sub { $card->{server} = $val; },
+ RAMDAC => sub { $card->{ramdac} = $val; },
+ DACSPEED => sub { $card->{dacspeed} = $val; },
+ CLOCKCHIP => sub { $card->{clockchip} = $val; $card->{flags}->{noclockprobe} = 1; },
+ NOCLOCKPROBE => sub { $card->{flags}->{noclockprobe} = 1 },
+ UNSUPPORTED => sub { $card->{flags}->{unsupported} = 1 },
+ }}{$cmd};
+
+ $f ? &$f() : log::l("unknown line $lineno ($_)");
+ }
+ push @{$cards{S3}->{lines}}, $s3_comment;
+ push @{$cards{'CL-GD'}->{lines}}, $cirrus_comment;
+
+ # this entry is broken in X11R6 cards db
+ $cards{I128}->{flags}->{noclockprobe} = 1;
+
+ %cards;
+}
+
+sub readMonitorsDB {
+ my ($file) = @_;
+ my %monitors;
+
+ local *F;
+ open F, $file or die "can't open monitors database ($file): ?!";
+ my $lineno = 0; foreach (<F>) {
+ $lineno++;
+ s/\s+$//;
+ /^#/ and next;
+ /^$/ and next;
+
+ my @fields = qw(type bandwidth hsyncrange vsyncrange);
+ my @l = split /\s*;\s*/;
+ @l == @fields or log::l("bad line $lineno ($_)"), next;
+
+ my %l; @l{@fields} = @l;
+ $monitors{$l{type}} = \%l;
+ }
+ while (my ($k, $v) = each %standard_monitors) {
+ $monitors{$k} =
+ $monitors{$v->[0]} =
+ { hsyncrange => $v->[1], vsyncrange => $v->[2] };
+ }
+ %monitors;
+}
+
+sub rewriteInittab {
+ my ($runlevel) = @_;
+ {
+ local (*F, *G);
+ open F, "/etc/inittab" or die "cannot open /etc/inittab: $!";
+ open G, "> /etc/inittab-" or die "cannot write in /etc/inittab-: $!";
+
+ foreach (<F>) {
+ print G /^id:/ ? "id:$runlevel:initdefault:\n" : $_;
+ }
+ }
+ unlink("/etc/inittab");
+ rename("/etc/inittab-", "/etc/inittab");
+}
+
+sub findLegalModes {
+ my ($card) = @_;
+ my $mem = $card->{memory} || 1000000;
+
+ foreach (@resolutions) {
+ my ($h, $v) = split 'x';
+
+ foreach $_ (@depths) {
+ push @{$card->{depth}->{$_}}, [ $h, $v ] if 1024 * $mem >= $h * $v * $_ / 8;
+ }
+ }
+}
+
+sub cardConfigurationAuto() {
+ my $card;
+ if (my ($c) = pci_probing::main::probe('video')) {
+ local $_;
+ ($card->{identifier}, $_) = @$c;
+ $card->{type} = $1 if /Card:(.*)/;
+ $card->{server} = $1 if /Server:(.*)/;
+ }
+ $card;
+}
+
+sub cardConfiguration(;$) {
+ my $card = shift || {};
+
+ my %cards = readCardsDB("/usr/X11R6/lib/X11/Cards");
+
+ add2hash($card, cardConfigurationAuto()) unless $card->{type} || $card->{server} || $::expert;
+ add2hash($card, { type => $in->ask_from_list('', _("Choose a graphic card"), [keys %cards]) }) unless $card->{type} || $card->{server};
+ add2hash($card, $cards{$card->{type}}) if $card->{type};
+ add2hash($card, { vendor => "Unknown", board => "Unknown" });
+ $card;
+}
+
+sub monitorConfiguration(;$) {
+ my $monitor = shift || {};
+
+ my %monitors = readMonitorsDB("MonitorsDB");
+
+ add2hash($monitor, { type => $in->ask_from_list('', _("Choose a monitor"), [keys %monitors]) }) unless $monitor->{type};
+ add2hash($monitor, $monitors{$monitor->{type}});
+ add2hash($monitor, { vendor => "Unknown", model => "Unknown" });
+ $monitor;
+}
+
+sub testConfig($) {
+ my ($o) = @_;
+ my ($resolutions, $clocklines);
+
+ write_XF86Config($o, "/tmp/Xconfig");
+
+ local *F;
+ open F, "/etc/X11/X :9 -probeonly -pn -xf86config /tmp/Xconfig 2>&1 |";
+ foreach (<F>) {
+ #$videomemory = $2 if /(videoram|Video RAM):\s*(\d*)/;
+ # look for clocks
+ push @$clocklines, $1 if /clocks: (.*)/ && !/(pixel |num)clocks:/;
+
+ push @$resolutions, [ $1, $2 ] if /: Mode "(\d+)x(\d+)": mode clock/;
+ }
+ close F or die "X probeonly failed";
+
+ ($resolutions, $clocklines);
+}
+
+sub autoResolutions($) {
+ my ($o) = @_;
+ my $card = $o->{card};
+
+ my $hres_wanted = first(split 'x', $o->{resolution_wanted});
+
+ # For the mono and vga16 server, no further configuration is required.
+ return if member($card->{server}, "Mono", "VGA16");
+
+ # Configure the modes order.
+ my ($ok, $best);
+ foreach (@depths) {
+ local $card->{default_depth} = $_;
+
+ my ($resolutions, $clocklines) = eval { testConfig($o) };
+ if ($@) {
+ delete $card->{depth}->{$_};
+ } else {
+ $card->{clocklines} ||= $clocklines unless $card->{flags}->{noclockprobe};
+ $card->{depth}->{$_} = $resolutions;
+
+ $ok ||= $resolutions;
+ my ($b) = sort { $b->[0] <=> $a->[0] } @$resolutions;
+
+ # require $resolution_wanted, no matter what bpp this requires
+ $best = $_ if $b->[0] >= $hres_wanted;
+ }
+ }
+ $ok or die "no valid modes";
+
+ $card->{default_depth} = $best;
+}
+
+
+sub moreCardConfiguration {
+ my ($o) = @_;
+ my $card = $o->{card};
+
+ $card->{vendor} ||= "Unknown";
+ $card->{model} ||= "Unknown";
+
+ unless ($card->{type}) {
+ $card->{flags}->{noclockprobe} = member($card->{server}, qw(I128 S3 S3V Mach64));
+ }
+
+ my $manual;
+ # some of these guys hate to be poked
+ # if we dont know then its at the user's discretion
+ #my $manual =
+ # $card->{server} =~ /^(TGA|Mach32)/ ||
+ # $card->{name} =~ /^Riva 128/ ||
+ # $card->{chipset} =~ /^(RIVA128|mgag)/ ||
+ # $::expert;
+ #
+ #my $unknown =
+ # member($card->{server}, qw(S3 S3V I128 Mach64)) ||
+ # member($card->{type},
+ # "Matrox Millennium (MGA)",
+ # "Matrox Millennium II",
+ # "Matrox Millennium II AGP",
+ # "Matrox Mystique",
+ # "Matrox Mystique",
+ # "S3",
+ # "S3V",
+ # "I128",
+ # ) ||
+ # $card->{type} =~ /S3 ViRGE/;
+ #
+ #$unknown and $manual ||= !$in->ask_okcancel('', [ _("I can try to autodetect information about graphic card, but it may freeze :("),
+ # _("Do you want to try?") ]);
+
+ $card->{flags}->{needVideoRam} and
+ $card->{memory} ||=
+ $videomemory{$in->ask_from_list_('',
+ _("Give your graphic card memory size"),
+ [ sort { $videomemory{$a} <=> $videomemory{$b} }
+ keys %videomemory])};
+
+ findLegalModes($o->{card});
+
+ unless ($manual || $::expert) {
+ # swith to virtual console 1 (hopefully not X :)
+ my $vt = setVirtual(1);
+
+ autoMemoryAndClocksline($o);
+ autoResolutions($o);
+
+ # restore the virtual console
+ setVirtual($vt);
+ }
+}
+
+
+# * Create the XF86Config file.
+sub write_XF86Config {
+ my ($o, $file) = @_;
+ my $O;
+
+ local *F;
+ open F, ">$file" or die "can't write XF86Config in $file: $!";
+
+ print F $XF86firstchunk_text;
+
+ # Write keyboard section.
+ $O = $o->{keyboard};
+ print F $keyboardsection_start;
+
+ print F " RightAlt ", ($O->{altmeta} ? "ModeShift" : "Meta"), "\n";
+ print F $keyboardsection_part2;
+ print F qq( XkbLayout "$O->{xkb_keymap}"\n);
+ print F $keyboardsection_end;
+
+ # Write pointer section.
+ $O = $o->{mouse};
+ print F $pointersection_text1;
+ print F qq( Protocol "$O->{type}"\n);
+ print F qq( Device "$O->{device}"\n);
+ # this will enable the "wheel" or "knob" functionality if the mouse supports it
+ print F " ZAxisMapping 4 5\n" if
+ member($O->{type}, qw(IntelliMouse IMPS/2 ThinkingMousePS/2 NetScrollPS/2 NetMousePS/2 MouseManPlusPS/2));
+
+ print F $pointersection_text2;
+ print F "#" unless $O->{emulate3buttons};
+ print F " Emulate3Buttons\n";
+ print F "#" unless $O->{emulate3buttons};
+ print F " Emulate3Timeout 50\n\n";
+ print F "# ChordMiddle is an option for some 3-button Logitech mice\n\n";
+ print F "#" unless $O->{chordmiddle};
+ print F " ChordMiddle\n\n";
+ print F " ClearDTR\n" if $O->{cleardtrrts};
+ print F " ClearRTS\n\n" if $O->{cleardtrrts};
+ print F "EndSection\n\n\n";
+
+ # Write monitor section.
+ $O = $o->{monitor};
+ print F $monitorsection_text1;
+ print F qq( Identifier "$O->{type}"\n);
+ print F qq( VendorName "$O->{vendor}"\n);
+ print F qq( ModelName "$O->{model}"\n);
+ print F "\n";
+ print F $monitorsection_text2;
+ print F qq( HorizSync $O->{hsyncrange}\n);
+ print F "\n";
+ print F $monitorsection_text3;
+ print F qq( VertRefresh $O->{vsyncrange}\n);
+ print F "\n";
+ print F $monitorsection_text4;
+ print F ($o->{card}->{type} eq "TG 96" ?
+ $modelines_text_Trident_TG_96xx :
+ $modelines_text);
+ print F "EndSection\n\n\n";
+
+ # Write Device section.
+ $O = $o->{card};
+ print F $devicesection_text;
+ print F qq(Section "Device"\n);
+ print F qq( Identifier "$O->{type}"\n);
+ print F qq( VendorName "$O->{vendor}"\n);
+ print F qq( BoardName "$O->{board}"\n);
+
+ print F "#" if $O->{memory} && !$O->{flags}->{needVideoRam};
+ print F " VideoRam $O->{memory}\n" if $O->{memory};
+
+ print F map { " $_\n" } @{$O->{lines}};
+
+ print F qq( Ramdac "$O->{ramdac}"\n) if $O->{ramdac};
+ print F qq( Dacspeed "$O->{dacspeed}"\n) if $O->{dacspeed};
+
+ if ($O->{clockchip}) {
+ print F qq( Clockchip "$O->{clockchip}"\n);
+ } else {
+ print F " # Clock lines\n";
+ print F " Clocks $_\n" foreach (@{$O->{clocklines}});
+ }
+ print F "EndSection\n\n\n";
+
+ # Write Screen sections.
+ print F $screensection_text1;
+
+ my $screen = sub {
+ my ($server, $defdepth, $device, $depths) = @_;
+ print F qq(
+
+Section "Screen"
+ Driver "$server"
+ Device "$device"
+ Monitor "$o->{monitor}->{type}"
+);
+ print F " DefaultColorDepth $defdepth\n" if $defdepth;
+
+ foreach (sort { $a <=> $b } keys %$depths) {
+ my $m = join(" ",
+ map { '"' . join("x", @$_) . '"' }
+ sort { $b->[0] <=> $a->[0] } @{$depths->{$_}});
+ print F qq( Subsection "Display"\n);
+ print F qq( Depth $_\n) if $_;
+ print F qq( Modes $m\n);
+ print F qq( ViewPort 0 0\n);
+ print F qq( EndSubsection\n);
+ }
+ print F "EndSection\n";
+ };
+
+ # SVGA screen section.
+ print F qq(
+# The Colour SVGA server
+);
+
+ if ($O->{server} eq 'SVGA') {
+ &$screen("svga", $O->{default_depth}, $O->{type}, $O->{depth});
+ } else {
+ &$screen("svga", '', "Generic VGA", { 8 => [[ 320, 200 ]] });
+ }
+
+ &$screen("vga16", '',
+ (member($O->{server}, "Mono", "VGA16") ? $O->{type} : "Generic VGA"),
+ { '' => [[ 640, 480 ], [ 800, 600 ]]});
+
+ &$screen("vga2", '',
+ (member($O->{server}, "Mono", "VGA16") ? $O->{type} : "Generic VGA"),
+ { '' => [[ 640, 480 ], [ 800, 600 ]]});
+
+ &$screen("accel", $O->{default_depth}, $O->{type}, $O->{depth});
+}
+
+sub XF86check_link {
+ my ($void) = @_;
+
+ my $f = "/etc/X11/XF86Config";
+ touch($f);
+
+ my $l = "/usr/X11R6/lib/X11/XF86Config";
+
+ if (-e $l && (stat($f))[1] != (stat($l))[1]) { # compare the inode, must be the sames
+ -e $l and unlink($l) || die "can't remove bad $l";
+ symlink "../../../../etc/X11/XF86Config", $l;
+ }
+}
+
+# * Program entry point.
+sub main {
+ my ($default, $interact) = @_;
+ my $o = $default;
+ $in = $interact;
+
+ $o->{resolution_wanted} ||= $resolution_wanted;
+
+ XF86check_link();
+
+ $o->{card} = cardConfiguration($o->{card});
+
+ unless ($::testing) {
+ my $prog = "/usr/X11R6/bin/XF86_$o->{card}->{server}";
+ -x $prog or die "server $o->{card}->{server} is not available (should be in $prog)";
+ unlink("/etc/X11/X");
+ symlink("../../$prog", "/etc/X11/X");
+ }
+
+ $o->{monitor} = monitorConfiguration($o->{monitor});
+
+ moreCardConfiguration($o);
+
+ write_XF86Config($o, "/tmp/Xconfig");
+
+ # Success
+ rewriteInittab(rc & STARTX ? 5 : 3);
+}
diff --git a/perl-install/Xconfigurator_consts.pm b/perl-install/Xconfigurator_consts.pm
new file mode 100644
index 000000000..976f65d9e
--- /dev/null
+++ b/perl-install/Xconfigurator_consts.pm
@@ -0,0 +1,553 @@
+use common qw(:common);
+
+%keymap_translate = (
+ uk => "gb",
+);
+
+@depths = qw(8 15 16 24 32);
+
+$resolution_wanted = "1024x768";
+@resolutions = qw(640x480 800x600 1024x768 1152x864 1280x1024 1600x1200);
+
+
+@accelservers = qw(S3 Mach32 Mach8 8514 P9000 AGX W32 Mach64 I128 S3V 3DLabs);
+@allservers = (qw(Mono VGA16 SVGA), @accelservers);
+
+%videomemory = (
+ __("256 kb") => 256,
+ __("512 kb") => 512,
+ __("1 mb") => 1024,
+ __("2 mb") => 2048,
+ __("4 mb") => 4096,
+ __("8 mb") => 8192,
+ __("16 mb or more") => 16384,
+);
+
+%standard_monitors = (
+ __("Standard VGA, 640x480 in 60 Hz") => [ '640x480@60', "31.5" , "60" ],
+ __("Super VGA, 800x600 in 56 Hz") => [ '800x600@56', "31.5-35.1" , "55-60" ],
+ __("8514 Compatible, 1024x768 in 87 Hz interlaced (no 800x600)") => [ '8514 compatible', "31.5,35.5" , "60,70,87" ],
+ __("Super VGA, 1024x768 in 87 Hz interlaced, 800x600 in 56 Hz") => [ '1024x768@87i', "31.5,35.15,35.5" , "55-90" ],
+ __("Extended Super VGA, 800x600 in 60 Hz, 640x480 in 72 Hz") => [ '800x600@60', "31.5-37.9" , "55-90" ],
+ __("Non-Interlaced SVGA, 1024x768 in 60 Hz, 800x600 in 72 Hz") => [ '1024x768@60', "31.5-48.5" , "55-90" ],
+ __("High Frequency SVGA, 1024x768 in 70 Hz") => [ '1024x768@70', "31.5-57.0" , "50-90" ],
+ __("Multi-frequency that can do 1280x1024 in 60 Hz") => [ '1280x1024@60', "31.5-64.3" , "50-90" ],
+ __("Multi-frequency that can do 1280x1024 in 74 Hz") => [ '1280x1024@74', "31.5-79.0" , "50-100" ],
+ __("Multi-frequency that can do 1280x1024 in 76 Hz") => [ '1280x1024@76', "31.5-82.0" , "40-100" ],
+ __("Monitor that can do 1600x1200 in 70 Hz") => [ '1600x1200@70', "31.5-88.0" , "50-120" ],
+ __("Monitor that can do 1600x1200 in 76 Hz") => [ '1600x1200@76', "31.5-94.0" , "50-160" ],
+);
+
+# * Screen/video card configuration.
+%ramdacs = (
+ __("No RAMDAC Setting (recommended)") => '',
+ __("AT&T 20C490 (S3 and AGX servers, ARK driver)"), => 'att20c490',
+ __("AT&T 20C498/21C498/22C498 (S3, autodetected)"), => 'att20c498',
+ __("AT&T 20C409/20C499 (S3, autodetected)"), => 'att20c409',
+ __("AT&T 20C505 (S3)"), => 'att20c505',
+ __("BrookTree BT481 (AGX)"), => 'bt481',
+ __("BrookTree BT482 (AGX)"), => 'bt482',
+ __("BrookTree BT485/9485 (S3)"), => 'bt485',
+ __("Sierra SC15025 (S3, AGX)"), => 'sc15025',
+ __("S3 GenDAC (86C708) (autodetected)"), => 's3gendac',
+ __("S3 SDAC (86C716) (autodetected)"), => 's3_sdac',
+ __("STG-1700 (S3, autodetected)"), => 'stg1700',
+ __("STG-1703 (S3, autodetected)"), => 'stg1703',
+ __("TI 3020 (S3)"), => 'ti3020',
+ __("TI 3025 (S3, autodetected)"), => 'ti3025',
+ __("TI 3026 (S3, autodetected)"), => 'ti3026',
+ __("IBM RGB 514 (S3, autodetected)"), => 'ibm_rgb514',
+ __("IBM RGB 524 (S3, autodetected)"), => 'ibm_rgb524',
+ __("IBM RGB 525 (S3, autodetected)"), => 'ibm_rgb525',
+ __("IBM RGB 526 (S3)"), => 'ibm_rgb526',
+ __("IBM RGB 528 (S3, autodetected)"), => 'ibm_rgb528',
+ __("ICS5342 (S3, ARK)"), => 'ics5342',
+ __("ICS5341 (W32)"), => 'ics5341',
+ __("IC Works w30C516 ZoomDac (ARK)"), => 'zoomdac',
+ __("Normal DAC"), => 'normal',
+);
+
+@clockchip_name = (
+ __("No Clockchip Setting (recommended)") => '',
+ __("Chrontel 8391") => 'ch8391',
+ __("ICD2061A and compatibles (ICS9161A => DCS2824)") => 'icd2061a',
+ __("ICS2595") => 'ics2595',
+ __("ICS5342 (similar to SDAC, but not completely compatible)") => 'ics5342',
+ __("ICS5341") => 'ics5341',
+ __("S3 GenDAC (86C708) and ICS5300 (autodetected)") => 's3gendac',
+ __("S3 SDAC (86C716)") => 's3_sdac',
+ __("STG 1703 (autodetected)") => 'stg1703',
+ __("Sierra SC11412") => 'sc11412',
+ __("TI 3025 (autodetected)") => 'ti3025',
+ __("TI 3026 (autodetected)") => 'ti3026',
+ __("IBM RGB 51x/52x (autodetected)") => 'ibm_rgb5xx',
+);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+$intro_text = "
+This program will create a basic XF86Config file, based on menu selections you make.
+
+The XF86Config file usually resides in /usr/X11R6/lib/X11 or /etc/X11. A
+sample XF86Config file is supplied with XFree86; it is configured for a
+standard VGA card and monitor with 640x480 resolution.
+
+You can either take the sample XF86Config as a base and edit it for your
+configuration, or let this program produce a base XF86Config file for your
+configuration and fine-tune it. Refer to /usr/X11R6/lib/X11/doc/README.Config
+for a detailed overview of the configuration process.
+
+For accelerated servers (including accelerated drivers in the SVGA server),
+there are many chipset and card-specific options and settings. This program
+does not know about these. On some configurations some of these settings must
+be specified. Refer to the server man pages and chipset-specific READMEs.
+
+Before continuing with this program, make sure you know the chipset and
+amount of video memory on your video card. SuperProbe can help with this.
+It is also helpful if you know what server you want to run.";
+
+$finalcomment_text = "
+configuration file has been written. Take a look at it before running 'startx'.
+Note that the XF86Config file must be in one of the directories searched by the
+server (e.g. /etc/X11/XF86Config) in order to be used. Within the server press
+ctrl, alt and '+' simultaneously to cycle video resolutions. Pressing ctrl, alt
+and backspace simultaneously immediately exits the server (use if the monitor
+doesn't sync for a particular mode).
+
+For further configuration, refer to /usr/X11R6/lib/X11/doc/README.Config.
+";
+
+$s3_comment = '
+# Use Option "nolinear" if the server doesn\'t start up correctly
+# (this avoids the linear framebuffer probe). If that fails try
+# option \"nomemaccess\".
+#
+# Refer to /usr/X11R6/lib/doc/README.S3, and the XF86_S3 man page.
+';
+
+$cirrus_comment = '
+# Use Option \"no_bitblt\" if you have graphics problems. If that fails
+# try Option \"noaccel\".
+# Refer to /usr/X11R6/lib/doc/README.cirrus.
+# To allow linear addressing, uncomment the Option line and the
+# address that the card maps the framebuffer to.
+';
+
+$probeonlywarning_text = '
+It is possible that the hardware detection routines in the server some how
+cause the system to crash and the screen to remain blank. If this is the
+case, skip this step the next time. The server may need a
+Ramdac, ClockChip or special option (e.g. "nolinear" for S3) to probe
+and start-up correctly.
+';
+
+$monitorintro_text = __('
+Now we want to set the specifications of the monitor. The two critical
+parameters are the vertical refresh rate, which is the rate at which the
+the whole screen is refreshed, and most importantly the horizontal sync rate,
+which is the rate at which scanlines are displayed.
+
+The valid range for horizontal sync and vertical sync should be documented
+in the manual of your monitor. If in doubt, check the monitor database
+/usr/X11R6/lib/X11/doc/Monitors to see if your monitor is there.
+');
+
+$hsyncintro_text = __('
+You must indicate the horizontal sync range of your monitor. You can either
+select one of the predefined ranges below that correspond to industry-
+standard monitor types, or give a specific range.
+
+It is VERY IMPORTANT that you do not specify a monitor type with a horizontal
+sync range that is beyond the capabilities of your monitor. If in doubt,
+choose a conservative setting.
+');
+
+$vsyncintro_text = __('
+You must indicate the vertical sync range of your monitor. You can either
+select one of the predefined ranges below that correspond to industry-
+standard monitor types, or give a specific range. For interlaced modes,
+the number that counts is the high one (e.g. 87 Hz rather than 43 Hz).
+');
+
+$XF86firstchunk_text = '
+# File generated by XConfigurator.
+
+# **********************************************************************
+# Refer to the XF86Config(4/5) man page for details about the format of
+# this file.
+# **********************************************************************
+
+# **********************************************************************
+# Files section. This allows default font and rgb paths to be set
+# **********************************************************************
+
+Section "Files"
+
+# The location of the RGB database. Note, this is the name of the
+# file minus the extension (like ".txt" or ".db"). There is normally
+# no need to change the default.
+
+ RgbPath "/usr/X11R6/lib/X11/rgb"
+
+# Multiple FontPath entries are allowed (they are concatenated together)
+# By default, Red Hat 6.0 and later now use a font server independent of
+# the X server to render fonts.
+
+ FontPath "unix/:-1"
+
+EndSection
+
+# **********************************************************************
+# Server flags section.
+# **********************************************************************
+
+Section "ServerFlags"
+
+ # Uncomment this to cause a core dump at the spot where a signal is
+ # received. This may leave the console in an unusable state, but may
+ # provide a better stack trace in the core dump to aid in debugging
+ #NoTrapSignals
+
+ # Uncomment this to disable the <Crtl><Alt><BS> server abort sequence
+ # This allows clients to receive this key event.
+ #DontZap
+
+ # Uncomment this to disable the <Crtl><Alt><KP_+>/<KP_-> mode switching
+ # sequences. This allows clients to receive these key events.
+ #DontZoom
+
+EndSection
+
+# **********************************************************************
+# Input devices
+# **********************************************************************
+';
+
+$keyboardsection_start = '
+# **********************************************************************
+# Keyboard section
+# **********************************************************************
+
+Section "Keyboard"
+
+ Protocol "Standard"
+
+ # when using XQUEUE, comment out the above line, and uncomment the
+ # following line
+ #Protocol "Xqueue"
+
+ AutoRepeat 500 5
+
+ # Let the server do the NumLock processing. This should only be
+ # required when using pre-R6 clients
+ #ServerNumLock
+
+ # Specify which keyboard LEDs can be user-controlled (eg, with xset(1))
+ #Xleds 1 2 3
+
+ #To set the LeftAlt to Meta, RightAlt key to ModeShift,
+ #RightCtl key to Compose, and ScrollLock key to ModeLock:
+
+ LeftAlt Meta
+';
+
+$keyboardsection_part2 = '
+ ScrollLock Compose
+ RightCtl Control
+
+# To disable the XKEYBOARD extension, uncomment XkbDisable.
+
+# XkbDisable
+
+# To customise the XKB settings to suit your keyboard, modify the
+# lines below (which are the defaults). For example, for a non-U.S.
+# keyboard, you will probably want to use:
+# XkbModel "pc102"
+# If you have a US Microsoft Natural keyboard, you can use:
+# XkbModel "microsoft"
+#
+# Then to change the language, change the Layout setting.
+# For example, a german layout can be obtained with:
+# XkbLayout "de"
+# or:
+# XkbLayout "de"
+# XkbVariant "nodeadkeys"
+#
+# If you\'d like to switch the positions of your capslock and
+# control keys, use:
+# XkbOptions "ctrl:swapcaps"
+
+# These are the default XKB settings for XFree86
+# XkbRules "xfree86"
+# XkbModel "pc101"
+# XkbLayout "us"
+# XkbVariant ""
+# XkbOptions ""
+
+ XkbKeycodes "xfree86"
+ XkbTypes "default"
+ XkbCompat "default"
+ XkbSymbols "us(pc101)"
+ XkbGeometry "pc"
+ XkbRules "xfree86"
+ XkbModel "pc101"
+';
+
+$keyboardsection_end = '
+EndSection
+';
+
+$pointersection_text1 = '
+# **********************************************************************
+# Pointer section
+# **********************************************************************
+
+Section "Pointer"
+';
+
+$pointersection_text2 = '
+
+# When using XQUEUE, comment out the above two lines, and uncomment
+# the following line.
+
+# Protocol "Xqueue"
+
+# Baudrate and SampleRate are only for some Logitech mice
+
+# BaudRate 9600
+# SampleRate 150
+
+# Emulate3Buttons is an option for 2-button Microsoft mice
+# Emulate3Timeout is the timeout in milliseconds (default is 50ms)
+';
+
+$monitorsection_text1 = '
+# **********************************************************************
+# Monitor section
+# **********************************************************************
+
+# Any number of monitor sections may be present
+
+Section "Monitor"
+';
+
+$monitorsection_text2 = '
+# HorizSync is in kHz unless units are specified.
+# HorizSync may be a comma separated list of discrete values, or a
+# comma separated list of ranges of values.
+# NOTE: THE VALUES HERE ARE EXAMPLES ONLY. REFER TO YOUR MONITOR\'S
+# USER MANUAL FOR THE CORRECT NUMBERS.
+';
+
+$monitorsection_text3 = '
+# VertRefresh is in Hz unless units are specified.
+# VertRefresh may be a comma separated list of discrete values, or a
+# comma separated list of ranges of values.
+# NOTE: THE VALUES HERE ARE EXAMPLES ONLY. REFER TO YOUR MONITOR\'S
+# USER MANUAL FOR THE CORRECT NUMBERS.
+';
+
+$monitorsection_text4 = '
+# Modes can be specified in two formats. A compact one-line format, or
+# a multi-line format.
+
+# These two are equivalent
+
+# ModeLine "1024x768i" 45 1024 1048 1208 1264 768 776 784 817 Interlace
+
+# Mode "1024x768i"
+# DotClock 45
+# HTimings 1024 1048 1208 1264
+# VTimings 768 776 784 817
+# Flags "Interlace"
+# EndMode
+';
+
+$modelines_text_Trident_TG_96xx = '
+# This is a set of standard mode timings. Modes that are out of monitor spec
+# are automatically deleted by the server (provided the HorizSync and
+# VertRefresh lines are correct), so there\'s no immediate need to
+# delete mode timings (unless particular mode timings don\'t work on your
+# monitor). With these modes, the best standard mode that your monitor
+# and video card can support for a given resolution is automatically
+# used.
+
+# These are special modelines for Trident Providia 9685. It is for VA Linux
+# systems only.
+# 640x480 @ 72 Hz, 36.5 kHz hsync
+Modeline "640x480" 31.5 640 680 720 864 480 488 491 521
+# 800x600 @ 72 Hz, 48.0 kHz hsync
+Modeline "800x600" 50 800 856 976 1040 600 637 643 666 +hsync +vsync
+# 1024x768 @ 60 Hz, 48.4 kHz hsync
+#Modeline "1024x768" 65 1024 1032 1176 1344 768 771 777 806 -hsync -vsync
+# 1024x768 @ 70 Hz, 56.5 kHz hsync
+Modeline "1024x768" 75 1024 1048 1184 1328 768 771 777 806 -hsync -vsync
+';
+$modelines_text = '
+# This is a set of standard mode timings. Modes that are out of monitor spec
+# are automatically deleted by the server (provided the HorizSync and
+# VertRefresh lines are correct), so there\'s no immediate need to
+# delete mode timings (unless particular mode timings don\'t work on your
+# monitor). With these modes, the best standard mode that your monitor
+# and video card can support for a given resolution is automatically
+# used.
+
+# 640x400 @ 70 Hz, 31.5 kHz hsync
+Modeline "640x400" 25.175 640 664 760 800 400 409 411 450
+# 640x480 @ 60 Hz, 31.5 kHz hsync
+Modeline "640x480" 25.175 640 664 760 800 480 491 493 525
+# 800x600 @ 56 Hz, 35.15 kHz hsync
+ModeLine "800x600" 36 800 824 896 1024 600 601 603 625
+# 1024x768 @ 87 Hz interlaced, 35.5 kHz hsync
+Modeline "1024x768" 44.9 1024 1048 1208 1264 768 776 784 817 Interlace
+
+# 640x400 @ 85 Hz, 37.86 kHz hsync
+Modeline "640x400" 31.5 640 672 736 832 400 401 404 445 -HSync +VSync
+# 640x480 @ 72 Hz, 36.5 kHz hsync
+Modeline "640x480" 31.5 640 680 720 864 480 488 491 521
+# 640x480 @ 75 Hz, 37.50 kHz hsync
+ModeLine "640x480" 31.5 640 656 720 840 480 481 484 500 -HSync -VSync
+# 800x600 @ 60 Hz, 37.8 kHz hsync
+Modeline "800x600" 40 800 840 968 1056 600 601 605 628 +hsync +vsync
+
+# 640x480 @ 85 Hz, 43.27 kHz hsync
+Modeline "640x480" 36 640 696 752 832 480 481 484 509 -HSync -VSync
+# 1152x864 @ 89 Hz interlaced, 44 kHz hsync
+ModeLine "1152x864" 65 1152 1168 1384 1480 864 865 875 985 Interlace
+
+# 800x600 @ 72 Hz, 48.0 kHz hsync
+Modeline "800x600" 50 800 856 976 1040 600 637 643 666 +hsync +vsync
+# 1024x768 @ 60 Hz, 48.4 kHz hsync
+Modeline "1024x768" 65 1024 1032 1176 1344 768 771 777 806 -hsync -vsync
+
+# 640x480 @ 100 Hz, 53.01 kHz hsync
+Modeline "640x480" 45.8 640 672 768 864 480 488 494 530 -HSync -VSync
+# 1152x864 @ 60 Hz, 53.5 kHz hsync
+Modeline "1152x864" 89.9 1152 1216 1472 1680 864 868 876 892 -HSync -VSync
+# 800x600 @ 85 Hz, 55.84 kHz hsync
+Modeline "800x600" 60.75 800 864 928 1088 600 616 621 657 -HSync -VSync
+
+# 1024x768 @ 70 Hz, 56.5 kHz hsync
+Modeline "1024x768" 75 1024 1048 1184 1328 768 771 777 806 -hsync -vsync
+# 1280x1024 @ 87 Hz interlaced, 51 kHz hsync
+Modeline "1280x1024" 80 1280 1296 1512 1568 1024 1025 1037 1165 Interlace
+
+# 800x600 @ 100 Hz, 64.02 kHz hsync
+Modeline "800x600" 69.65 800 864 928 1088 600 604 610 640 -HSync -VSync
+# 1024x768 @ 76 Hz, 62.5 kHz hsync
+Modeline "1024x768" 85 1024 1032 1152 1360 768 784 787 823
+# 1152x864 @ 70 Hz, 62.4 kHz hsync
+Modeline "1152x864" 92 1152 1208 1368 1474 864 865 875 895
+# 1280x1024 @ 61 Hz, 64.2 kHz hsync
+Modeline "1280x1024" 110 1280 1328 1512 1712 1024 1025 1028 1054
+
+# 1024x768 @ 85 Hz, 70.24 kHz hsync
+Modeline "1024x768" 98.9 1024 1056 1216 1408 768 782 788 822 -HSync -VSync
+# 1152x864 @ 78 Hz, 70.8 kHz hsync
+Modeline "1152x864" 110 1152 1240 1324 1552 864 864 876 908
+
+# 1280x1024 @ 70 Hz, 74.59 kHz hsync
+Modeline "1280x1024" 126.5 1280 1312 1472 1696 1024 1032 1040 1068 -HSync -VSync
+# 1600x1200 @ 60Hz, 75.00 kHz hsync
+Modeline "1600x1200" 162 1600 1664 1856 2160 1200 1201 1204 1250 +HSync +VSync
+# 1152x864 @ 84 Hz, 76.0 kHz hsync
+Modeline "1152x864" 135 1152 1464 1592 1776 864 864 876 908
+
+# 1280x1024 @ 74 Hz, 78.85 kHz hsync
+Modeline "1280x1024" 135 1280 1312 1456 1712 1024 1027 1030 1064
+
+# 1024x768 @ 100Hz, 80.21 kHz hsync
+Modeline "1024x768" 115.5 1024 1056 1248 1440 768 771 781 802 -HSync -VSync
+# 1280x1024 @ 76 Hz, 81.13 kHz hsync
+Modeline "1280x1024" 135 1280 1312 1416 1664 1024 1027 1030 1064
+
+# 1600x1200 @ 70 Hz, 87.50 kHz hsync
+Modeline "1600x1200" 189 1600 1664 1856 2160 1200 1201 1204 1250 -HSync -VSync
+# 1152x864 @ 100 Hz, 89.62 kHz hsync
+Modeline "1152x864" 137.65 1152 1184 1312 1536 864 866 885 902 -HSync -VSync
+# 1280x1024 @ 85 Hz, 91.15 kHz hsync
+Modeline "1280x1024" 157.5 1280 1344 1504 1728 1024 1025 1028 1072 +HSync +VSync
+# 1600x1200 @ 75 Hz, 93.75 kHz hsync
+Modeline "1600x1200" 202.5 1600 1664 1856 2160 1200 1201 1204 1250 +HSync +VSync
+# 1600x1200 @ 85 Hz, 105.77 kHz hsync
+Modeline "1600x1200" 220 1600 1616 1808 2080 1200 1204 1207 1244 +HSync +VSync
+# 1280x1024 @ 100 Hz, 107.16 kHz hsync
+Modeline "1280x1024" 181.75 1280 1312 1440 1696 1024 1031 1046 1072 -HSync -VSync
+
+# 1800x1440 @ 64Hz, 96.15 kHz hsync
+ModeLine "1800X1440" 230 1800 1896 2088 2392 1440 1441 1444 1490 +HSync +VSync
+# 1800x1440 @ 70Hz, 104.52 kHz hsync
+ModeLine "1800X1440" 250 1800 1896 2088 2392 1440 1441 1444 1490 +HSync +VSync
+
+# 512x384 @ 78 Hz, 31.50 kHz hsync
+Modeline "512x384" 20.160 512 528 592 640 384 385 388 404 -HSync -VSync
+# 512x384 @ 85 Hz, 34.38 kHz hsync
+Modeline "512x384" 22 512 528 592 640 384 385 388 404 -HSync -VSync
+
+# Low-res Doublescan modes
+# If your chipset does not support doublescan, you get a \'squashed\'
+# resolution like 320x400.
+
+# 320x200 @ 70 Hz, 31.5 kHz hsync, 8:5 aspect ratio
+Modeline "320x200" 12.588 320 336 384 400 200 204 205 225 Doublescan
+# 320x240 @ 60 Hz, 31.5 kHz hsync, 4:3 aspect ratio
+Modeline "320x240" 12.588 320 336 384 400 240 245 246 262 Doublescan
+# 320x240 @ 72 Hz, 36.5 kHz hsync
+Modeline "320x240" 15.750 320 336 384 400 240 244 246 262 Doublescan
+# 400x300 @ 56 Hz, 35.2 kHz hsync, 4:3 aspect ratio
+ModeLine "400x300" 18 400 416 448 512 300 301 302 312 Doublescan
+# 400x300 @ 60 Hz, 37.8 kHz hsync
+Modeline "400x300" 20 400 416 480 528 300 301 303 314 Doublescan
+# 400x300 @ 72 Hz, 48.0 kHz hsync
+Modeline "400x300" 25 400 424 488 520 300 319 322 333 Doublescan
+# 480x300 @ 56 Hz, 35.2 kHz hsync, 8:5 aspect ratio
+ModeLine "480x300" 21.656 480 496 536 616 300 301 302 312 Doublescan
+# 480x300 @ 60 Hz, 37.8 kHz hsync
+Modeline "480x300" 23.890 480 496 576 632 300 301 303 314 Doublescan
+# 480x300 @ 63 Hz, 39.6 kHz hsync
+Modeline "480x300" 25 480 496 576 632 300 301 303 314 Doublescan
+# 480x300 @ 72 Hz, 48.0 kHz hsync
+Modeline "480x300" 29.952 480 504 584 624 300 319 322 333 Doublescan
+
+';
+
+$devicesection_text = '
+# **********************************************************************
+# Graphics device section
+# **********************************************************************
+
+# Any number of graphics device sections may be present
+
+Section "Device"
+ Identifier "Generic VGA"
+ VendorName "Unknown"
+ BoardName "Unknown"
+ Chipset "generic"
+
+# VideoRam 256
+
+# Clocks 25.2 28.3
+
+EndSection
+
+# Device configured by Xconfigurator:
+';
+
+$screensection_text1 = '
+# **********************************************************************
+# Screen sections
+# **********************************************************************
+';
+
diff --git a/perl-install/common.pm b/perl-install/common.pm
index ce4d599e9..ec8f92366 100644
--- a/perl-install/common.pm
+++ b/perl-install/common.pm
@@ -6,8 +6,9 @@ use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK $printable_chars $sizeof_int $bitof_int
@ISA = qw(Exporter);
%EXPORT_TAGS = (
- common => [ qw(_ __ min max bool member divide is_empty_array_ref set_new set_add round_up round_down first second top uniq translate untranslate) ],
- file => [ qw(dirname basename all glob_ cat_ chop_ mode) ],
+ common => [ qw(_ __ min max sum bool member divide is_empty_array_ref add2hash set_new set_add round_up round_down first second top uniq translate untranslate) ],
+ functional => [ qw(fold_left) ],
+ file => [ qw(dirname basename touch all glob_ cat_ chop_ mode) ],
system => [ qw(sync makedev unmakedev psizeof strcpy gettimeofday syscall_ crypt_) ],
constant => [ qw($printable_chars $sizeof_int $bitof_int $SECTORSIZE) ],
);
@@ -22,12 +23,14 @@ $SECTORSIZE = 512;
sub _ { my $s = shift @_; sprintf translate($s), @_ }
sub __ { $_[0] }
-sub min { my $min = shift; grep { $_ < $min and $min = $_; } @_; $min }
-sub max { my $max = shift; grep { $_ > $max and $max = $_; } @_; $max }
+sub min { fold_left(sub { $a < $b ? $a : $b }, @_) }
+sub max { fold_left(sub { $a > $b ? $a : $b }, @_) }
+sub sum { fold_left(sub { $a + $b }, @_) }
sub first { $_[0] }
sub second { $_[1] }
sub top { $_[$#_] }
sub uniq { my %l; @l{@_} = (); keys %l }
+sub add2hash { my ($a, $b) = @_; while (my ($k, $v) = each %{$b || {}}) { $a->{$k} ||= $v } }
sub member { my $e = shift; foreach (@_) { $e eq $_ and return 1 } 0 }
sub dirname { @_ == 1 or die "usage: dirname <name>\n"; local $_ = shift; s|[^/]*/*\s*$||; s|(.)/*$|$1|; $_ || '.' }
sub basename { @_ == 1 or die "usage: basename <name>\n"; local $_ = shift; s|/*\s*$||; s|.*/||; $_ }
@@ -50,6 +53,24 @@ sub remove_spaces { local $_ = shift; s/^ +//; s/ +$//; $_ }
sub mode { my @l = stat $_[0] or die "unable to get mode of file $_[0]: $!\n"; $l[2] }
sub psizeof { length pack $_[0] }
+sub touch {
+ my $f = shift;
+ unless (-e $f) {
+ local *F;
+ open F, ">$f";
+ }
+ my $now = time;
+ utime $now, $now, $f;
+}
+
+sub fold_left(&$@) {
+ my $f = shift;
+ local $a = shift;
+ foreach $b (@_) { $a = &$f() }
+ $a
+}
+
+
sub all {
my $d = shift;
@@ -89,7 +110,7 @@ sub unmakedev { $_[0] >> 8, $_[0] & 0xff }
sub translate {
my ($s) = @_;
unless (defined %po::I18N::I18N) {
- if (my ($lang) = ($ENV{LC_ALL} || $ENV{LANGUAGE} || $ENV{LC_MESSAGES} || $ENV{LANG}) =~ /(..)/) {
+ if (my ($lang) = substr($ENV{LC_ALL} || $ENV{LANGUAGE} || $ENV{LC_MESSAGES} || $ENV{LANG} || '', 0, 2)) {
local $SIG{__DIE__} = 'none';
eval { require "po/$lang.pm" };
}
diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm
index 6cc170368..d226d033b 100644
--- a/perl-install/detect_devices.pm
+++ b/perl-install/detect_devices.pm
@@ -40,7 +40,7 @@ sub hasSCSI() {
log::l("scsi devices are available");
$scsiDeviceAvailable = 1;
}
-sub hasIDE() { 1 }
+sub hasIDE() { -e "/proc/ide" }
sub hasDAC960() { 1 }
sub hasCompaqSmartArray() {
@@ -82,8 +82,6 @@ sub getSCSI() {
sub getIDE() {
my @idi;
- -r "/proc/ide" or die "sorry, /proc/ide not available, seems like you have a pre-2.2 kernel\n => not handled yet :(";
-
# Great. 2.2 kernel, things are much easier and less error prone.
foreach my $d (glob_('/proc/ide/hd*')) {
my ($t) = chop_(cat_("$d/media"));
diff --git a/perl-install/install2.pm b/perl-install/install2.pm
index bb97fdbcf..13b587060 100644
--- a/perl-install/install2.pm
+++ b/perl-install/install2.pm
@@ -224,18 +224,9 @@ sub setupBootloader {
$o->{isUpgrade} or modules::read_conf("$o->{prefix}/etc/conf.modules");
$o->setupBootloader;
}
+sub configureX { $o->setupXfree }
+sub exitInstall { $o->exitInstall }
-sub configureX { $o->setupXfree; }
-
-sub exitInstall {
- $o->warn(
-_"Congratulations, installation is complete.
-Remove the boot media and press return to reboot.
-For information on fixes which are available for this release of Linux Mandrake,
-consult the Errata available from http://www.linux-mandrake.com/.
-Information on configuring your system is available in the post
-install chapter of the Official Linux Mandrake User's Guide.");
-}
sub main {
$SIG{__DIE__} = sub { chomp $_[0]; log::l("ERROR: $_[0]") };
@@ -271,8 +262,10 @@ sub main {
for (my $step = $o->{steps}->{first}; $step ne 'done'; $step = getNextStep($step)) {
$o->enteringStep($step);
- eval { &{$install2::{$step}}() };
- $@ and $o->warn($@);
+ #eval {
+ &{$install2::{$step}}();
+ #};
+ $o->errorInStep($@) if $@;
$o->leavingStep($step);
}
killCardServices();
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index 8d38cddc6..938323350 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -26,7 +26,8 @@ sub imageGetFile {
}
sub versionString {
- my $kernel = $::o->{packages}->{kernel} or die "I couldn't find the kernel package!";
+ my $kernel = $::o->{packages}->{kernel};
+ $kernel && $kernel->{header} or die "I couldn't find the kernel package!";
c::headerGetEntry($kernel->{header}, 'version') . "-" .
c::headerGetEntry($kernel->{header}, 'release');
diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm
index b25997932..a80807c1b 100644
--- a/perl-install/install_steps.pm
+++ b/perl-install/install_steps.pm
@@ -22,8 +22,6 @@ my $o;
1;
-sub warn {}
-
sub new($$) {
my ($type, $o_) = @_;
@@ -39,6 +37,8 @@ sub leavingStep($$) {
log::l("step `$step' finished");
}
+sub errorInStep($$) {}
+
sub chooseLanguage($) {
$o->{default}->{lang};
}
diff --git a/perl-install/install_steps_stdio.pm b/perl-install/install_steps_stdio.pm
index 22e171c22..908d14080 100644
--- a/perl-install/install_steps_stdio.pm
+++ b/perl-install/install_steps_stdio.pm
@@ -4,78 +4,27 @@ use diagnostics;
use strict;
use vars qw(@ISA);
-@ISA = qw(install_steps);
+@ISA = qw(install_steps_interactive interactive_stdio);
use common qw(:common);
-use partition_table qw(:types);
use devices;
use run_program;
-use install_steps;
+use interactive_stdio;
+use install_steps_interactive;
use install_any;
-use diskdrake;
-use lang;
use log;
1;
sub enteringStep($$$) {
my ($o, $step) = @_;
- print "Starting step `$o->{steps}->{$step}->{text}'\n";
+ print _("Starting step `%s'\n", $o->{steps}->{$step}->{text});
}
sub leavingStep {
my ($o) = @_;
print "--------\n";
}
-sub chooseLanguage($) {
- my $lang = lang::text2lang(ask_from_list("Language", # no use translating this
- "Which language do you want?",
- [ lang::list() ]));
- run_program::run('xmodmap', "/usr/bin/$lang.map");
- $lang;
-}
-
-sub selectInstallOrUpgrade($) {
- ask_yesorno('Install/Upgrade', 'Do you want to upgrade an already installed Mandrake?');
-}
-
-sub selectInstallClass($@) {
- my ($o, @classes) = @_;
- my $c = ask_from_list(_("Install Class"),
- _("What type of user will you have?"),
- [ map { translate($_) } @classes ]);
- untranslate($c, @classes);
-}
-
-sub rebootNeeded($) {
- my ($o) = @_;
- ask_warn('', "You need to reboot for the partition table modifications to take place");
- $o->SUPER::rebootNeeded;
-}
-
-sub choosePartitionsToFormat($$) {
- my ($o, $fstab) = @_;
- my @l = grep { $_->{mntpoint} && (isExt2($_) || isSwap($_)) } @$fstab;
- my @r = ask_many_from_list('', "Choose the partitions you want to format",
- [ map { $_->{mntpoint} } @l ],
- [ map { $_->{notFormatted} } @l ]);
- for (my $i = 0; $i < @l; $i++) {
- $l[$i]->{toFormat} = $r[$i];
- }
-}
-
-sub choosePackages($$$) {
- my ($o, $packages, $compss) = @_;
- my @r = ask_many_from_list('',
- "Choose the packages you want to install",
- [ map { $_->{name} } @$compss ],
- [ map { $_->{selected} } @$compss ]);
-
- for (my $i = 0; $i < @$compss; $i++) {
- $compss->[$i]->{selected} = $r[$i];
- }
-}
-
sub installPackages {
my $o = shift;
@@ -97,9 +46,9 @@ sub setRootPassword($) {
my (%w);
do {
$w{password} and print "You must enter the same password, please try again\n";
- print "Password: "; $w{password} = readln();
+ print "Password: "; $w{password} = $o->readln();
print "Password (again for confirmation): ";
- } until ($w{password} eq readln());
+ } until ($w{password} eq $o->readln());
$o->{default}->{rootPassword} = $w{password};
$o->SUPER::setRootPassword;
@@ -109,91 +58,16 @@ sub addUser($) {
my ($o) = @_;
my %w;
print "\nCreating a normal user account:\n";
- print "Name: "; $w{name} = readln() or return;
+ print "Name: "; $w{name} = $o->readln() or return;
do {
$w{password} and print "You must enter the same password, please try again\n";
- print "Password: "; $w{password} = readln();
+ print "Password: "; $w{password} = $o->readln();
print "Password (again for confirmation): ";
- } until ($w{password} eq readln());
- print "Real name: "; $w{realname} = readln();
+ } until ($w{password} eq $o->readln());
+ print "Real name: "; $w{realname} = $o->readln();
- $w{shell} = ask_from_list('', 'Shell', $o->{default}->{shells});
+ $w{shell} = $o->ask_from_list('', 'Shell', $o->{default}->{shells}, "/bin/bash");
$o->{default}->{user} = { map { $_ => $w{$_}->get_text } qw(name password realname shell) };
$o->SUPER::addUser;
}
-
-sub createBootdisk($) {
- my ($o) = @_;
-
- $o->SUPER::createBootdisk if
- $o->{default}->{mkbootdisk} = ask_yesorno('',
-"A custom bootdisk provides a way of booting into your Linux system without
-depending on the normal bootloader. This is useful if you don't want to install
-lilo on your system, or another operating system removes lilo, or lilo doesn't
-work with your hardware configuration. A custom bootdisk can also be used with
-the Mandrake rescue image, making it much easier to recover from severe system
-failures. Would you like to create a bootdisk for your system?");
-}
-
-sub readln {
- my $l = <STDIN>;
- chomp $l;
- $l;
-}
-
-sub ask_warn {
- my ($title, @msgs) = @_;
- warn(@msgs);
-}
-
-sub ask_yesorno {
- my ($title, @msgs) = @_;
- print join("\n", @_);
- print " (yes/No) "; readln() =~ /y/i;
-
-}
-
-sub check_it {
- my ($i, $n) = @_;
- $i =~ /^\s*\d+\s*$/ && 1 <= $i && $i <= $n
-}
-
-sub ask_from_list {
- my ($title, @msgs) = @_;
- my $list = pop @msgs;
- print map { "$_\n" } @msgs;
- my $n = 0; foreach (@$list) { $n++; print "$n: $_\n"; }
- my $i;
- do {
- defined $i and print "Bad choice, try again\n";
- print "Your choice? (1/$n) ";
- $i = readln();
- } until (check_it($i, $n));
- $list->[$i - 1];
-}
-
-sub ask_many_from_list {
- my ($title, @msgs) = @_;
- my $default = pop @msgs;
- my $list = pop @msgs;
- my @defaults;
- print map { "$_\n" } @msgs;
- my $n = 0; foreach (@$list) {
- $n++;
- print "$n: $_\n";
- push @defaults, $n if $default->[$n - 1];
- }
- my $i;
- TRY_AGAIN:
- defined $i and print "Bad choice, try again\n";
- print "Your choice? (default ", join(',', @defaults), " enter `none' for none) ";
- $i = readln();
- my @t = split ',', $i;
- foreach (@t) { check_it($_, $n) or goto TRY_AGAIN }
-
- my @rr = (0) x @$list;
- $rr[$_ - 1] = 1 foreach @t;
- @rr;
-}
-
diff --git a/perl-install/interactive.pm b/perl-install/interactive.pm
new file mode 100644
index 000000000..977adea5a
--- /dev/null
+++ b/perl-install/interactive.pm
@@ -0,0 +1,53 @@
+package interactive;
+
+use diagnostics;
+use strict;
+
+use common qw(:common);
+
+1;
+
+sub new($$) {
+ my ($type) = @_;
+
+ bless {}, ref $type || $type;
+}
+
+
+sub ask_warn($$$) {
+ my ($o, $title, $message) = @_;
+ ask_from_list($o, $title, $message, [ _("Ok") ]);
+}
+sub ask_yesorno($$$) {
+ my ($o, $title, $message) = @_;
+ ask_from_list_($o, $title, $message, [ __("Yes"), __("No") ]) eq "Yes";
+}
+sub ask_okcancel($$$) {
+ my ($o, $title, $message) = @_;
+ ask_from_list_($o, $title, $message, [ __("Ok"), __("Cancel") ]) eq "Ok";
+}
+sub ask_from_list_($$$$;$) {
+ my ($o, $title, $message, $l, $def) = @_;
+ untranslate(
+ ask_from_list($o, $title, $message, [ map { translate($_) } @$l ], translate($def)),
+ @$l);
+}
+sub ask_from_list($$$$;$) {
+ my ($o, $title, $message, $l, $def) = @_;
+
+ $message = ref $message ? $message : [ $message ];
+
+ @$l > 10 and $l = [ sort @$l ];
+
+ $o->ask_from_listW($title, $message, $l, $def || $l->[0]);
+}
+sub ask_many_from_list($$$$;$) {
+ my ($o, $title, $message, $l, $def) = @_;
+
+ $message = ref $message ? $message : [ $message ];
+
+ $o->ask_many_from_listW($title, $message, $l, $def);
+}
+
+
+
diff --git a/perl-install/interactive_gtk.pm b/perl-install/interactive_gtk.pm
new file mode 100644
index 000000000..935766470
--- /dev/null
+++ b/perl-install/interactive_gtk.pm
@@ -0,0 +1,37 @@
+package interactive_gtk;
+
+use diagnostics;
+use strict;
+use vars qw(@ISA);
+
+@ISA = qw(interactive);
+
+use interactive;
+use common qw(:common);
+use my_gtk qw(:helpers :wrappers);
+
+1;
+
+sub ask_from_listW {
+ my ($o, $title, $messages, $l, $def) = @_;
+
+ if (@$l < 5 && sum(map { length $_ } @$l) < 70) {
+ my $w = my_gtk->new($title);
+ my $f = sub { $w->{retval} = $_[1]; Gtk->main_quit };
+ gtkadd($w->{window},
+ gtkpack(create_box_with_title($o, @$messages),
+ gtkadd(create_hbox(),
+ map {
+ my $b = new Gtk::Button($_);
+ $b->signal_connect(clicked => [ $f, $_ ]);
+ $_ eq $def and $def = $b;
+ $b;
+ } @$l),
+ ),
+ );
+ $def->grab_focus if $def;
+ $w->main;
+ } else {
+ my_gtk::ask_from_list($title, $messages, $l, $def);
+ }
+}
diff --git a/perl-install/interactive_stdio.pm b/perl-install/interactive_stdio.pm
new file mode 100644
index 000000000..40dcdbb7c
--- /dev/null
+++ b/perl-install/interactive_stdio.pm
@@ -0,0 +1,80 @@
+package interactive_stdio;
+
+use diagnostics;
+use strict;
+use vars qw(@ISA);
+
+@ISA = qw(interactive);
+
+use interactive;
+use common qw(:common);
+
+1;
+
+sub readln {
+ my $l = <STDIN>;
+ chomp $l;
+ $l;
+}
+
+sub check_it {
+ my ($i, $n) = @_;
+ $i =~ /^\s*\d+\s*$/ && 1 <= $i && $i <= $n
+}
+
+sub ask_from_listW {
+ my ($o, $title, $messages, $list, $def) = @_;
+ my $i;
+ print map { "$_\n" } @$messages;
+
+ if (@$list < 10 && sum(map { length $_ } @$list) < 50) {
+ my @l;
+ do {
+ if (defined $i) {
+ @l ? print _("Ambiguity (%s) be more precise\n", join(", ", @l)) :
+ print _("Bad choice, try again\n");
+ }
+ @$list == 1 ? print @$list :
+ print join("/", @$list), _(" ? (default %s) ", $def);
+ $i = readln() || $def;
+ @l = grep { /^$i/ } @$list;
+ } until (@l == 1);
+ $l[0];
+ } else {
+ my $n = 0; foreach (@$list) {
+ $n++;
+ $def eq $_ and $def = $n;
+ print "$n: $_\n";
+ }
+ do {
+ defined $i and print _("Bad choice, try again\n");
+ print _("Your choice? (default %s) ", $def);
+ $i = readln() || $def;
+ } until (check_it($i, $n));
+ $list->[$i - 1];
+ }
+}
+
+sub ask_many_from_listW {
+ my ($o, $title, $messages, $list, $default) = @_;
+ my @defaults;
+ print map { "$_\n" } @$messages;
+ my $n = 0; foreach (@$list) {
+ $n++;
+ print "$n: $_\n";
+ push @defaults, $n if $default->[$n - 1];
+ }
+ my $i;
+ TRY_AGAIN:
+ defined $i and print _("Bad choice, try again\n");
+ print _("Your choice? (default %s enter `none' for none) ", join(',', @defaults));
+ $i = readln();
+ my @t = split ',', $i;
+ foreach (@t) { check_it($_, $n) or goto TRY_AGAIN }
+
+ my @rr = (0) x @$list;
+ $rr[$_ - 1] = 1 foreach @t;
+ @rr;
+}
+
+
diff --git a/perl-install/keyboard.pm b/perl-install/keyboard.pm
index 2c6b84858..5b59bd2c3 100644
--- a/perl-install/keyboard.pm
+++ b/perl-install/keyboard.pm
@@ -86,7 +86,7 @@ sub read($) {
foreach (<F>) {
($_) = /^KEYTABLE=(.*)/ or log::l("unrecognized entry in keyboard configuration file ($_)"), next;
- s/\"//g;
+ s/^\s*"(.*)"\s*$/$1/;
s/\.[^.]*//; # remove extension
return basename($_);
}
diff --git a/perl-install/log.pm b/perl-install/log.pm
index 0fe696f07..640349b70 100644
--- a/perl-install/log.pm
+++ b/perl-install/log.pm
@@ -22,9 +22,9 @@ sub openLog(;$) {
if ($_[0]) { # useLocal
open LOG, "> $_[0]" or die "no log possible :(";
} else {
- open LOG, "> /dev/tty3" or open LOG, ">> /tmp/install.log" or die "no log possible :(";
+ open LOG, "> /dev/tty3" or open LOG, ">> /tmp/install.log";# or die "no log possible :(";
}
- open LOG2, ">> /tmp/ddebug.log" or die "no log possible :(";
+ open LOG2, ">> /tmp/ddebug.log";# or die "no log possible :(";
select((select(LOG), $| = 1)[0]);
select((select(LOG2), $| = 1)[0]);
exists $ENV{DEBUG} and $logDebugMessages = 1;
diff --git a/perl-install/my_gtk.pm b/perl-install/my_gtk.pm
index 78a308856..ff34324b0 100644
--- a/perl-install/my_gtk.pm
+++ b/perl-install/my_gtk.pm
@@ -6,8 +6,11 @@ use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK);
@ISA = qw(Exporter);
%EXPORT_TAGS = (
- all => [ qw(ask_warn ask_okcancel ask_yesorno ask_from_entry ask_from_list create_okcancel createScrolledWindow create_menu create_notebook create_packtable create_hbox create_adjustment gtksignal_connect gtkpack gtkpack_ gtkappend gtkadd gtkset_usize gtkset_justify gtkset_active gtkshow gtkdestroy) ],
+ helpers => [ qw(create_okcancel createScrolledWindow create_menu create_notebook create_packtable create_hbox create_adjustment create_box_with_title) ],
+ wrappers => [ qw(gtksignal_connect gtkpack gtkpack_ gtkappend gtkadd gtkset_usize gtkset_justify gtkset_active gtkshow gtkdestroy) ],
+ ask => [ qw(ask_warn ask_okcancel ask_yesorno ask_from_entry ask_from_list ) ],
);
+$EXPORT_TAGS{all} = [ map { @$_ } values %EXPORT_TAGS ];
@EXPORT_OK = map { @$_ } values %EXPORT_TAGS;
use Gtk;
@@ -25,7 +28,6 @@ sub new {
my ($type, $title, @opts) = @_;
Gtk->init;
- parse Gtk::Rc "$ENV{HOME}/etc/any/Gtkrc";
my $o = bless { @opts }, $type;
$o->{window} = $o->_create_window($title);
$o;
@@ -136,9 +138,9 @@ sub create_okcancel($;$$) {
sub create_box_with_title($@) {
my $o = shift;
- $o->{box} = gtkpack(new Gtk::VBox(0,0),
- map({ new Gtk::Label(" $_ ") } @_),
- new Gtk::HSeparator,
+ $o->{box} = gtkpack_(new Gtk::VBox(0,0),
+ 0, map({ new Gtk::Label(" $_ ") } @_),
+ 0, new Gtk::HSeparator,
)
}
@@ -227,7 +229,7 @@ sub ask_warn { my $w = my_gtk->new(shift @_); $w->_ask_warn(@_); main($w);
sub ask_yesorno { my $w = my_gtk->new(shift @_); $w->_ask_okcancel(@_, _("Yes"), _("No")); main($w); }
sub ask_okcancel { my $w = my_gtk->new(shift @_); $w->_ask_okcancel(@_, _("Is it ok?"), _("Ok"), _("Cancel")); main($w); }
sub ask_from_entry { my $w = my_gtk->new(shift @_); $w->_ask_from_entry(@_); main($w); }
-sub ask_from_list { my $w = my_gtk->new(shift @_); $w->_ask_from_list(pop @_, @_); main($w); }
+sub ask_from_list { my $w = my_gtk->new(shift @_); $w->_ask_from_list(@_); main($w); }
sub _ask_from_entry($$@) {
my ($o, @msgs) = @_;
@@ -243,19 +245,19 @@ sub _ask_from_entry($$@) {
);
$entry->grab_focus();
}
-sub _ask_from_list($$$@) {
- my ($o, $l, @msgs) = @_;
+sub _ask_from_list($$$$) {
+ my ($o, $messages, $l, $def) = @_;
my $list = new Gtk::List;
my ($first_time, $starting_word) = (1, '');
my (@widgets, $timeout);
- my @sorted = sort @$l;
$list->signal_connect(select_child => sub {
- $o->{retval} = $sorted[$list->child_position($_[1])];
+ $o->{retval} = $l->[$list->child_position($_[1])];
Gtk->main_quit;
});
- for (my $i = 0; $i < @sorted; $i++) {
+ for (my $i = 0; $i < @$l; $i++) {
my $focused = $i;
- my $w = new Gtk::ListItem($sorted[$i]);
+ $def = $i if $l->[$i] eq $def;
+ my $w = new Gtk::ListItem($l->[$i]);
my $id = $w->signal_connect(key_press_event => sub {
my ($w, $e)= @_;
my $c = chr $e->{keyval};
@@ -271,12 +273,12 @@ sub _ask_from_list($$$@) {
my $curr = $focused + bool($starting_word eq '' || $starting_word eq $c);
$starting_word .= $c unless $starting_word eq $c;
- my $j; for ($j = 0; $j < @sorted; $j++) {
- $sorted[($j + $curr) % @sorted] =~ /^$starting_word/i and last;
+ my $j; for ($j = 0; $j < @$l; $j++) {
+ $l->[($j + $curr) % @$l] =~ /^$starting_word/i and last;
}
- $j == @sorted ?
+ $j == @$l ?
$starting_word = '' :
- $widgets[($j + $curr) % @sorted]->grab_focus;
+ $widgets[($j + $curr) % @$l]->grab_focus;
$w->{timeout} = $timeout = Gtk->timeout_add($forgetTime, sub { $timeout = $starting_word = ''; 0 } );
}
@@ -287,11 +289,11 @@ sub _ask_from_list($$$@) {
}
gtkadd($list, @widgets);
gtkadd($o->{window},
- gtkpack($o->create_box_with_title(@msgs),
+ gtkpack($o->create_box_with_title(@$messages),
@widgets > 15 ?
gtkset_usize(createScrolledWindow($list), 0, 300) :
$list));
- $widgets[0]->grab_focus;
+ $widgets[$def]->grab_focus;
}
sub _ask_warn($@) {
diff --git a/perl-install/partition_table.pm b/perl-install/partition_table.pm
index 1986e4dd9..a9f20cd10 100644
--- a/perl-install/partition_table.pm
+++ b/perl-install/partition_table.pm
@@ -78,6 +78,7 @@ my %fs2type = reverse %type2fs;
1;
+sub important_types { $_[0] and return sort values %types; @important_types }
sub type2name($) { $types{$_[0]} || 'unknown' }
sub type2fs($) { $type2fs{$_[0]} }
sub name2type($) { $types_rev{$_[0]} }
diff --git a/perl-install/partition_table_raw.pm b/perl-install/partition_table_raw.pm
index d85789a50..973961f5a 100644
--- a/perl-install/partition_table_raw.pm
+++ b/perl-install/partition_table_raw.pm
@@ -93,9 +93,9 @@ sub write($$$) {
compute_CHS($hd, $_);
local $_->{start} = $_->{local_start} || 0;
$_->{active} ||= 0; $_->{type} ||= 0; $_->{size} ||= 0; # for no warning
- syswrite F, pack($format, @$_{@fields}) or return 0;
+ syswrite F, pack($format, @$_{@fields}), psizeof($format) or return 0;
}
- syswrite F, $magic or return 0;
+ syswrite F, $magic, length $magic or return 0;
1;
}
sub zero_MBR($) { &write($_[0], 0, [ {} x $nb_primary ]); }
diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm
index 7795a7f8a..f56e43cee 100644
--- a/perl-install/pkgs.pm
+++ b/perl-install/pkgs.pm
@@ -9,6 +9,7 @@ use install_any;
use log;
use smp;
use fs;
+use lang;
my @skipThesesPackages = qw(XFree86-8514 XFree86-AGX XFree86-FBDev XFree86-Mach32 XFree86-Mach64
XFree86-Mach8 XFree86-Mono XFree86-P9000 XFree86-S3 XFree86-S3V
@@ -31,9 +32,11 @@ sub select($$;$) {
my @l = @{$p->{deps}};
while (@l) {
my $n = shift @l;
+ $n =~ /|/ and $n = first(split '\|', $n); #TODO better handling of choice
my $i = Package($packages, $n);
$i->{base} = $base;
- push @l, @{$i->{deps}} unless $i->{selected};
+ $i->{deps} or log::l("missing deps for $n");
+ push @l, @{$i->{deps} || []} unless $i->{selected};
$i->{selected}++ unless $i->{selected} == -1;
}
}
@@ -56,7 +59,7 @@ sub unselect($$) {
$i->{selected} <= 0 and next;
if (--$i->{selected} == 0) {
- push @$l, @{$i->{deps}};
+ push @$l, @{$i->{deps} || []};
}
}
@@ -221,6 +224,17 @@ sub init_db {
$isUpgrade ? c::rpmdbRebuild($prefix) : c::rpmdbInit($prefix, 0644) or die "creation/rebuilding of rpm database failed: ", c::rpmErrorString();
}
+sub getHeader($) {
+ my ($p) = @_;
+
+ unless ($p->{header}) {
+ local *F;
+ open F, $p->{file} or die "error opening package $p->{name} (file $p->{file})";
+ $p->{header} = c::rpmReadPackageHeader(fileno F);
+ }
+ $p->{header};
+}
+
sub install {
my ($prefix, $toInstall, $isUpgrade, $force) = @_;
@@ -232,11 +246,7 @@ sub install {
my ($total, $nb);
foreach my $p (@$toInstall) {
- local *F;
- open F, $p->{file} or die "error opening package $p->{name} (file $p->{file})";
- $p->{header} = c::rpmReadPackageHeader(fileno F);
-
- c::rpmtransAddPackage($trans, $p->{header}, $p->{file}, $isUpgrade);
+ c::rpmtransAddPackage($trans, getHeader($p), $p->{file}, $isUpgrade);
$nb++;
$total += $p->{size};
}
diff --git a/perl-install/resize_fat/fat.pm b/perl-install/resize_fat/fat.pm
index 2b64bd6f7..371e90feb 100644
--- a/perl-install/resize_fat/fat.pm
+++ b/perl-install/resize_fat/fat.pm
@@ -36,7 +36,7 @@ sub write($) {
sysseek $fs->{fd}, $fs->{fat_offset}, 0 or die "write_fat: seek failed";
foreach (1..$fs->{nb_fats}) {
- syswrite $fs->{fd}, $fs->{fat}, $fs->{fat_size} or die "write_fat: write failed";
+ syswrite $fs->{fd}, $fs->{fat} or die "write_fat: write failed";
}
}
diff --git a/perl-install/resize_fat/io.pm b/perl-install/resize_fat/io.pm
index 8ffaa8355..4d1a37158 100644
--- a/perl-install/resize_fat/io.pm
+++ b/perl-install/resize_fat/io.pm
@@ -18,7 +18,7 @@ sub read($$$) {
sub write($$$$) {
my ($fs, $pos, $size, $buf) = @_;
sysseek $fs->{fd}, $pos, 0 or die "seeking to byte #$pos failed on device $fs->{fs_name}";
- syswrite $fs->{fd}, $buf, $size or die "writing at byte #$pos failed on device $fs->{fs_name}";
+ syswrite $fs->{fd}, $buf or die "writing at byte #$pos failed on device $fs->{fs_name}";
}
sub read_cluster($$) {
diff --git a/perl-install/share/diskdrake.rc b/perl-install/share/diskdrake.rc
index 13804f8ca..637b8f3b1 100644
--- a/perl-install/share/diskdrake.rc
+++ b/perl-install/share/diskdrake.rc
@@ -7,7 +7,7 @@ binding "bind"
style "font"
{
- font = "-adobe-helvetica-medium-r-normal--*-80-*-*-*-*-*-*"
+ font = "-adobe-helvetica-medium-r-normal-*-*-80-*-*-p-*-iso8859-1"
}