diff options
-rw-r--r-- | perl-install/Makefile | 4 | ||||
-rw-r--r-- | perl-install/Xconfig.pm | 17 | ||||
-rw-r--r-- | perl-install/Xconfigurator.pm | 9 | ||||
-rw-r--r-- | perl-install/commands.pm | 68 | ||||
-rw-r--r-- | perl-install/install2.pm | 2 | ||||
-rw-r--r-- | perl-install/install_any.pm | 2 | ||||
-rw-r--r-- | perl-install/install_steps.pm | 10 | ||||
-rw-r--r-- | perl-install/install_steps_interactive.pm | 2 | ||||
-rw-r--r-- | perl-install/keyboard.pm | 2 | ||||
-rw-r--r-- | perl-install/share/install.rc | 8 | ||||
-rw-r--r-- | perl-install/share/list | 1 |
11 files changed, 83 insertions, 42 deletions
diff --git a/perl-install/Makefile b/perl-install/Makefile index b9d66b7a1..b434dfbc2 100644 --- a/perl-install/Makefile +++ b/perl-install/Makefile @@ -9,7 +9,7 @@ BASE = $(ROOTDEST)/Mandrake/base DESTREP4PMS = $(DEST)/usr/bin/perl-install STAGE2TMP = /tmp/stage2_tmp PERL = perl -LOCALFILES = $(PERL) mouseconfig +LOCALFILES = $(PERL) mouseconfig ddcxinfo DIRS = po pci_probing EXCLUDE = $(LOCALFILES) boot.img keymaps consolefonts install RPMS = $(wildcard $(ROOTDEST)/Mandrake/RPMS/*.rpm) @@ -178,7 +178,7 @@ stage2: rm $(STAGE2TMP)/usr/X11R6/bin/XF86_SVGA for i in /usr/share/locale /usr/share/keymaps /usr/share/xmodmap; do \ name=`basename $$i` ; \ - (cd $(STAGE2TMP)/$$i ; find * | cpio --quiet -o 2>/dev/null | bzip2 > ../$$name.cpio.bz2 ; rm -rf $$name) \ + (cd $(STAGE2TMP)/$$i ; find * | cpio -o 2>/dev/null | bzip2 > ../$$name.cpio.bz2 ; cd .. ; rm -rf $$name) \ done $(SUDO) cp -a $(STAGE2TMP)/* /mnt/stage2 $(SUDO) rm -rf $(STAGE2TMP) diff --git a/perl-install/Xconfig.pm b/perl-install/Xconfig.pm index 2e93b5679..e22168377 100644 --- a/perl-install/Xconfig.pm +++ b/perl-install/Xconfig.pm @@ -18,7 +18,8 @@ sub keymap_translate { sub getinfo { my $o = {}; - getinfoFromXF86Config($o); +# getinfoFromXF86Config($o); + getinfoFromDDC($o); getinfoFromSysconfig($o); $o->{mouse}{emulate3buttons} = 1; @@ -87,4 +88,18 @@ sub getinfoFromSysconfig { $keyboard{KEYTABLE} or last; $o->{keyboard}{xkb_keymap} ||= keymap_translate($keyboard{KEYTABLE}); } + $o; +} + +sub getinfoFromDDC { + my $o = shift || {}; + my $O = $o->{monitor} ||= {}; + return $o if $O->{hsyncrange} && $O->{vsyncrange} && $O->{modelines}; + my ($h, $v, @l) = `ddcxinfo`; + $? == 0 or return $o; + chop $h; chop $v; + $O->{hsyncrange} ||= $h; + $O->{vsyncrange} ||= $v; + $O->{modelines} ||= join '', @l; + $o; } diff --git a/perl-install/Xconfigurator.pm b/perl-install/Xconfigurator.pm index 1879e45b2..63d0837a0 100644 --- a/perl-install/Xconfigurator.pm +++ b/perl-install/Xconfigurator.pm @@ -192,6 +192,7 @@ sub monitorConfiguration(;$) { add2hash($monitor, { type => $in->ask_from_list('', _("Choose a monitor"), [keys %monitors]) }) unless $monitor->{type}; add2hash($monitor, $monitors{$monitor->{type}}); add2hash($monitor, { type => "Unknown", vendor => "Unknown", model => "Unknown" }); + $monitor; } @@ -502,6 +503,8 @@ sub write_XF86Config { #- Write monitor section. $O = $o->{monitor}; + $O->{modelines} ||= $o->{card}{type} eq "TG 96" ? $modelines_text_Trident_TG_96xx : $modelines_text; + print F $monitorsection_text1; print F qq( Identifier "$O->{type}"\n); print F qq( VendorName "$O->{vendor}"\n); @@ -514,10 +517,8 @@ sub write_XF86Config { 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"; + print F $O->{modelines} || ($o->{card}{type} eq "TG 96" ? $modelines_text_Trident_TG_96xx : $modelines_text); + print F "\nEndSection\n\n\n"; #- Write Device section. $O = $o->{card}; diff --git a/perl-install/commands.pm b/perl-install/commands.pm index b345acacb..3909d4398 100644 --- a/perl-install/commands.pm +++ b/perl-install/commands.pm @@ -66,7 +66,7 @@ sub umount { } sub mkdir_ { - my $rec; $_[0] eq '-p' and $rec = shift; + my ($rec) = getopts(\@_, qw(p)); my $mkdir; $mkdir = sub { my $root = dirname $_[0]; @@ -94,26 +94,19 @@ sub mknod { } sub ln { - my ($force, $soft, $i); + my ($force, $soft) = getopts(\@_, qw(fs)); + @_ >= 1 or die "usage: ln [-s] [-f] <source> [<dest>]\n"; - while ($i = shift) { - if ($i eq '-f') { $force = 1; } - elsif ($i eq '-s') { $soft = 1; } - elsif ($i eq '-fs' || $i eq '-sf') { $force = $soft = 1; } - else { last } - } - - my $source = $i or die "usage: ln [-s] [-f] <source> [<dest>]\n"; - my $dest = shift || basename($source); + my ($source, $dest) = @_; + $dest ||= basename($source); $force and unlink $dest; - ($soft ? symlink($source, $dest) : link($source, $dest)) or die "ln failed: $!\n"; } sub rm { - my $rec; $_[0] eq '-r' and $rec = shift; + my ($rec, undef) = getopts(\@_, qw(rf)); my $rm; $rm = sub { foreach (@_) { @@ -137,7 +130,7 @@ sub chmod_ { } sub chown_ { - my $rec; $_[0] eq '-r' and $rec = shift; + my ($rec, undef) = getopts(\@_, qw(r)); local $_ = shift or die "usage: chown [-r] name[.group] <files>\n"; my ($name, $group) = (split('\.'), $_); @@ -247,26 +240,25 @@ sub cp { } sub ps { - @_ and die "usage: ps\n"; my ($pid, $cpu, $cmd); my ($uptime) = split ' ', first(cat_("/proc/uptime")); my $hertz = 100; - format STDOUT_TOP = + open PS, ">&STDOUT"; + format PS_TOP = PID CMD . - format = + format PS = @>>>> @>>> @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $pid, $cpu, $cmd . - foreach $pid (sort {$a <=> $b} grep { /\d+/ } all('/proc')) { my @l = split(' ', cat_("/proc/$pid/stat")); $cpu = sprintf "%2.1f", max(0, min(99, ($l[13] + $l[14]) * 100 / $hertz / ($uptime - $l[21] / $hertz))); (($cmd) = cat_("/proc/$pid/cmdline")) =~ s/\0/ /g; $cmd ||= (split ' ', (cat_("/proc/$pid/stat"))[0])[1]; - write; + write PS; } } @@ -397,11 +389,11 @@ sub insmod { } sub route { - @ARGV and die "usage: route\nsorry, no modification handled\n"; + @_ == 0 or die "usage: route\nsorry, no modification handled\n"; my ($titles, @l) = cat_("/proc/net/route"); my @titles = split ' ', $titles; my %l; - local *ROUTE = *STDOUT; + open ROUTE, ">&STDOUT"; format ROUTE_TOP = Destination Gateway Mask Iface . @@ -418,3 +410,37 @@ $l{Destination}, $l{Gateway}, $l{Mask}, $l{Iface} write ROUTE; } } + +sub df { + my ($h) = getopts(\@_, qw(h)); + my ($dev, $size, $free, $used, $use, $mntpoint); + open DF, ">&STDOUT"; + format DF_TOP = +Filesystem Size Used Avail Use Mounted on +. + format DF = +@<<<<<<<<<<<<<<<< @>>>>>>> @>>>>>>> @>>>>>>> @>>>>>% @<<<<<<<<<<<<<<<<<<<<<<<<< +$dev, $size, $used, $free, $use, $mntpoint +. + my %h; + foreach (cat_("/proc/mounts"), cat_("/etc/mtab")) { + ($dev, $mntpoint) = split; + $h{$dev} = $mntpoint; + } + foreach $dev (sort keys %h) { + $mntpoint = $h{$dev}; + my $buf = ' ' x 20000; + syscall_('statfs', $mntpoint, $buf) or next; + (undef, undef, $size, $free) = unpack "l7", $buf; + $size or next; + + $use = int (100 * ($size - $free) / $size); + $used = $size - $free; + if ($h) { + $used = int ($used / 1024) . "M"; + $size = int ($size / 1024) . "M"; + $free = int ($free / 1024) . "M"; + } + write DF if $size; + } +} diff --git a/perl-install/install2.pm b/perl-install/install2.pm index 45340f8e9..e43b47ded 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -576,8 +576,8 @@ sub main { #-the main cycle my $clicked = 0; MAIN: for ($o->{step} = $o->{steps}{first};; $o->{step} = getNextStep()) { - $o->enteringStep($o->{step}); $o->{steps}{$o->{step}}{entered}++; + $o->enteringStep($o->{step}); eval { &{$install2::{$o->{step}}}($clicked, $o->{steps}{$o->{step}}{entered}); }; diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index 4c96920a0..0820eb24e 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -138,6 +138,6 @@ sub install_cpio { eval { commands::rm "-r", $dir }; mkdir $dir, 0755; - run_program::run("cd $dir ; bzip2 -cd $cpio | cpio -i $name"); + run_program::run("cd $dir ; bzip2 -cd $cpio | cpio -id $name $name/*"); "$dir/$name"; } diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index cf3df79dc..584bf1fb3 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -163,16 +163,14 @@ sub mouseConfig($) { sub configureNetwork($) { my ($o) = @_; my $etc = "$o->{prefix}/etc"; -# -# rc = checkNetConfig(&$o->{intf}, &$o->{netc}, &$o->{intfFinal}, -# &$o->{netcFinal}, &$o->{driversLoaded}, $o->{direction}); + network::write_conf("$etc/sysconfig/network", $o->{netc}); network::write_resolv_conf("$etc/resolv.conf", $o->{netc}); network::write_interface_conf("$etc/sysconfig/network-scripts/ifcfg-$_->{DEVICE}", $_) foreach @{$o->{intf}}; network::add2hosts("$etc/hosts", $o->{netc}{HOSTNAME}, map { $_->{IPADDR} } @{$o->{intf}}); network::sethostname($o->{netc}) unless $::testing; network::addDefaultRoute($o->{netc}) unless $::testing; - #-res_init(); # reinit the resolver so DNS changes take affect + #-res_init(); #- reinit the resolver so DNS changes take affect } #------------------------------------------------------------------------------ @@ -180,7 +178,9 @@ sub timeConfig { my ($o, $f) = @_; my $t = $o->{timezone}; - setVarsInSh($f, { + eval { commands::cp("-f", "/usr/share/zoneinfo/$t->{timezone}", "/etc/localtime") }; + $@ and log::l("installing /etc/localtime failed"); + setVarsInSh($f, { ZONE => $t->{timezone}, GMT => bool2text($t->{GMT}), ARC => "false", diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index 296441bb9..4bb7e6aab 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -458,7 +458,7 @@ sub addUser($) { }, complete => sub { $u->{password} eq $u->{password2} or $o->ask_warn('', [ _("You must enter the same password"), _("Please try again") ]), return (1,3); - (length $u->{password} < 6) and $o->ask_warn('', _("This password is too simple")), return (1,2); + #(length $u->{password} < 6) and $o->ask_warn('', _("This password is too simple")), return (1,2); $u->{name} or $o->ask_warn('', _("Please give a user name")), return (1,0); $u->{name} =~ /^[a-z0-9_-]+$/ or $o->ask_warn('', _("The user name must contain only lower cased letters, numbers, `-' and `_'")), return (1,0); return 0; diff --git a/perl-install/keyboard.pm b/perl-install/keyboard.pm index fdd821465..44a9fc32a 100644 --- a/perl-install/keyboard.pm +++ b/perl-install/keyboard.pm @@ -119,7 +119,7 @@ sub setup($) { if (my $file = install_any::install_cpio("/usr/share/keymaps", "$o->[1].kmap")) { log::l("loading keymap $o->[1]"); - load(cat_($file)); + load(cat_($file)) if -e $file; } if (my $file = install_any::install_cpio("/usr/share/xmodmap", "xmodmap.$o->[2]")) { eval { run_program::run('xmodmap', $file) } unless $::testing; diff --git a/perl-install/share/install.rc b/perl-install/share/install.rc index c55e37a71..b9a32a2e1 100644 --- a/perl-install/share/install.rc +++ b/perl-install/share/install.rc @@ -1,8 +1,8 @@ style "default-font" { fontset = "\ --*-arial-medium-r-normal-*-*-120-*-*-*-*-*-*,\ --*-helvetica-medium-r-normal-*-*-120-*-*-*-*-*-*,\ +-*-arial-medium-r-normal-*-*-100-*-*-*-*-*-*,\ +-*-helvetica-medium-r-normal-*-*-100-*-*-*-*-*-*,\ -*-tahoma-medium-r-normal-*-*-*-*-*-*-*-*-*,\ -*-*-medium-r-normal-*-*-*-*-*-*-*-jisx0208.1990-0,\ -*-*-medium-r-normal-*-*-*-*-*-*-*-jisx0208.1983-0,\ @@ -23,8 +23,8 @@ style "steps" fg[NORMAL] = { 1.0, 1.0, 1.0 } fontset = "\ --*-arial-medium-r-normal-*-*-100-*-*-*-*-*-*,\ --*-helvetica-medium-r-normal-*-*-100-*-*-*-*-*-*,\ +-*-arial-medium-r-normal-*-*-80-*-*-*-*-*-*,\ +-*-helvetica-medium-r-normal-*-*-80-*-*-*-*-*-*,\ -*-tahoma-medium-r-normal-*-*-*-*-*-*-*-*-*,\ -*-*-medium-r-normal-*-*-*-*-*-*-*-jisx0208.1990-0,\ -*-*-medium-r-normal-*-*-*-*-*-*-*-jisx0208.1983-0,\ diff --git a/perl-install/share/list b/perl-install/share/list index beffbce8f..01750371f 100644 --- a/perl-install/share/list +++ b/perl-install/share/list @@ -77,7 +77,6 @@ /usr/X11R6/lib/X11/fonts/misc/fonts.alias /usr/X11R6/lib/X11/fonts/misc/6x13.pcf.gz /usr/X11R6/lib/X11/fonts/misc/cursor.pcf.gz -/usr/X11R6/lib/X11/fonts/misc/jiskan16.pcf.gz /usr/X11R6/lib/X11/fonts/misc/7x14rk.pcf.gz /usr/share/fonts/ISO8859-9/75dpi/fonts.dir /usr/share/fonts/ISO8859-9/75dpi/fonts.alias |