summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>1999-09-23 00:38:28 +0000
committerPascal Rigaux <pixel@mandriva.com>1999-09-23 00:38:28 +0000
commit37860db32a298e81d107848c7021f39427ff2e29 (patch)
treeaca56a7afe2ac47312f7d69037dd2be7fe5da32a /perl-install
parenta2d6666a3797ac9d980855cc8a28cf9a6466a78c (diff)
downloaddrakx-37860db32a298e81d107848c7021f39427ff2e29.tar
drakx-37860db32a298e81d107848c7021f39427ff2e29.tar.gz
drakx-37860db32a298e81d107848c7021f39427ff2e29.tar.bz2
drakx-37860db32a298e81d107848c7021f39427ff2e29.tar.xz
drakx-37860db32a298e81d107848c7021f39427ff2e29.zip
no_comment
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/Makefile6
-rw-r--r--perl-install/commands.pm23
-rw-r--r--perl-install/common.pm24
-rw-r--r--perl-install/fs.pm2
-rwxr-xr-xperl-install/g_auto_install13
-rw-r--r--perl-install/install2.pm9
-rw-r--r--perl-install/install_any.pm3
-rw-r--r--perl-install/install_steps.pm17
-rw-r--r--perl-install/install_steps_interactive.pm79
-rw-r--r--perl-install/lang.pm28
-rw-r--r--perl-install/share/list1
-rw-r--r--perl-install/share/po/Makefile8
12 files changed, 166 insertions, 47 deletions
diff --git a/perl-install/Makefile b/perl-install/Makefile
index a66e58f29..7a4904b6d 100644
--- a/perl-install/Makefile
+++ b/perl-install/Makefile
@@ -1,7 +1,7 @@
VERSION = 2.2.10-BOOT
SUDO = sudo
SO_FILES = c/blib/arch/auto/c/c.so
-PMS = *.pm c/*.pm resize_fat/*.pm po/*.pm pci_probing/*.pm commands install2 diskdrake XFdrake
+PMS = *.pm c/*.pm resize_fat/*.pm pci_probing/*.pm commands install2 diskdrake XFdrake g_auto_install
ROOTDEST = /export
DEST = $(ROOTDEST)/Mandrake/mdkinst
STAGE2 = $(ROOTDEST)/Mandrake/base/mdkinst_stage2
@@ -89,10 +89,14 @@ install_pms: all
mv -f $(DESTREP4PMS)/c/c.pm $(DESTREP4PMS)
cp *.rc $(DESTREP4PMS)
+ install -d $(DESTREP4PMS)/po
+ cp po/*.po* $(DESTREP4PMS)/po
ln -sf perl-install/install2 $(DEST)/usr/bin
ln -sf perl-install/commands $(DEST)/usr/bin
chmod a+x $(DESTREP4PMS)/install2
chmod a+x $(DESTREP4PMS)/commands
+ chmod a+x $(DESTREP4PMS)/XFdrake
+ chmod a+x $(DESTREP4PMS)/g_auto_install
cp -af */blib/arch/auto $(DESTREP4PMS)
find $(DESTREP4PMS) -name "*.so" | xargs strip
diff --git a/perl-install/commands.pm b/perl-install/commands.pm
index 3c4c19a3e..e4510a22d 100644
--- a/perl-install/commands.pm
+++ b/perl-install/commands.pm
@@ -393,6 +393,8 @@ sub unpack_ {
}
sub insmod {
+ my ($h) = getopts(\@_, qw(h));
+ $h || @_ == 0 and die "usage: insmod <module> [options]\n";
my $name = shift;
my $f = "/tmp/$name.o";
require 'run_program.pm';
@@ -402,6 +404,15 @@ sub insmod {
unlink $f;
}
+sub modprobe {
+ my ($h) = getopts(\@_, qw(h));
+ $h || @_ == 0 and die "usage: modprobe <module> [options]\n";
+ my $name = shift;
+ require 'modules.pm';
+ modules::load_deps("/modules/modules.dep");
+ modules::load($name, '', @_);
+}
+
sub route {
@_ == 0 or die "usage: route\nsorry, no modification handled\n";
my ($titles, @l) = cat_("/proc/net/route");
@@ -459,6 +470,18 @@ $dev, $size, $used, $free, $use, $mntpoint
}
}
+sub kill {
+ my $signal = 15;
+ @_ or die "usage: kill [-<signal>] pids\n";
+ $signal = (shift, $1)[1] if $_[0] =~ /^-(.*)/;
+ kill $signal, @_ or die "kill failed: $!\n";
+}
+
+sub lspci {
+ require 'pci_probing/main.pm';
+ print join "\n", pci_probing::main::list (), '';
+}
+
#-######################################################################################
#- Wonderful perl :(
#-######################################################################################
diff --git a/perl-install/common.pm b/perl-install/common.pm
index 6d759420f..e9e803c65 100644
--- a/perl-install/common.pm
+++ b/perl-install/common.pm
@@ -7,7 +7,7 @@ use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK $printable_chars $sizeof_int $bitof_int
@ISA = qw(Exporter);
%EXPORT_TAGS = (
common => [ qw(__ even odd min max sqr sum sign product bool listlength bool2text to_int to_float ikeys member divide is_empty_array_ref is_empty_hash_ref add2hash add2hash_ set_new set_add round round_up round_down first second top uniq translate untranslate warp_text formatAlaTeX) ],
- functional => [ qw(fold_left compose map_index grep_index map_tab_hash mapn mapn_ difference2 before_leaving catch_cdie cdie) ],
+ functional => [ qw(fold_left compose map_index grep_index map_each grep_each map_tab_hash mapn mapn_ difference2 before_leaving catch_cdie cdie) ],
file => [ qw(dirname basename touch all glob_ cat_ chop_ mode) ],
system => [ qw(sync makedev unmakedev psizeof strcpy gettimeofday syscall_ crypt_ getVarsFromSh setVarsInSh) ],
constant => [ qw($printable_chars $sizeof_int $bitof_int $SECTORSIZE) ],
@@ -102,6 +102,20 @@ sub grep_index(&@) {
my $v; local $::i = 0;
grep { $v = &$f($::i); $::i++; $v } @_;
}
+sub map_each(&%) {
+ my ($f, %h) = @_;
+ my @l;
+ local ($::a, $::b);
+ while (($::a, $::b) = each %h) { push @l, &$f($::a, $::b) }
+ @l;
+}
+sub grep_each(&%) {
+ my ($f, %h) = @_;
+ my %l;
+ local ($::a, $::b);
+ while (($::a, $::b) = each %h) { $l{$::a} = $::b if &$f($::a, $::b) }
+ %l;
+}
#- pseudo-array-hash :)
sub map_tab_hash(&$@) {
@@ -216,11 +230,9 @@ sub unmakedev { $_[0] >> 8, $_[0] & 0xff }
sub translate {
my ($s) = @_;
my ($lang) = substr($ENV{LC_ALL} || $ENV{LANGUAGE} || $ENV{LC_MESSAGES} || $ENV{LANG} || '', 0, 2);
- unless (defined $po::I18N::{$lang}) {
- local $@;
- local $SIG{__DIE__} = 'none';
- eval { require "po/$lang.pm"; };
- }
+
+ require 'lang.pm';
+ lang::load_po ($lang) unless defined $po::I18N::{$lang}; #- the space if needed to mislead perl2fcalls (as lang is not included here)
$po::I18N::{$lang} or return $s;
my $l = *{$po::I18N::{$lang}};
$l->{$s} || $s;
diff --git a/perl-install/fs.pm b/perl-install/fs.pm
index 7379e6d2e..3e0d82c8b 100644
--- a/perl-install/fs.pm
+++ b/perl-install/fs.pm
@@ -170,7 +170,7 @@ sub mount_all($;$) {
#- order mount by alphabetical ordre, that way / < /home < /home/httpd...
foreach (sort { ($a->{mntpoint} || '') cmp ($b->{mntpoint} || '') } @$fstab) {
- mount_part($_, $prefix) if ($_->{mntpoint} || isSwap($_));
+ mount_part($_, $prefix) if $_->{mntpoint};
}
}
diff --git a/perl-install/g_auto_install b/perl-install/g_auto_install
new file mode 100755
index 000000000..41a5d3303
--- /dev/null
+++ b/perl-install/g_auto_install
@@ -0,0 +1,13 @@
+#!../perl
+
+@ARGV == 0 or die "usage: $0\n";
+
+my $dir = `pwd`;
+chomp $dir;
+$dir .= "/../../..";
+
+$ENV{PERL5LIB} = join ":", map { "$dir/$_" } @INC;
+$ENV{LD_LIBRARY_PATH} = "$dir/usr/lib";
+$ENV{PATH} = join ":", map { "$dir/$_" } split ":", "/usr/bin:/bin:/sbin:/usr/sbin:/usr/X11R6/bin";
+
+exec "../perl", "./install2", "--g_auto_install" or die;
diff --git a/perl-install/install2.pm b/perl-install/install2.pm
index ada8f5945..f8ff9c610 100644
--- a/perl-install/install2.pm
+++ b/perl-install/install2.pm
@@ -52,7 +52,7 @@ my @installSteps = (
setRootPassword => [ __("Set root password"), 1, 1, "formatPartitions" ],
addUser => [ __("Add a user"), 1, 1, "doInstallStep" ],
createBootdisk => [ __("Create bootdisk"), 1, 0, "doInstallStep" ],
- setupBootloader => [ __("Install bootloader"), 1, 1],#, "doInstallStep" ],
+ setupBootloader => [ __("Install bootloader"), 1, 1, "doInstallStep" ],
configureX => [ __("Configure X"), 1, 0, "formatPartitions" ],
exitInstall => [ __("Exit install"), 0, 0 ],
);
@@ -354,8 +354,7 @@ sub createBootdisk {
#------------------------------------------------------------------------------
sub setupBootloader {
- add2hash($o->{bootloader} ||= {}, lilo::read("$o->{prefix}/etc/lilo.conf"));
- lilo::suggest($o->{prefix}, $o->{bootloader}, $o->{hds}, $o->{fstab}, install_any::kernelVersion());
+ $o->setupBootloaderBefore if $_[1] == 1;
$o->setupBootloader($_[1] > 1);
}
#------------------------------------------------------------------------------
@@ -404,7 +403,7 @@ sub main {
log::ld("extra log messages are enabled");
#-really needed ??
- spawnSync();
+ #-spawnSync();
eval { spawnShell() };
$o->{prefix} = $::testing ? "/tmp/test-perl-install" : "/mnt";
@@ -413,7 +412,7 @@ sub main {
mkdir $o->{root}, 0755;
#- make sure we don't pick up any gunk from the outside world
- $ENV{PATH} = "/usr/bin:/bin:/sbin:/usr/sbin:/usr/X11R6/bin:$o->{prefix}/sbin:$o->{prefix}/bin:$o->{prefix}/usr/sbin:$o->{prefix}/usr/bin:$o->{prefix}/usr/X11R6/bin";
+ $ENV{PATH} = "/usr/bin:/bin:/sbin:/usr/sbin:/usr/X11R6/bin:$o->{prefix}/sbin:$o->{prefix}/bin:$o->{prefix}/usr/sbin:$o->{prefix}/usr/bin:$o->{prefix}/usr/X11R6/bin" unless $::g_auto_install;
$ENV{LD_LIBRARY_PATH} = "";
if ($::auto_install) {
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index d06f02d5c..d79dd42e3 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -47,7 +47,7 @@ sub getFile($) {
}
sub kernelVersion {
- local $_ = readlink("$::o->{prefix}/boot/vmlinuz") or $::testing && "2.2.testversion" or die "I couldn't find the kernel package!";
+ local $_ = readlink("$::o->{prefix}/boot/vmlinuz") || $::testing && "vmlinuz-2.2.testversion" or die "I couldn't find the kernel package!";
first(/vmlinuz-(.*)/);
}
@@ -60,7 +60,6 @@ sub getNextStep {
sub spawnSync {
return if $::o->{localInstall} || $::testing;
-
fork and return;
while (1) { sleep(30); sync(); }
}
diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm
index d02e735aa..bf68f7971 100644
--- a/perl-install/install_steps.pm
+++ b/perl-install/install_steps.pm
@@ -108,16 +108,15 @@ sub doPartitionDisks($$) {
sub rebootNeeded($) {
my ($o) = @_;
log::l("Rebooting...");
- exit "true";
+ exec "true";
}
sub choosePartitionsToFormat($$) {
my ($o, $fstab) = @_;
- foreach (@$fstab) {
- $_->{toFormat} = ($_->{mntpoint} && isExt2($_) || isSwap($_)) &&
- ($_->{notFormatted} || $o->{partitioning}{autoformat});
- }
+ $_->{mntpoint} = "swap" foreach grep { isSwap($_) } @$fstab;
+ $_->{toFormat} = $_->{mntpoint} &&
+ ($_->{notFormatted} || $o->{partitioning}{autoformat}) foreach @$fstab;
}
sub formatPartitions {
@@ -281,10 +280,16 @@ sub createBootdisk($) {
}
#------------------------------------------------------------------------------
+sub setupBootloaderBefore {
+ my ($o) = @_;
+ add2hash($o->{bootloader} ||= {}, lilo::read("$o->{prefix}/etc/lilo.conf"));
+ lilo::suggest($o->{prefix}, $o->{bootloader}, $o->{hds}, $o->{fstab}, install_any::kernelVersion());
+ $o->{bootloader}{keytable} ||= keyboard::kmap($o->{keyboard});
+}
+
sub setupBootloader($) {
my ($o) = @_;
return if $::g_auto_install;
- $o->{bootloader}{keytable} = keyboard::kmap($o->{keyboard}) if $o->{bootloader}{keytable} eq "1";
lilo::install($o->{prefix}, $o->{bootloader});
}
diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm
index 85ecce2b8..54812c39e 100644
--- a/perl-install/install_steps_interactive.pm
+++ b/perl-install/install_steps_interactive.pm
@@ -10,7 +10,7 @@ use vars qw(@ISA);
#-######################################################################################
#- misc imports
#-######################################################################################
-use common qw(:common :functional);
+use common qw(:common :file :functional);
use partition_table qw(:types);
use install_steps;
use pci_probing::main;
@@ -120,9 +120,9 @@ sub choosePartitionsToFormat($$) {
$o->SUPER::choosePartitionsToFormat($fstab);
- my @l = grep { $_->{mntpoint} && isExt2($_) || isSwap($_) && !$::beginner } @$fstab;
+ my @l = grep { $_->{mntpoint} && !($::beginner && isSwap($_)) } @$fstab;
$o->ask_many_from_list_ref('', _("Choose the partitions you want to format"),
- [ map { $_->{mntpoint} || type2name($_->{type}) . " ($_->{device})" } @l ],
+ [ map { isSwap($_) ? type2name($_->{type}) . " ($_->{device})" : $_->{mntpoint} } @l ],
[ map { \$_->{toFormat} } @l ]) or die "cancel";
}
@@ -529,27 +529,32 @@ failures. Would you like to create a bootdisk for your system?"), !$o->{mkbootdi
}
#------------------------------------------------------------------------------
+sub setupBootloaderBefore {
+ my ($o) = @_;
+ my $w = $o->wait_message('', _("Preparing bootloader"));
+ $o->SUPER::setupBootloaderBefore($o);
+}
+
sub setupBootloader {
my ($o, $more) = @_;
- my $b = $o->{bootloader} ||= {};
+ my $b = $o->{bootloader};
if ($::beginner && !$more) {
my @l = (__("First sector of drive"), __("First sector of boot partition"));
- $b->{onmbr} =
+ my $boot = $o->{hds}[0]{device};
+ my $onmbr = "/dev/$boot" eq $b->{boot};
+ $b->{boot} = "/dev/$boot" if !$onmbr &&
$o->ask_from_list_(_("Lilo Installation"),
_("Where do you want to install the bootloader?"),
- \@l,
- $l[!lilo::suggest_onmbr($o->{hds})]
- ) eq $l[0] unless $::beginner && $b->{onmbr};
-
-
+ \@l, $l[!$onmbr]) eq $l[0];
} else {
$::expert and $o->ask_yesorno('', _("Do you want to use lilo?")) || return;
my @l = (
-_("Boot device") => { val => \$b->{boot}, list => [ map{ $_->{device} } @{$o->{hds}}, @{$o->{fstab}} ], not_edit => !$::expert },
+_("Boot device") => { val => \$b->{boot}, list => [ map { "/dev/$_->{device}" } @{$o->{hds}}, @{$o->{fstab}} ], not_edit => !$::expert },
_("Linear (needed for some SCSI drives)") => { val => \$b->{linear}, type => "bool", text => _("linear") },
+_("Compact") => { val => \$b->{compact}, type => "bool", text => _("compact") },
_("Delay before choosing default choice") => \$b->{timeout},
_("Video mode") => { val => \$b->{vga}, list => [ keys %lilo::vga_modes ], not_edit => $::beginner },
_("Password") => { val => \$b->{password}, hidden => 1 },
@@ -570,17 +575,51 @@ _("Restrict command line options") => { val => \$b->{restricted}, type => "bool"
$b->{vga} = $lilo::vga_modes{$b->{vga}} || $b->{vga};
}
- unless ($::beginner && !$more) {
+ until ($::beginner && !$more) {
+ my $c = $o->ask_from_list_('',
+_("Here are the following entries in lilo
+You can add some more or change the existent ones."),
+ [ (map_each{ "$::b->{label} ($::a)" . ($b->{default} eq $::b->{label} && " *") } %{$b->{entries}}), __("Add"), __("Done") ],
+ );
+ $c eq "Done" and last;
+
+ if ($c eq "Add") { }
+
+ my ($name) = $c =~ /\((.*?)\)/;
+ my $e = $b->{entries}{$name};
+ my $default = $e->{label} eq $b->{default};
+
+ my @l;
+ if ($e->{type} eq "image") {
+ @l = (
+_("Image") => { val => \$name, list => [ eval { glob_("/boot/vmlinuz*") } ] },
+_("Root") => { val => \$e->{root}, list => [ map { "/dev/$_->{device}" } @{$o->{fstab}} ], not_edit => !$::expert },
+_("Append") => \$e->{append},
+_("Initrd") => { val => \$e->{initrd}, list => [ eval { glob_("/boot/initrd*") } ] },
+_("Read-write") => { val => \$e->{'read-write'}, type => 'bool' }
+ );
+ @l = @l[0..3] if $::beginner;
+ } else {
+ @l = (
+_("Root") => { val => \$name, list => [ map { "/dev/$_->{device}" } @{$o->{fstab}} ], not_edit => !$::expert },
+_("Unsafe") => { val => \$e->{unsafe}, type => 'bool' }
+ );
+ @l = @l[0..1] if $::beginner;
+ }
+ @l = (
+_("Label") => \$e->{label},
+@l,
+_("Default") => { val => \$default, type => 'bool' },
+ );
+
$o->ask_from_entries_ref('',
-_("The boot manager Mandrake uses can boot other
-operating systems as well. You need to tell me
-what partitions you would like to be able to boot
-and what label you want to use for each of them."),
- [ keys %{$b->{entries}} ],
- [ map { \$_->{label} } values %{$b->{entries}} ],
- );
+ _(""),
+ [ grep_index { even($::i) } @l ],
+ [ grep_index { odd($::i) } @l ],
+ ) or return;
+
+ $b->{default} = $default && $e->{label};
}
- my $w = $o->wait_message('', _("Installing bootloader"));
$o->SUPER::setupBootloader;
}
diff --git a/perl-install/lang.pm b/perl-install/lang.pm
index ee6931fae..8d7465729 100644
--- a/perl-install/lang.pm
+++ b/perl-install/lang.pm
@@ -172,6 +172,34 @@ sub write {
}
}
+sub load_po($) {
+ my ($lang) = @_;
+ my ($s, $from, $to, $state);
+
+ $s .= "package po::I18N;\n";
+ $s .= "\%$lang = (";
+
+ my $f; -e ($f = "$_/po/$lang.po") and last foreach @INC;
+ local *F; open F, $f or return;
+ foreach (<F>) {
+ /^msgstr/ and $state = 1;
+ /^msgid/ and $state = 2;
+
+ if (/^(#|$)/ && $state != 3) {
+ $state = 3;
+ $s .= qq("$from" => "$to",\n) if $from;
+ $from = $to = '';
+ }
+ $to .= (/"(.*)"/)[0] if $state == 1;
+ $from .= (/"(.*)"/)[0] if $state == 2;
+ }
+ $s .= ");";
+ no strict "vars";
+ eval $s;
+ !$@;
+}
+
+
#-sub load_font {
#- my ($charset) = @_;
#- my $fontFile = "lat0-sun16";
diff --git a/perl-install/share/list b/perl-install/share/list
index dfd44e102..8cea39c36 100644
--- a/perl-install/share/list
+++ b/perl-install/share/list
@@ -11,6 +11,7 @@
/usr/bin/bzip2
/usr/lib/gconv/gconv-modules
/usr/lib/gconv/ISO8859-1.so
+/usr/lib/gconv/ISO8859-2.so
/usr/lib/gconv/ISO8859-9.so
/usr/lib/perl5/5.00503/AutoLoader.pm
/usr/lib/perl5/5.00503/Carp.pm
diff --git a/perl-install/share/po/Makefile b/perl-install/share/po/Makefile
index 0ea2c8d82..879f17a6c 100644
--- a/perl-install/share/po/Makefile
+++ b/perl-install/share/po/Makefile
@@ -1,15 +1,11 @@
PMSFILES = $(shell find .. -name "*.pm" | grep -v "^../po" | grep -v "^../c/")
PMSCFILES = $(PMSFILES:%=%_.c)
POFILES = $(shell ls *.po)
-FROMPOFILES = $(POFILES:%.po=%.pm)
-all: $(FROMPOFILES)
+all: $(POFILES)
clean:
- rm -f empty.po $(FROMPOFILES) $(POFILES:%=%t) $(PMSCFILES)
-
-$(FROMPOFILES): %.pm: %.po
- ./po2perl $< > $@
+ rm -f empty.po $(POFILES:%=%t) $(PMSCFILES)
$(POFILES): panoramix.pot
cp -f $@ $@t