From e4f62031c585cbc4a45230714e13821b9bfca34c Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 11 Oct 1999 17:35:35 +0000 Subject: no_comment --- perl-install/install2.pm | 6 +++--- perl-install/install_any.pm | 7 +++++-- perl-install/install_steps.pm | 18 ++++++++++++------ perl-install/install_steps_interactive.pm | 16 +++++++++++----- perl-install/interactive_gtk.pm | 5 +++-- perl-install/my_gtk.pm | 23 +++++++++++++---------- perl-install/share/install.rc | 30 +++++++++++++++++------------- 7 files changed, 64 insertions(+), 41 deletions(-) diff --git a/perl-install/install2.pm b/perl-install/install2.pm index d2904f14e..2987c76d3 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -121,7 +121,7 @@ $o = $::o = { autoSCSI => 0, mkbootdisk => 1, #- no mkbootdisk if 0 or undef, find a floppy with 1 #- packages => [ qw() ], - partitioning => { clearall => 0, eraseBadPartitions => 0, auto_allocate => 0, autoformat => 0, readonly => 0 }, + partitioning => { clearall => 0, eraseBadPartitions => 0, auto_allocate => 0, autoformat => 0, readonly => 1 }, #- partitions => [ #- { mntpoint => "/boot", size => 16 << 11, type => 0x83 }, #- { mntpoint => "/", size => 256 << 11, type => 0x83 }, @@ -178,7 +178,7 @@ $o = $::o = { steps => \%installSteps, orderedSteps => \@orderedInstallSteps, - base => [ qw(basesystem initscripts console-tools mkbootdisk anacron rhs-hwdiag utempter ldconfig chkconfig ntsysv mktemp setup filesystem SysVinit bdflush crontabs dev e2fsprogs etcskel fileutils findutils getty_ps grep groff gzip hdparm info initscripts isapnptools kbdconfig kernel less ldconfig lilo logrotate losetup man mkinitrd mingetty modutils mount net-tools passwd procmail procps psmisc mandrake-release rootfiles rpm sash sed setconsole setserial shadow-utils sh-utils slocate stat sysklogd tar termcap textutils time timeconfig tmpwatch util-linux vim-minimal vixie-cron which cpio perl) ], + base => [ qw(basesystem sed initscripts console-tools mkbootdisk anacron rhs-hwdiag utempter ldconfig chkconfig ntsysv mktemp setup filesystem SysVinit bdflush crontabs dev e2fsprogs etcskel fileutils findutils getty_ps grep groff gzip hdparm info initscripts isapnptools kbdconfig kernel less ldconfig lilo logrotate losetup man mkinitrd mingetty modutils mount net-tools passwd procmail procps psmisc mandrake-release rootfiles rpm sash sed setconsole setserial shadow-utils sh-utils slocate stat sysklogd tar termcap textutils time tmpwatch util-linux vim-minimal vixie-cron which cpio perl) ], #- for the list of fields available for user and superuser, see @etc_pass_fields in install_steps.pm #- intf => [ { DEVICE => "eth0", IPADDR => '1.2.3.4', NETMASK => '255.255.255.128' } ], @@ -202,7 +202,7 @@ $o = $::o = { #------------------------------------------------------------------------------ sub selectLanguage { - $o->selectLanguage; + $o->selectLanguage($_[1] == 1); addToBeDone { lang::write($o->{prefix}); diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index a2864957f..8b5c6dc25 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -56,8 +56,11 @@ sub kernelVersion { sub getNextStep { - my ($s) = $::o->{steps}{first}; - $s = $::o->{steps}{$s}{next} while $::o->{steps}{$s}{done}; + my ($s, $old); + for ($s = $::o->{steps}{first}; $::o->{steps}{$s}{done}; $s = $::o->{steps}{$s}{next}) { + $::o->{steps}{$s}{reachable} or return $old; + $old = $s; + } $s; } diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index ee62d62bf..3191e167a 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -278,12 +278,15 @@ sub addUser($) { my $p = $o->{prefix}; my @passwd = cat_("$p/etc/passwd");; - !$u{name} || getpwnam($u{name}) and return; - - for ($u{uid} = 500; getpwuid($u{uid}); $u{uid}++) {} - for ($u{gid} = 500; getgrgid($u{gid}); $u{gid}++) {} + return if !$u{name} || getpwnam($u{name}); $u{home} ||= "/home/$u{name}"; + my (%uids, %gids); + foreach (glob_("/home")) { my ($u, $g) = (stat($_))[4,5]; $uids{$u} = 1; $gids{$g} = 1; } + my ($old_uid, $old_gid) = ($u{uid}, $u{gid}) = (stat($u{home}))[4,5]; + if (getpwuid($u{uid})) { for ($u{uid} = 500; getpwuid($u{uid}) || $uids{$u{uid}}; $u{uid}++) {} } + if (getgrgid($u{gid})) { for ($u{gid} = 500; getgrgid($u{gid}) || $gids{$u{gid}}; $u{gid}++) {} } + $u{password} = crypt_($u{password}) if $u{password}; return if $::testing; @@ -295,8 +298,11 @@ sub addUser($) { open F, ">> $p/etc/group" or die "can't append to group file: $!"; print F "$u{name}::$u{gid}:\n"; - eval { commands::cp("-f", "$p/etc/skel", "$p$u{home}") }; $@ and log::l("copying of skel failed: $@"), mkdir("$p$u{home}", 0750); - commands::chown_("-r", "$u{uid}.$u{gid}", "$p$u{home}"); + unless (-d "$p$u{home}") { + eval { commands::cp("-f", "$p/etc/skel", "$p$u{home}") }; + if ($@) { log::l("copying of skel failed: $@"); mkdir("$p$u{home}", 0750); } + } + commands::chown_("-r", "$u{uid}.$u{gid}", "$p$u{home}") if $u{uid} != $old_uid || $u{gid} != $old_gid; } #------------------------------------------------------------------------------ diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index 27a2cf897..635f16a78 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -55,6 +55,11 @@ sub selectLanguage($) { [ lang::list() ], lang::lang2text($o->{lang}))); install_steps::selectLanguage($o); + + $o->{useless_thing_accepted} = $o->ask_from_list_('', +_("Wanring no wrranty, be carfull it's gonna explose ytou romcpature"), + [ _("Accept"), _("Refuse") ], "Accept") eq "Accept" or exit(1) unless $o->{useless_thing_accepted}; + } #------------------------------------------------------------------------------ sub selectKeyboard($) { @@ -135,7 +140,7 @@ sub ask_mntpoint_s { my %l; $l{&$msg} = $_ foreach @fstab; my $e = $o->ask_from_list('', _("Which partition do you want to use as your root partition"), - [ keys %l ]); + [ sort keys %l ]); (fsedit::get_root($fstab) || {})->{mntpoint} = ''; $l{$e}{mntpoint} = '/'; } else { @@ -525,8 +530,8 @@ sub addUser($) { my @shells = install_any::shells($o); $o->ask_from_entries_ref( - _("Add user"), - _("Enter a user"), + [ _("Add user"), _("Add user"), _("Done") ], + _("Enter a user\n%s", $o->{users} ? _("(already added %s)", join(", ", @{$o->{users}})) : ''), [ _("Real name"), _("User name"), _("Password"), _("Password (again)"), _("Shell") ], [ \$u->{realname}, \$u->{name}, {val => \$u->{password}, hidden => 1}, {val => \$u->{password2}, hidden => 1}, @@ -534,7 +539,7 @@ sub addUser($) { ], focus_out => sub { if ($_[0] eq 0) { - $u->{name} = lc first($u->{realname} =~ /((\w|-)+)/); + $u->{name} ||= lc first($u->{realname} =~ /((\w|-)+)/); } }, complete => sub { @@ -546,8 +551,9 @@ sub addUser($) { }, ) or return; install_steps::addUser($o); + push @{$o->{users}}, $o->{user}{realname}; $o->{user} = {}; - goto &addUser if $::expert; + goto &addUser;#- if $::expert; } diff --git a/perl-install/interactive_gtk.pm b/perl-install/interactive_gtk.pm index af0026df4..f8623a206 100644 --- a/perl-install/interactive_gtk.pm +++ b/perl-install/interactive_gtk.pm @@ -76,10 +76,11 @@ sub ask_many_from_list_refW($$$$$) { sub ask_from_entries_refW { my ($o, $title, $messages, $l, $val, %hcallback) = @_; + my ($title_, @okcancel) = ref $title ? @$title : $title; my $num_fields = @{$l}; my $ignore = 0; #-to handle recursivity - my $w = my_gtk->new($title, %$o); + my $w = my_gtk->new($title_, %$o); #-the widgets my @widgets = map { if ($_->{type} eq "list") { @@ -99,7 +100,7 @@ sub ask_from_entries_refW { new Gtk::Entry; } } @{$val}; - my $ok = $w->create_okcancel; + my $ok = $w->create_okcancel(@okcancel); sub widget { my ($w, $ref) = @_; diff --git a/perl-install/my_gtk.pm b/perl-install/my_gtk.pm index ede3a2d78..2f8eb812e 100644 --- a/perl-install/my_gtk.pm +++ b/perl-install/my_gtk.pm @@ -388,18 +388,21 @@ sub _ask_from_list($$$$) { Gtk->timeout_remove($timeout) if $timeout; $timeout = ''; - if ($e->{state} & 4) { - #- control pressed - $start_reg = $start_reg ? '' : "^" if $c eq "s"; - } elsif ($e->{keyval} >= 0x100) { + if ($e->{keyval} >= 0x100) { &$leave if $c eq "\r" || $c eq "\x8d"; - $starting_word = ''; + $starting_word = '' if $e->{keyval} != 0xffe4; # control } else { - &$leave if $c eq ' '; - - $curr++ if $starting_word eq '' || $starting_word eq $c; - $starting_word .= $c unless $starting_word eq $c; - + if ($e->{state} & 4) { + #- control pressed + $c eq "s" or return 1; + $start_reg and $start_reg = '', return 1; + $curr++; + } else { + &$leave if $c eq ' '; + + $curr++ if $starting_word eq '' || $starting_word eq $c; + $starting_word .= $c unless $starting_word eq $c; + } my $word = quotemeta $starting_word; my $j; for ($j = 0; $j < @$l; $j++) { $l->[($j + $curr) % @$l] =~ /$start_reg$word/i and last; diff --git a/perl-install/share/install.rc b/perl-install/share/install.rc index eba8c2f1c..b18c395b8 100644 --- a/perl-install/share/install.rc +++ b/perl-install/share/install.rc @@ -1,9 +1,9 @@ style "default-font" { fontset = "\ --*-helvetica-medium-r-normal-*-*-100-*-*-*-*-*-*,\ --cronyx-helvetica-medium-r-normal-*-*-110-*-*-*-*-*-*,\ --*-tahoma-medium-r-normal-*-*-*-*-*-*-*-*-*,\ +-mdk-helvetica-medium-r-normal-*-*-100-*-*-*-*-*-*,\ +-mdk-helvetica-medium-r-normal-*-*-120-*-*-*-*-tis620.2533-1,\ +-mdk-helvetica-medium-r-normal-*-*-130-*-*-*-*-tcvn-5712,\ -*-*-medium-r-normal-*-*-*-*-*-*-*-jisx0208.1990-0,\ -*-*-medium-r-normal-*-*-*-*-*-*-*-jisx0208.1983-0,\ -*-*-medium-r-normal-*-*-*-*-*-*-*-jisx0201.1976-0,\ @@ -11,10 +11,8 @@ style "default-font" -*-*-medium-r-normal-*-*-*-*-*-*-*-georgian-rs,\ -*-*-medium-*-*-*-*-*-*-*-*-*-ksc5601.1987-*,\ -*-*-medium-r-normal-*-*-*-*-*-*-*-mulelao-1,\ --*-*-medium-r-normal-*-*-*-*-*-*-*-ibm-cp1133,\ --*-*-medium-r-normal-*-*-*-*-*-*-*-iso10646-1,\ +-*-*-medium-r-normal-*-*-*-*-*-*-*-gb2312.1980-0,\ -taipei-*-medium-r-normal-*-*-*-*-*-*-*-big5-0" - } style "steps" @@ -23,9 +21,18 @@ style "steps" fg[NORMAL] = { 1.0, 1.0, 1.0 } fontset = "\ --*-helvetica-medium-r-normal-*-*-80-*-*-*-*-*-*,\ --cronyx-helvetica-medium-r-normal-*-*-110-*-*-*-*-*-*,\ --*-tahoma-medium-r-normal-*-*-*-*-*-*-*-*-*,\ +-mdk-helvetica-medium-r-normal-*-*-80-*-*-*-*-*-*,\ +-mdk-helvetica-medium-r-normal-*-*-100-*-*-*-*-iso8859-3,\ +-mdk-helvetica-medium-r-normal-*-*-100-*-*-*-*-iso8859-4,\ +-mdk-helvetica-medium-r-normal-*-*-100-*-*-*-*-iso8859-6,\ +-mdk-helvetica-medium-r-normal-*-*-100-*-*-*-*-iso8859-7,\ +-mdk-helvetica-medium-r-normal-*-*-100-*-*-*-*-iso8859-8,\ +-mdk-helvetica-medium-r-normal-*-*-100-*-*-*-*-iso8859-13,\ +-mdk-helvetica-medium-r-normal-*-*-100-*-*-*-*-iso8859-14,\ +-mdk-helvetica-medium-r-normal-*-*-100-*-*-*-*-armscii-8,\ +-mdk-helvetica-medium-r-normal-*-*-100-*-*-*-*-microsoft-cp1251,\ +-mdk-helvetica-medium-r-normal-*-*-120-*-*-*-*-tis620.2533-1,\ +-mdk-helvetica-medium-r-normal-*-*-100-*-*-*-*-tcvn-5712,\ -*-*-medium-r-normal-*-*-*-*-*-*-*-jisx0208.1990-0,\ -*-*-medium-r-normal-*-*-*-*-*-*-*-jisx0208.1983-0,\ -*-*-medium-r-normal-*-*-*-*-*-*-*-jisx0201.1976-0,\ @@ -33,11 +40,8 @@ style "steps" -*-*-medium-r-normal-*-*-*-*-*-*-*-georgian-rs,\ -*-*-medium-*-*-*-*-*-*-*-*-*-ksc5601.1987-*,\ -*-*-medium-r-normal-*-*-*-*-*-*-*-mulelao-1,\ --*-*-medium-r-normal-*-*-*-*-*-*-*-ibm-cp1133,\ --*-*-medium-r-normal-*-*-*-*-*-*-*-iso10646-1,\ --*-*-medium-r-normal-*-*-*-*-*-*-*-iso10646-1,\ +-*-*-medium-r-normal-*-*-*-*-*-*-*-gb2312.1980-0,\ -taipei-*-medium-r-normal-*-*-*-*-*-*-*-big5-0" - } style "logo" -- cgit v1.2.1