summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>1999-12-24 00:26:22 +0000
committerPascal Rigaux <pixel@mandriva.com>1999-12-24 00:26:22 +0000
commit63ee6b158bf74b995d1e6ed294b6d4b3f3e95ca5 (patch)
treedb9522b8dc1c02af74c6c5050a58e7fd002bdc55 /perl-install
parent685a29887953bf36c2d0dab4e7bce8a64bd8934e (diff)
downloaddrakx-backup-do-not-use-63ee6b158bf74b995d1e6ed294b6d4b3f3e95ca5.tar
drakx-backup-do-not-use-63ee6b158bf74b995d1e6ed294b6d4b3f3e95ca5.tar.gz
drakx-backup-do-not-use-63ee6b158bf74b995d1e6ed294b6d4b3f3e95ca5.tar.bz2
drakx-backup-do-not-use-63ee6b158bf74b995d1e6ed294b6d4b3f3e95ca5.tar.xz
drakx-backup-do-not-use-63ee6b158bf74b995d1e6ed294b6d4b3f3e95ca5.zip
no_comment
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/any.pm37
-rw-r--r--perl-install/common.pm7
-rw-r--r--perl-install/install_steps.pm12
-rw-r--r--perl-install/lang.pm8
-rw-r--r--perl-install/partition_table.pm8
-rw-r--r--perl-install/share/compssList2
-rwxr-xr-xperl-install/standalone/adduserdrake30
-rw-r--r--perl-install/timezone.pm17
8 files changed, 91 insertions, 30 deletions
diff --git a/perl-install/any.pm b/perl-install/any.pm
new file mode 100644
index 000000000..5b2fef5c3
--- /dev/null
+++ b/perl-install/any.pm
@@ -0,0 +1,37 @@
+package any;
+
+use diagnostics;
+use strict;
+
+#-######################################################################################
+#- misc imports
+#-######################################################################################
+use common qw(:file :system :common :functional);
+
+sub addKdmUsers {
+ my ($prefix, @users) = @_;
+ require timezone;
+ my @u1 = my @users_male = qw(tie default curly);
+ my @u2 = my @users_female = qw(brunette girl woman-blond);
+ foreach (@users) {
+ my $l = rand() < timezone::sexProb($_->{name}) ? \@u2 : \@u1;
+ my $u = splice(@$l, rand(@$l), 1); #- known biased (see cookbook for better)
+ symlink "../../../../icons/user-$u-mdk.xpm", "$prefix/usr/share/apps/kdm/pics/users/$_.xpm";
+ @u1 = @users_male unless @u1;
+ @u2 = @users_female unless @u2;
+ }
+ symlinkf "../../../../icons/user-hat-mdk.xpm", "$prefix/usr/share/apps/kdm/pics/users/root.xpm" unless $::isStandalone;
+}
+
+sub addUsers {
+ my ($prefix, @users) = @_;
+ my $msec = "$prefix/etc/security/msec";
+ foreach my $u (@users) {
+ substInFile { s/^$u\n//; $_ .= "$u\n" if eof } "$msec/user.conf" if -d $msec;
+ }
+ run_program::rooted($prefix, "/etc/security/msec/init-sh/grpuser.sh --refresh");
+
+ addKdmUsers($prefix, @users);
+}
+
+1;
diff --git a/perl-install/common.pm b/perl-install/common.pm
index b48199abc..13d7c1d20 100644
--- a/perl-install/common.pm
+++ b/perl-install/common.pm
@@ -34,7 +34,12 @@ sub fold_left(&@) {
$a
}
-sub _ { my $s = shift @_; sprintf translate($s), @_ }
+sub _ {
+ my $s = shift @_; my $t = translate($s);
+ $t && ref $t or return sprintf $t, @_;
+ my ($T, @p) = @$t;
+ sprintf $T, @_[@p];
+}
#-delete $main::{'_'};
sub __ { $_[0] }
sub even($) { $_[0] % 2 == 0 }
diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm
index 4a252c29b..f57ed6550 100644
--- a/perl-install/install_steps.pm
+++ b/perl-install/install_steps.pm
@@ -488,18 +488,8 @@ sub addUser($) {
eval { commands::chown_("-r", "$u->{uid}.$u->{gid}", "$p$u->{home}") }
if $u->{uid} != $u->{oldu} || $u->{gid} != $u->{oldg};
- my $msec = "$o->{prefix}/etc/security/msec";
- substInFile { s/^$u->{name}\n//; $_ .= "$u->{name}\n" if eof } "$msec/user.conf" if -d $msec;
}
- run_program::rooted($o->{prefix}, "/etc/security/msec/init-sh/grpuser.sh --refresh");
-
- my @users = qw(tie brunette default girl woman-blond);
- my @u = @users; push @u, @users while @u < @l; @u = @u[0..$#l];
- foreach (@l) {
- my $u = splice(@u, rand(@u), 1); #- known biased (see cookbook for better)
- symlink "../../../../icons/util-$u.xpm", "$o->{prefix}/usr/share/apps/kdm/pics/users/$_->{name}.xpm";
- }
- symlinkf "../../../../icons/util-hat.xpm", "$o->{prefix}/usr/share/apps/kdm/pics/users/root.xpm";
+ any::addUsers($o->{prefix}, map { $_->{name} } @l);
}
#------------------------------------------------------------------------------
diff --git a/perl-install/lang.pm b/perl-install/lang.pm
index 7a4d77785..897305b8c 100644
--- a/perl-install/lang.pm
+++ b/perl-install/lang.pm
@@ -237,7 +237,13 @@ sub load_po($) {
if (/^(#|$)/ && $state != 3) {
$state = 3;
- $s .= qq("$from" => "$to",\n) if $from;
+ if (my @l = $to =~ /%(\d+)\$/g) {
+ $to =~ s/%(\d+)\$/%/g;
+ $to = qq([ "$to", ) . join(",", map { $_ - 1 } @l) . " ],";
+ } else {
+ $to = qq("$to");
+ }
+ $s .= qq("$from" => $to,\n) if $from;
$from = $to = '';
}
$to .= (/"(.*)"/)[0] if $state == 1;
diff --git a/perl-install/partition_table.pm b/perl-install/partition_table.pm
index aa6912ab9..e8def5b18 100644
--- a/perl-install/partition_table.pm
+++ b/perl-install/partition_table.pm
@@ -436,8 +436,14 @@ sub remove($$) {
}
$i++;
}
+
+ my ($first, $second, $third) = map { $_->{normal} } @{$hd->{extended} || []};
+ if ($third && $first eq $part) {
+ die "Can't handle removing hda5 when hda6 is not the second partition" if $second->{start} > $third->{start};
+ }
+
#- otherwise search it in extended partitions
- foreach (@{$hd->{extended}}) {
+ foreach (@{$hd->{extended} || []}) {
$_->{normal} eq $part or next;
delete $_->{normal}; #- remove it
diff --git a/perl-install/share/compssList b/perl-install/share/compssList
index f87395607..00bf0610d 100644
--- a/perl-install/share/compssList
+++ b/perl-install/share/compssList
@@ -189,7 +189,7 @@ gnomehack 50 0 45
gnomeicu 61 0 58
gnome-libs 0 0 55
gnome-libs-devel 10 0 55
-gnome-linuxconf 65 0 53
+gnome-linuxconf 69 0 69
gnome-media 60 0 58
gnome-objc 0 0 40
gnome-objc-devel 10 0 40
diff --git a/perl-install/standalone/adduserdrake b/perl-install/standalone/adduserdrake
index 490f09b7e..0bc27dd94 100755
--- a/perl-install/standalone/adduserdrake
+++ b/perl-install/standalone/adduserdrake
@@ -4,6 +4,7 @@ use lib qw(/usr/lib/libDrakX);
use common qw(:common :functional :system :file);
use interactive;
+use any;
local $_ = join '', @ARGV;
@@ -50,26 +51,25 @@ if ($in->ask_from_entries_refH(
},
)) {
push @users, $u;
- $u->{pw} = $isMD5 ? c::crypt_md5($u->{password}, salt(8)) : crypt($u->{password}, salt(2));
- system("adduser $u->{name}");
- substInFile {
+ $u->{pw} = $isMD5 ? c::crypt_md5($u->{password}, salt(8)) : crypt($u->{password}, salt(2));
+ $u = {};
+ goto new;
+}
+my @u = map { $_->{name} } @users;
+
+system("adduser $_") foreach @u;
+any::addUsers('', @u);
+
+substInFile {
+ foreach my $u (@users) {
if (/^$u->{name}:/) {
chomp;
my %l; @l{@etc_pass_fields} = split ':';
add2hash($u, \%l);
$_ = join(':', @$u{@etc_pass_fields}) . "\n";
}
- } "/etc/passwd";
-
- system("pwconv") if $isShadow;
-
- my $msec = "/etc/security/msec";
- substInFile { s/^$u->{name}\n//; $_ .= "$u->{name}\n" if eof } "$msec/user.conf" if -d $msec;
- system("$msec/init-sh/grpuser.sh --refresh");
-
- $u = {};
- goto new;
-}
-
+ }
+} "/etc/passwd";
+system("pwconv") if $isShadow;
$in->exit(0);
diff --git a/perl-install/timezone.pm b/perl-install/timezone.pm
index f0c7cb207..9c1427c76 100644
--- a/perl-install/timezone.pm
+++ b/perl-install/timezone.pm
@@ -78,4 +78,21 @@ sub bestTimezone {
$l2t{common::bestMatchSentence($langtext, keys %l2t)};
}
+my %sex = (
+fr_FR => { '[iln]a$' => 1, '[cdilnst]e$' => 1, 'e$' => .8, 'n$' => .1, 'd$' => .05 },
+en => { 'a$' => 1, 'o$' => 0, '[ln]$' => .3, '[rs]$' => .2 },
+);
+
+
+sub sexProb($) {
+ local ($_) = @_;
+ my $l = $sex{$ENV{LC_ALL}} or return 0.5;
+
+ my ($prob, $nb) = (0, 0);
+ foreach my $k (keys %$l) {
+ /$k/ and $prob += $l->{$k}, $nb++;
+ }
+ $nb ? $prob / $nb : 0.5;
+}
+
1;