From ea1c93402dfa2aba19ab3dbc3551cd21572affb9 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 14 Dec 1999 16:42:45 +0000 Subject: no_comment --- perl-install/Makefile | 21 +--------- perl-install/Makefile.config | 20 +++++++++ perl-install/Makefile.drakxtools | 4 +- perl-install/Xconfigurator.pm | 14 ++++++- perl-install/commands.pm | 7 +++- perl-install/install2.pm | 10 ++--- perl-install/install_any.pm | 6 +-- perl-install/install_steps_gtk.pm | 13 +++--- perl-install/install_steps_interactive.pm | 7 +++- perl-install/interactive.pm | 9 +++- perl-install/modules.pm | 8 +++- perl-install/partition_table.pm | 9 ++++ perl-install/pkgs.pm | 24 ++++++----- perl-install/share/compssList | 16 +++++--- perl-install/share/po/Makefile | 8 ++-- perl-install/standalone/adduserdrake | 68 +++++++++++++++++++++++++++++++ perl-install/standalone/drakxconf | 2 +- perl-install/standalone/mousedrake | 1 + perl-install/timezone.pm | 4 +- 19 files changed, 187 insertions(+), 64 deletions(-) create mode 100644 perl-install/Makefile.config create mode 100755 perl-install/standalone/adduserdrake (limited to 'perl-install') diff --git a/perl-install/Makefile b/perl-install/Makefile index 1e1ee064e..600b3a438 100644 --- a/perl-install/Makefile +++ b/perl-install/Makefile @@ -1,21 +1,4 @@ -VERSION = 2.2.10-BOOT -SUDO = sudo -SO_FILES = c/blib/arch/auto/c/c.so -PMS = *.pm Newt/*.pm c/stuff.pm resize_fat/*.pm pci_probing/*.pm commands install2 g_auto_install -PMS += $(patsubst %, standalone/%,diskdrake XFdrake rpmdrake mousedrake printerdrake) -REP4PMS = /usr/bin/perl-install -ROOTDEST = /export -DEST = $(ROOTDEST)/Mandrake/mdkinst -STAGE2 = $(ROOTDEST)/Mandrake/base/mdkinst_stage2 -BASE = $(ROOTDEST)/Mandrake/base -DESTREP4PMS = $(DEST)$(REP4PMS) -PERL = perl -LOCALFILES = $(patsubst %, ../tools/%,e2fsck.shared ddcprobe/ddcxinfos pnp_serial/pnp_serial) -LOCALFILES2 = extract_archive -DIRS = c Newt po pci_probing resize_fat -EXCLUDE = $(LOCALFILES) boot.img keymaps consolefonts install -CFLAGS = -Wall -override CFLAGS += -pipe +include Makefile.config .PHONY: all $(DIRS) install clean stage2 full_stage2 verify_c @@ -33,7 +16,7 @@ tar-drakxtools: clean $(MAKE) -C ../tools clean cd .. ; rm -rf drakxtools ; cp -af perl-install drakxtools ; cp -af tools/ddcprobe tools/pnp_serial drakxtools cd ../drakxtools ; rm -rf install* ForMakefile.pm pkgs.pm ftp.pm t.pm standalone/CVS ; mv Makefile.drakxtools Makefile ; mv -f standalone/* . - cd .. ; tar cfy drakxtools.tar.bz2 --exclude CVS $(patsubst %,drakxtools/%,Makefile MonitorsDB Newt c ddcprobe pnp_serial po pci_probing resize_fat diskdrake diskdrake.rc XFdrake mousedrake lspcidrake printerdrake keyboarddrake netdrake drakxconf drakxservices *.pm) + cd .. ; tar cfy drakxtools.tar.bz2 --exclude CVS $(patsubst %,drakxtools/%,Makefile Makefile.config MonitorsDB Newt c ddcprobe pnp_serial po pci_probing resize_fat diskdrake.rc $(STANDALONEPMS) *.pm) cd .. ; rm -rf drakxtools $(DIRS): diff --git a/perl-install/Makefile.config b/perl-install/Makefile.config new file mode 100644 index 000000000..d7a9c0c58 --- /dev/null +++ b/perl-install/Makefile.config @@ -0,0 +1,20 @@ +VERSION = 2.2.10-BOOT +SUDO = sudo +SO_FILES = c/blib/arch/auto/c/c.so +PMS = *.pm Newt/*.pm c/stuff.pm resize_fat/*.pm pci_probing/*.pm commands install2 g_auto_install +STANDALONEPMS= diskdrake XFdrake mousedrake lspcidrake printerdrake keyboarddrake netdrake drakxconf drakxservices draksec adduserdrake +PMS += $(STANDALONEPMS:%=standalone/%) standalone/rpmdrake +REP4PMS = /usr/bin/perl-install +ROOTDEST = /export +DEST = $(ROOTDEST)/Mandrake/mdkinst +STAGE2 = $(ROOTDEST)/Mandrake/base/mdkinst_stage2 +BASE = $(ROOTDEST)/Mandrake/base +DESTREP4PMS = $(DEST)$(REP4PMS) +PERL = perl +LOCALFILES = $(patsubst %, ../tools/%,e2fsck.shared ddcprobe/ddcxinfos pnp_serial/pnp_serial) +LOCALFILES2 = extract_archive +DIRS = c Newt po pci_probing resize_fat +EXCLUDE = $(LOCALFILES) boot.img keymaps consolefonts install +CFLAGS = -Wall +override CFLAGS += -pipe + diff --git a/perl-install/Makefile.drakxtools b/perl-install/Makefile.drakxtools index d48457a8e..c91f6dde6 100644 --- a/perl-install/Makefile.drakxtools +++ b/perl-install/Makefile.drakxtools @@ -1,5 +1,6 @@ DIRS = ddcprobe pnp_serial po Newt c pci_probing resize_fat PREFIX = +STANDALONEPMS= diskdrake XFdrake mousedrake lspcidrake printerdrake keyboarddrake netdrake drakxconf drakxservices draksec adduserdrake SBINDEST = $(PREFIX)/usr/sbin ETCDEST = $(PREFIX)/etc/gtk BINDEST = $(PREFIX)/usr/bin @@ -12,11 +13,12 @@ all: $(DIRS) $(DIRS): install -d auto + rm standalone ; ln -s . standalone $(MAKE) -C $@ install: install -d $(BINDEST) $(ETCDEST) $(SBINDEST) $(LIBDEST) $(X11DEST) $(DIRS:%=$(LIBDEST)/%) - install diskdrake XFdrake mousedrake lspcidrake printerdrake keyboarddrake netdrake drakxconf drakxservices $(SBINDEST) + install $(STANDALONEPMS) $(SBINDEST) install -s ddcprobe/ddcxinfos pnp_serial/pnp_serial $(SBINDEST) for i in *.pm ; do perl -pe '$$_ = "\n" if /\s*use\s+(diagnostics|vars|strict)/' $$i > $(LIBDEST)/$$i ; done diff --git a/perl-install/Xconfigurator.pm b/perl-install/Xconfigurator.pm index e3011e4ab..b34cdeb50 100644 --- a/perl-install/Xconfigurator.pm +++ b/perl-install/Xconfigurator.pm @@ -777,11 +777,21 @@ sub main { } if ($ok) { - my $run = $o->{xdm} || $::auto || $in->ask_yesorno(_("X at startup"), + if ($::isStandalone && !-t STDIN) { + if (`pidof kwm` > 0 && $in->ask_okcancel('', _("Please relog into KDE to activate the changes"), 1)) { + system("kwmcom logout"); + exec qw(nohup perl -e), q{ + for (my $nb = 10; $nb && `pidof kwm` > 0; $nb--) { sleep 1 } + system("killall X") unless `pidof kwm` > 0; + }; + } + } else { + my $run = $o->{xdm} || $::auto || $in->ask_yesorno(_("X at startup"), _("I can set up your computer to automatically start X upon booting. Would you like X to start when you reboot?"), 1); - rewriteInittab($run ? 5 : 3) unless $::testing; + rewriteInittab($run ? 5 : 3) unless $::testing; + } run_program::rooted($prefix, "chkconfig", "--del", "gpm") if $o->{mouse}{device} =~ /ttyS/ && !$::isStandalone; } } diff --git a/perl-install/commands.pm b/perl-install/commands.pm index 26d2a7eb3..914a4a7be 100644 --- a/perl-install/commands.pm +++ b/perl-install/commands.pm @@ -199,6 +199,11 @@ sub rights { $types[$_[0] >> 12 & 0xf] . $r; } +sub displaySize { + my $m = $_[0] >> 12; + $m == 4 || $m == 8 || $m == 10; +} + sub ls { my ($l , $h) = getopts(\@_, qw(lh)); $h and die "usage: ls [-l] \n"; @@ -211,7 +216,7 @@ sub ls { formline( "@<<<<<<<<< @<<<<<<< @<<<<<<< @>>>>>>>> @>>>>>>>>>>>>>>> @*\n", rights($s[2]), getpwuid $s[4] || $s[4], getgrgid $s[5] || $s[5], - $s[6] ? join ", ", unmakedev($s[6]) : $s[7], + displaySize($s[2]) ? $s[7] : join(", ", unmakedev($s[6])), scalar localtime $s[9], -l $_ ? "$_ -> " . readlink $_ : $_); print $^A; $^A = ''; } else { print "$_\n"; } diff --git a/perl-install/install2.pm b/perl-install/install2.pm index 97287e91c..f326ad1dc 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -59,7 +59,7 @@ my (%installSteps, @orderedInstallSteps); addUser => [ __("Add a user"), 1, 1, '', "doInstallStep" ], createBootdisk => [ __("Create a bootdisk"), 1, 0, '', "doInstallStep" ], setupBootloader => [ __("Install bootloader"), 1, 1, '', "doInstallStep" ], - configureX => [ __("Configure X"), 1, 0, '', ["formatPartitions"] ], + configureX => [ __("Configure X"), 1, 0, '', ["formatPartitions", "setupBootloader"] ], exitInstall => [ __("Exit install"), 0, 0, 'beginner' ], ); for (my $i = 0; $i < @installSteps; $i += 2) { @@ -89,7 +89,7 @@ my @install_classes = (__("beginner"), __("developer"), __("server"), __("expert my %suggestedPartitions = ( normal => [ { mntpoint => "/boot", size => 10 << 11, type => 0x83, maxsize => 30 << 11 }, - { mntpoint => "/", size => 300 << 11, type => 0x83, ratio => 5, maxsize => 1500 << 11 }, + { mntpoint => "/", size => 300 << 11, type => 0x83, ratio => 5, maxsize => 2500 << 11 }, { mntpoint => "swap", size => 64 << 11, type => 0x82, ratio => 1, maxsize => 250 << 11 }, { mntpoint => "/home", size => 300 << 11, type => 0x83, ratio => 5 }, ], @@ -152,7 +152,7 @@ $o = $::o = { timezone => { #- timezone => "Europe/Paris", -#- GMT => 1, +#- UTC => 1, }, printer => { want => 0, @@ -397,7 +397,7 @@ sub configureTimezone { #- can't be done in install cuz' timeconfig %post creates funny things add2hash($o->{timezone}, { timezone::read($f) }); } - $o->{timezone}{GMT} = !$::beginner && !grep { isFat($_) } @{$o->{fstab}} unless exists $o->{timezone}{GMT}; + $o->{timezone}{UTC} = !$::beginner && !grep { isFat($_) } @{$o->{fstab}} unless exists $o->{timezone}{UTC}; $o->timeConfig($f, $clicked); } #------------------------------------------------------------------------------ @@ -610,7 +610,7 @@ sub main { "DRAKX_PASSWORD=$o->{lilo}{password}\n", 'DRAKX_USERS="', join(" ", map { $_->{name} } @{$o->{users} || []}), qq("\n)); run_program::rooted($o->{prefix}, "/etc/security/msec/init.sh", $o->{security}); -# unlink "$o->{prefix}/tmp/secure.DrakX"; + unlink "$o->{prefix}/tmp/secure.DrakX"; run_program::rooted($o->{prefix}, "kudzu", "-q"); # -q <=> fermetagueuleconnard diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index a2f139522..7b5a38863 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -495,12 +495,12 @@ sub install_urpmi { my $dir = ${{ nfs => "file://mnt/nfs", hd => "file:/" . hdInstallPath, - ftp => $ENV{URLPREFIX}, - http => $ENV{URLPREFIX}, + ftp => $ENV{URLPREFIX}, + http => $ENV{URLPREFIX}, cdrom => "removable_cdrom_1://mnt/cdrom" }}{$method}; local *FILES; open FILES, "hdlist2files $f|"; chop, print LIST "$dir/Mandrake/RPMS/$_\n" foreach ; - close FILES or die "hdlist2files failed"; + close FILES or log::l("hdlist2files failed"), return; $dir .= "/Mandrake/RPMS with ../base/hdlist" if $method =~ /ftp|http/; eval { output "$prefix/etc/urpmi/urpmi.cfg", "$name $dir\n" }; diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm index 460835d18..38ef48745 100644 --- a/perl-install/install_steps_gtk.pm +++ b/perl-install/install_steps_gtk.pm @@ -254,12 +254,15 @@ sub doPartitionDisks($$) { my $w = $o->wait_message(_("Resizing"), _("Computing fat filesystem bounds")); my $resize_fat = eval { resize_fat::main->new($part->{device}, devices::make($part->{device})) }; my $min_win = $resize_fat->min_size; - if (!$@ && $part->{size} > $min_linux + $min_freewin + $min_win && $o->ask_okcancel('', + if (!$@ && $part->{size} > $min_linux + $min_freewin + $min_win && $o->ask_okcancel('', _("TODO"))) { + my $hd = $hds->[0]; my $oldsize = $part->{size}; - $hds->[0]{isDirty} = $hds->[0]{needKernelReread} = 1; + $hd->{isDirty} = $hd->{needKernelReread} = 1; $part->{size} -= $min_linux; - partition_table::adjustEnd($hds->[0], $part); + partition_table::adjustEnd($hd, $part); + partition_table::adjust_local_extended($hd, $part); + partition_table::adjust_main_extended($hd); local *log::l = sub { $w->set(join(' ', @_)) }; eval { $resize_fat->resize($part->{size}) }; @@ -270,7 +273,7 @@ _("TODO"))) { $part->{isFormatted} = 1; eval { fsedit::auto_allocate($hds, $o->{partitions}) }; if (!$@) { - partition_table::write($hds->[0]) unless $::testing; + partition_table::write($hd) unless $::testing; return; } } @@ -765,7 +768,7 @@ sub createXconf($$$) { open F, ">$file" or die "can't create X configuration file $file"; print F <{mirror} = crypto::text2mirror($o->ask_from_list('', _("Choose a mirror from which to get the packages"), [ crypto::mirrorstext() ], crypto::mirror2text($u->{mirror}))); + eval { + $u->{mirror} = crypto::text2mirror($o->ask_from_list('', _("Choose a mirror from which to get the packages"), [ crypto::mirrorstext() ], crypto::mirror2text($u->{mirror}))); + }; + return if $@; my @packages = do { my $w = $o->wait_message('', _("Contacting the mirror to get the list of available packages")); @@ -443,7 +446,7 @@ sub timeConfig { require timezone; $o->{timezone}{timezone} ||= timezone::bestTimezone(lang::lang2text($o->{lang})); $o->{timezone}{timezone} = $o->ask_from_list('', _("Which is your timezone?"), [ timezone::getTimeZones($::g_auto_install ? '' : $o->{prefix}) ], $o->{timezone}{timezone}); - $o->{timezone}{GMT} = $o->ask_yesorno('', _("Is your hardware clock set to GMT?"), $o->{timezone}{GMT}) if $::expert || $clicked; + $o->{timezone}{UTC} = $o->ask_yesorno('', _("Is your hardware clock set to GMT?"), $o->{timezone}{UTC}) if $::expert || $clicked; install_steps::timeConfig($o,$f); } diff --git a/perl-install/interactive.pm b/perl-install/interactive.pm index 824bd795f..6691455db 100644 --- a/perl-install/interactive.pm +++ b/perl-install/interactive.pm @@ -43,11 +43,16 @@ sub vnew { $su = $su eq "su"; require c; if (c::Xtest($ENV{DISPLAY} ||= ":0")) { - $su && $> && exec "kdesu", "-c", "$0 @ARGV"; + if ($su && $>) { + $ENV{PATH} = "/sbin:/usr/sbin:$ENV{PATH}"; + exec "kdesu", "-c", "$0 @ARGV"; + } require interactive_gtk; interactive_gtk->new; } else { - $su && $> && die "you must be root to run this program"; + if ($su && $>) { + die "you must be root to run this program"; + } require 'log.pm'; undef *log::l; *log::l = sub {}; # otherwise, it will bother us :( diff --git a/perl-install/modules.pm b/perl-install/modules.pm index 66040a4b7..1c788e505 100644 --- a/perl-install/modules.pm +++ b/perl-install/modules.pm @@ -257,7 +257,10 @@ my @drivers_by_category = ( }], ); -my %scsi_raid; @scsi_raid{qw(DAC960 dpt megaraid cpqarray gdth ips ppa eata eata_pio eata_dma st imm)} = (); +my %type_aliases = ( + scsi => 'disk', +); + my @drivers_fields = qw(text type); %drivers = (); @@ -282,8 +285,9 @@ sub module_of_type($) { sub text_of_type($) { my ($type) = @_; + my $alias = $type_aliases{$type}; - map { $_->{text} } grep { $_->{type} eq $type } values %drivers; + map { $_->{text} } grep { $_->{type} eq $type || $_->{type} eq $alias } values %drivers; } sub text2driver($) { diff --git a/perl-install/partition_table.pm b/perl-install/partition_table.pm index ee67c5481..aa6912ab9 100644 --- a/perl-install/partition_table.pm +++ b/perl-install/partition_table.pm @@ -293,6 +293,15 @@ sub adjust_main_extended($) { verifyParts($hd); #- verify everything is all right } +sub adjust_local_extended($$) { + my ($hd, $part) = @_; + + foreach (@{$hd->{extended} || []}) { + $_->{normal} == $part or next; + $_->{size} = $part->{size} + $part->{start} - $_->{start}; + last; + } +} sub get_normal_parts($) { my ($hd) = @_; diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index 57a4e1d67..3409956c3 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -22,15 +22,19 @@ hackkernel-pcmcia-cs hackkernel-smp hackkernel-smp-fb autoirpm autoirpm-icons numlock ); -my @preferred = qw( - +my %by_lang = ( + ar => [ 'acon' ], + ja => [ 'rxvt-CLE' ], + ko => [ 'rxvt-CLE' ], + zh_CN => [ 'rxvt-CLE' ], + 'zh_TW.Big5' => [ 'rxvt-CLE' ], ); my $A = 20471; my $B = 16258; sub correctSize { ($A - $_[0]) * $_[0] / $B } #- size correction in MB. -sub invCorrectSize { $A / 2 - sqrt(sqr($A) - 4 * $B * $_[0]) / 2 } +sub invCorrectSize { $A / 2 - sqrt(max(0, sqr($A) - 4 * $B * $_[0])) / 2 } sub Package { my ($packages, $name) = @_; @@ -237,7 +241,7 @@ sub readCompssList($$$) { foreach (split ':', $ENV{LANGUAGE}) { my $locales = "locales-" . substr($_, 0, 2); my $p = $packages->{$locales} or next; - foreach ($locales, @{$p->{provides} || []}) { + foreach ($locales, @{$p->{provides} || []}, @{$by_lang{$_} || []}) { my $p = $packages->{$_} or next; $p->{values} = [ map { $_ + 70 } @{$p->{values}} ]; } @@ -268,12 +272,12 @@ sub readCompssUsers { \%compssUsers; } -sub isLangSensitive($$) { - my ($name, $lang) = @_; - local $SIG{__DIE__} = 'none'; - $name =~ /-([^-]*)$/ or return; - $1 eq $lang || eval { lang::text2lang($1) eq $lang } && !$@; -} +#- sub isLangSensitive($$) { +#- my ($name, $lang) = @_; +#- local $SIG{__DIE__} = 'none'; +#- $name =~ /-([^-]*)$/ or return; +#- $1 eq $lang || eval { lang::text2lang($1) eq $lang } && !$@; +#- } sub setSelectedFromCompssList($$$$$$) { my ($compssListLevels, $packages, $level, $install_class) = @_; diff --git a/perl-install/share/compssList b/perl-install/share/compssList index c590aaf90..15ef973b9 100644 --- a/perl-install/share/compssList +++ b/perl-install/share/compssList @@ -2,6 +2,7 @@ packages +acon 24 24 24 adjtimex 1 40 87 AfterStep 65 20 53 AfterStep-APPS 62 18 55 @@ -82,7 +83,8 @@ dip 15 0 13 dosemu 55 0 49 dosemu-freedos 55 0 49 dosfstools 25 0 22 -drakxtools 85 0 83 +drakxconf 89 0 89 +drakxtools 89 0 89 dump 9 0 87 e2fsprogs-devel 1 0 25 ed 45 0 5 @@ -240,7 +242,7 @@ ImageMagick 42 0 60 ImageMagick-devel 1 0 60 imap 0 70 6 imlib 1 0 71 -imbib-cfgeditor 70 0 71 +imlib-cfgeditor 70 0 71 imlib-devel 1 0 50 imwheel 70 0 58 indent 20 0 91 @@ -273,17 +275,18 @@ kcmlaptop 82 0 60 kcpumon 82 0 60 kdbg 30 0 27 kdeadmin 82 0 60 -kdebase 89 0 68 +kdebase 88 0 68 kdegames 80 0 59 kdegraphics 88 0 66 kdelibs 0 0 0 +kdelibs-devel 1 1 60 kdemultimedia 88 0 66 kdenetwork 82 0 60 kdesu 82 0 60 kdesupport 0 0 0 kde-themes 82 0 60 kdetoys 87 0 65 -kdeutils 89 0 67 +kdeutils 88 0 67 kdevelop 30 0 27 kdf 88 0 66 kdiff 82 0 60 @@ -314,7 +317,7 @@ knewmail 82 0 60 knsbookmark 82 0 60 korganizer 81 0 59 kover 82 0 60 -kpackage 89 0 67 +kpackage 88 0 67 kpacman 80 0 59 kpilot 82 0 60 kmp3te 82 0 60 @@ -584,6 +587,7 @@ rusers 38 0 34 rwall 37 0 33 rwho 36 0 32 rxvt 35 0 96 +rxvt-CLE 29 10 26 sag 55 0 25 samba 34 99 30 sane 59 0 53 @@ -626,7 +630,7 @@ tclx 12 0 70 tcpdump 3 85 2 tcp_wrappers 0 99 0 tcsh 1 0 0 -telnet 88 99 87 +telnet 92 99 92 telnet-server 42 99 37 tetex 55 0 50 tetex-afm 55 0 40 diff --git a/perl-install/share/po/Makefile b/perl-install/share/po/Makefile index e556b5e36..091a87d6a 100644 --- a/perl-install/share/po/Makefile +++ b/perl-install/share/po/Makefile @@ -1,11 +1,13 @@ -PMSFILES = $(shell find .. -name "*.pm" | grep -v "^../po" | grep -v "^../c/") +include ../Makefile.config + +PMSFILES = $(shell find .. -name "*.pm" | grep -v "^../po" | grep -v "^../c/") $(STANDALONEPMS:%=../standalone/%) PMSCFILES = $(PMSFILES:%=%_.c) POFILES = $(shell ls *.po) all: $(POFILES) clean: - rm -f empty.po $(POFILES:%=%t) $(PMSCFILES) + rm -f empty.po messages $(POFILES:%=%t) $(PMSCFILES) verif: perl -ne '/^\s*#/ or $$i += my @l = /\b__?\(/g; END { print "$$i\n" }' $(PMSFILES) @@ -18,7 +20,7 @@ $(POFILES): DrakX.pot DrakX.pot: $(PMSFILES) $(MAKE) $(PMSCFILES); - xgettext -F -n --keyword=_ --keyword=__ -o DrakX.pot $(PMSCFILES) + xgettext -F -n --keyword=_ --keyword=__ -o $@ $(PMSCFILES) rm $(PMSCFILES) $(PMSCFILES): %_.c: % 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") }; } diff --git a/perl-install/timezone.pm b/perl-install/timezone.pm index e5851b1dd..8ea53f333 100644 --- a/perl-install/timezone.pm +++ b/perl-install/timezone.pm @@ -21,7 +21,7 @@ sub read ($) { my ($f) = @_; my %t = getVarsFromSh($f) or die "cannot open file $f: $!"; - ("timezone", $t{ZONE}, "GMT", text2bool($t{GMT})); + ("timezone", $t{ZONE}, "UTC", text2bool($t{UTC})); } sub write($$$) { @@ -31,7 +31,7 @@ sub write($$$) { $@ and log::l("installing /etc/localtime failed"); setVarsInSh($f, { ZONE => $t->{timezone}, - GMT => bool2text($t->{GMT}), + UTC => bool2text($t->{UTC}), ARC => "false", }); } -- cgit v1.2.1