summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>1999-12-14 16:42:45 +0000
committerPascal Rigaux <pixel@mandriva.com>1999-12-14 16:42:45 +0000
commitea1c93402dfa2aba19ab3dbc3551cd21572affb9 (patch)
treeec45ca3dd1f9c2899748fabe19ef9f4a2d1ba13d /perl-install/standalone
parent0f4c7b1bab30307ecee99c03506b0bb632e5c51f (diff)
downloaddrakx-backup-do-not-use-ea1c93402dfa2aba19ab3dbc3551cd21572affb9.tar
drakx-backup-do-not-use-ea1c93402dfa2aba19ab3dbc3551cd21572affb9.tar.gz
drakx-backup-do-not-use-ea1c93402dfa2aba19ab3dbc3551cd21572affb9.tar.bz2
drakx-backup-do-not-use-ea1c93402dfa2aba19ab3dbc3551cd21572affb9.tar.xz
drakx-backup-do-not-use-ea1c93402dfa2aba19ab3dbc3551cd21572affb9.zip
no_comment
Diffstat (limited to 'perl-install/standalone')
-rwxr-xr-xperl-install/standalone/adduserdrake68
-rwxr-xr-xperl-install/standalone/drakxconf2
-rwxr-xr-xperl-install/standalone/mousedrake1
3 files changed, 70 insertions, 1 deletions
diff --git a/perl-install/standalone/adduserdrake b/perl-install/standalone/adduserdrake
new file mode 100755
index 000000000..52fbdfd68
--- /dev/null
+++ b/perl-install/standalone/adduserdrake
@@ -0,0 +1,68 @@
+#!/usr/bin/perl
+
+use lib qw(/usr/lib/libDrakX);
+
+use common qw(:common :functional :system :file);
+use interactive;
+
+local $_ = join '', @ARGV;
+
+/-h/ and die "usage: adduserdrake [--beginner] [--expert]\n";
+
+$::beginner = /--beginner/;
+$::expert = /--expert/;
+$::isStandalone = 1;
+
+my $in = vnew interactive('su');
+
+my @etc_pass_fields = qw(name pw uid gid realname home shell);
+my @shells = map { "/bin/$_" } qw(bash tcsh zsh ash ksh);
+my $isMD5 = cat_("/etc/pam.d/passwd") =~ /md5/;
+my $security = $ENV{SECURITY_LEVEL};
+
+new:
+if ($in->ask_from_entries_refH(
+ [ _("Add user"), _("Accept user"), _("Done") ],
+ _("Enter a user\n%s", $users ? _("(already added %s)", join(", ", map { $_->{realname} || $_->{name} } @users)) : ''),
+ [
+ _("Real name") => \$u->{realname},
+ _("User name") => \$u->{name},
+ $security < 2 ? () : (
+ _("Password") => {val => \$u->{password}, hidden => 1},
+ _("Password (again)") => {val => \$u->{password2}, hidden => 1},
+ ), $::beginner ? () : (
+ _("Shell") => {val => \$u->{shell}, list => \@shells, not_edit => !$::expert}
+ ),
+ ],
+ focus_out => sub {
+ if ($_[0] eq 0) {
+ $u->{name} ||= lc first($u->{realname} =~ /((\w|-)+)/);
+ }
+ },
+ complete => sub {
+ $u->{password} eq $u->{password2} or $o->ask_warn('', [ _("The passwords do not match"), _("Please try again") ]), return (1,3);
+ $security > 3 && 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);
+ member($u->{name}, map { $_->{name} } @users) and $o->ask_warn('', _("This user name is already added")), return (1,0);
+ return 0;
+ },
+)) {
+ push @users, $u;
+ $u->{pw} = $isMD5 ? c::crypt_md5($u->{password}, salt(8)) : crypt($u->{password}, salt(2));
+ system("adduser $u->{name}");
+ substInFile {
+ if (/^$u->{name}:/) {
+ chomp;
+ my %l; @l{@etc_pass_fields} = split ':';
+ add2hash($u, \%l);
+ $_ = join(':', @$u{@etc_pass_fields}) . "\n";
+ }
+ } "/etc/passwd";
+
+ $u = {};
+ goto new;
+}
+
+
+$in->exit(0);
diff --git a/perl-install/standalone/drakxconf b/perl-install/standalone/drakxconf
index f4adb9989..7a99b1ffc 100755
--- a/perl-install/standalone/drakxconf
+++ b/perl-install/standalone/drakxconf
@@ -20,7 +20,7 @@ my $in = vnew interactive('su');
my $choice = $in->ask_from_list("drakxconf",
_("Choose the tool you want to use"),
[ grep { my $prog = $_; int grep { -x "$_/$prog" } split ":", $ENV{PATH} }
- qw(XFdrake diskdrake keyboarddrake mousedrake netdrake printerdrake ) ]) or c::_exit(0); #- workaround for perl-GTK
+ qw(XFdrake adduserdrake diskdrake drakxservices keyboarddrake mousedrake netdrake printerdrake draksec adduserdrake) ]) or c::_exit(0); #- workaround for perl-GTK
$in->end;
diff --git a/perl-install/standalone/mousedrake b/perl-install/standalone/mousedrake
index 748f5761d..9e39557f8 100755
--- a/perl-install/standalone/mousedrake
+++ b/perl-install/standalone/mousedrake
@@ -26,6 +26,7 @@ if (!(my $name = $mouse->{FULLNAME}) || !$::auto) {
$mouse = mouse::name2mouse($name);
if ($mouse->{device} eq "usbmouse") {
+ require pci_probing::main;
my ($c) = pci_probing::main::probe("serial_usb") or die _("no serial_usb found\n");
eval { modules::load($c->[1], "serial_usb") };
}