summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>1999-07-15 14:58:15 +0000
committerPascal Rigaux <pixel@mandriva.com>1999-07-15 14:58:15 +0000
commite4fb0c6d7fbe0fc8f8659f0d39510aad4dc95999 (patch)
tree4b2d6c4b02fdfb534e1eaa2ffb44426cb0fc148b /perl-install
parent39b51c96e54f880be2d2fb909f44118a6c209d7c (diff)
downloaddrakx-backup-do-not-use-e4fb0c6d7fbe0fc8f8659f0d39510aad4dc95999.tar
drakx-backup-do-not-use-e4fb0c6d7fbe0fc8f8659f0d39510aad4dc95999.tar.gz
drakx-backup-do-not-use-e4fb0c6d7fbe0fc8f8659f0d39510aad4dc95999.tar.bz2
drakx-backup-do-not-use-e4fb0c6d7fbe0fc8f8659f0d39510aad4dc95999.tar.xz
drakx-backup-do-not-use-e4fb0c6d7fbe0fc8f8659f0d39510aad4dc95999.zip
*** empty log message ***
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/Makefile40
-rw-r--r--perl-install/c/Makefile.PL1
-rw-r--r--perl-install/install2.pm20
-rw-r--r--perl-install/install_steps.pm11
-rw-r--r--perl-install/install_steps_stdio.pm196
-rw-r--r--perl-install/partition_table.pm15
-rw-r--r--perl-install/share/list37
7 files changed, 289 insertions, 31 deletions
diff --git a/perl-install/Makefile b/perl-install/Makefile
index d05997e96..220488b25 100644
--- a/perl-install/Makefile
+++ b/perl-install/Makefile
@@ -1,13 +1,13 @@
SO_FILES = c/blib/arch/auto/c/c.so
PMS = *.pm c/*.pm resize_fat/*.pm commands diskdrake
-DEST = /tmp/t
+DEST = /tmp/t/Mandrake/instimage
DESTREP4PMS = $(DEST)/usr/bin/perl-install
PERL = perl
LOCALFILES = $(PERL) mouseconfig fr.map
.PHONY: all tags install clean verify_c
-all: $(SO_FILES)
+all: $(SO_FILES) install1_hd
tags:
etags -o - $(PMS) | perl2etags > TAGS
@@ -21,10 +21,10 @@ tar: clean
cd .. ; tar cfy perl-install.tar.bz2 $(LOCALFILES:%=--exclude %) perl-install
tar-diskdrake: clean
- cd .. ; cp -af perl-install diskdrake
+ cd .. ; rm -rf diskdrake ; cp -af perl-install diskdrake
l=`perl2fcalls -uses -excludec diskdrake | sort | uniq | sed -e 's/::/\//' -e 's/^/diskdrake\//' -e 's/$$/.pm/'` ; \
- cd .. ; tar cfvy diskdrake.tar.bz2 diskdrake/diskdrake $$l
+ cd .. ; tar cfz diskdrake.tgz --exclude CVS diskdrake/c diskdrake/diskdrake* $$l
c/c.xs: c/c.xs.pm
rm -f $@
@@ -35,6 +35,9 @@ $(SO_FILES): c/c.xs
test -e c/Makefile || (cd c; perl Makefile.PL)
$(MAKE) -C c
+install1_hd: install1_hd.c
+ $(CC) -static -Wall -o $@ $<
+
test_pms: verify_c
perl2fcalls -excludec install2.pm
(for i in $(PMS); do perl -cw -I. -Ic -Ic/blib/arch $$i || exit 1 ; done)
@@ -64,20 +67,21 @@ install_pms: $(SO_FILES)
get_needed_files: $(SO_FILES)
# export PERL_INSTALL_TEST=1 ; strace -f -e trace=file -o '| grep -v "(No such file or directory)" | sed -e "s/[^\"]*\"//" -e "s/\".*//" | grep "^/" | grep -v -e "^/tmp" -e "^/home" -e "^/proc" -e "^/var" -e "^/dev" -e "^/etc" -e "^/usr/lib/rpm" > /tmp/list ' $(PERL) -d install2.pm < /dev/null
cp -f list /tmp/list
- for i in $(LOCALFILES) `cat /tmp/list` ; do \
+ for i in c/blib/arch/auto/c/c.so $(LOCALFILES) `cat /tmp/list` ; do \
ldd $$i 2>/dev/null | sed -e 's/.*=> //' -e 's/ .*//' | uniq | sort >> /tmp/list; \
done
install -d $(DEST)/lib
install -d $(DEST)/bin
install -d $(DEST)/usr/bin
+ install -d $(DEST)/usr/lib
install -s $(LOCALFILES) $(DEST)/usr/bin
for i in `cat /tmp/list`; do \
if (echo $$i | grep "lib/[^/]*\.so"); then \
install -s $$i $(DEST)/lib; \
else \
- d=`echo $(DEST)/$$i | sed -e 's/\/usr\/local\//\/usr\//' -e 's/\/sbin\//\/bin\//'`; \
+ d=`echo $(DEST)/$$i | sed 's/\/usr\/local\//\/usr\//'`; \
install -d `dirname $$d` && \
if (echo $$i | grep "\.pm"); then \
perl -pe '$$_ eq "__END__" and exit(0);' $$i > $$d; \
@@ -88,14 +92,13 @@ get_needed_files: $(SO_FILES)
fi; \
done
- ln -sf ../usr/bin/tr $(DEST)/bin/tr
- ln -sf sh $(DEST)/bin/bash
- ln -sf ash $(DEST)/bin/sh
- ln -sf ../../bin/sh $(DEST)/usr/bin/sh
- ln -sf ../../bin/mke2fs $(DEST)/usr/bin/mke2fs
+ mv -f $(DEST)/bin/* $(DEST)/sbin/* $(DEST)/usr/bin
+ rmdir $(DEST)/bin $(DEST)/sbin
+
+ ln -s ash $(DEST)/usr/bin/sh
- install -d $(DEST)/lib/fonts
- cp -a /usr/lib/X11/fonts/misc $(DEST)/lib/fonts
+ install -d $(DEST)/usr/X11R6/lib/X11/fonts/
+ cp -a /usr/X11R6/lib/X11/fonts/misc $(DEST)/usr/X11R6/lib/X11/fonts/
echo -e "#!/usr/bin/perl\n\nsymlink '/tmp/rhimage/usr/lib/perl5', '/usr/lib/perl5';\nexec '/usr/bin/sh'" > $(DEST)/usr/bin/runinstall2
chmod a+x $(DEST)/usr/bin/runinstall2
@@ -108,15 +111,14 @@ as_root:
chmod a+w /mnt/initrd
full_stage2:
- rm -rf $(DEST)/[^M]*
- rm -f $(DEST)/Mandrake/instimage ; ln -s .. $(DEST)/Mandrake/instimage
- @#mkdir -p $(DEST)/Mandrake/base
- @#ln -s .. $(DEST)/Mandrake/instimage
+ rm -rf $(DEST)
+ mkdir $(DEST)
$(MAKE) get_needed_files
$(MAKE) stage2
stage2:
$(MAKE) install_pms
+ cd $(DEST) ; tar cfz $(DEST).tgz [^M]* ; mv $(DEST).tgz /tmp/t.tgz
@#rm -rf /mnt/initrd/*
@#cp -a $(DEST)/* /mnt/initrd
@@ -125,3 +127,7 @@ stage2:
# function f() { grep "$*" /usr/include/*.h /usr/include/*/*.h; }
+
+# dd if=/dev/zero of=/tmp/initrd bs=1k count=2000 ; echo y | mke2fs /tmp/initrd ; mount /tmp/initrd /mnt/disk/ -o loop ; cp -a /tmp/disk/* /mnt/disk/ ; umount /mnt/disk ; gzip -c /tmp/initrd > /tmp/initrd.img ; mcopy -o /tmp/initrd.img a:
+# mount /tmp/initrd /mnt/disk/ -o loop ; ; umount /mnt/disk ; gzip -c /tmp/initrd > /tmp/initrd.img ; mcopy -o /tmp/initrd.img a:
+
diff --git a/perl-install/c/Makefile.PL b/perl-install/c/Makefile.PL
index 0562ec1a3..f9d2309f8 100644
--- a/perl-install/c/Makefile.PL
+++ b/perl-install/c/Makefile.PL
@@ -5,7 +5,6 @@ WriteMakefile(
'NAME' => 'c',
'VERSION_FROM' => 'c.pm', # finds $VERSION
'LIBS' => ['-lrpm -ldb1 -lz -L/usr/X11R6/lib -lX11 -lgdk'], # e.g., '-lm'
-# 'OBJECT' => 'c.o librpm.a',
'DEFINE' => '', # e.g., '-DHAVE_SOMETHING'
'INC' => '-Wall `gtk-config --cflags`', # e.g., '-I/usr/include/other'
);
diff --git a/perl-install/install2.pm b/perl-install/install2.pm
index fc75182e5..4ae7c89b8 100644
--- a/perl-install/install2.pm
+++ b/perl-install/install2.pm
@@ -84,7 +84,7 @@ my @serverPartitioning = (
);
my $default = {
-# display => "192.168.1.8:0",
+# display => "jaba:1",
user => { name => 'foo', password => 'foo', shell => '/bin/bash', realname => 'really, it is foo' },
rootPassword => 'toto',
lang => 'us',
@@ -94,13 +94,14 @@ my $default = {
mkbootdisk => 0,
comps => [ qw() ],
packages => [ qw() ],
- partitionning => { clearall => 1, eraseBadPartitions => 1, autoformat => 1 },
+ partitionning => { clearall => 0, eraseBadPartitions => 1, autoformat => 1 },
partitions => [
{ mntpoint => "/boot", size => 16 << 11, type => 0x83 },
{ mntpoint => "/", size => 300 << 11, type => 0x83 },
{ mntpoint => "swap", size => 64 << 11, type => 0x82 },
# { mntpoint => "/usr", size => 400 << 11, type => 0x83, growable => 1 },
],
+ shells => [ map { "/bin/$_" } qw(bash tcsh zsh ash) ],
};
$o = { default => $default };
@@ -113,6 +114,8 @@ sub selectPath {
sub selectInstallClass {
$o->{installClass} = $o->selectInstallClass;
+ $testing and $o->{default}->{partitionning}->{clearall} = 1;
+
if ($o->{installClass} eq 'Server') {
#TODO
}
@@ -138,7 +141,12 @@ sub partitionDisks {
unless ($testing) {
# Write partitions to disk
- foreach (@{$o->{hds}}) { partition_table::write($_); }
+ my $need_reboot = 0;
+ foreach (@{$o->{hds}}) {
+ eval { partition_table::write($_); };
+ $need_reboot ||= $@;
+ }
+ $need_reboot and $o->rebootNeeded;
}
}
@@ -164,6 +172,12 @@ sub findInstallFiles {
sub choosePackages {
$o->choosePackages($o->{packages}, $o->{comps});
+
+ $o->{comps}->{Base}->{selected} = 1;
+
+ foreach (grep { $_->{selected} } values %{$o->{comps}}) {
+ foreach (@{$_->{packages}}) { $_->{selected} = 1 }
+ }
smp::detect() and $o->{packages}->{"kernel-smp"}->{selected} = 1;
}
diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm
index ad993b590..779a3bbc4 100644
--- a/perl-install/install_steps.pm
+++ b/perl-install/install_steps.pm
@@ -46,6 +46,12 @@ sub doPartitionDisks($$) {
my ($o, $hds) = @_;
fsedit::auto_allocate($hds, $o->{default}->{partitions});
}
+sub rebootNeeded($) {
+ my ($o) = @_;
+ log::l("Rebooting...");
+ exit(0);
+}
+
sub choosePartitionsToFormat($$) {
my ($o, $fstab) = @_;
@@ -58,10 +64,7 @@ sub choosePartitionsToFormat($$) {
sub choosePackages($$$) {
my ($o, $packages, $comps) = @_;
- foreach ('Base', @{$o->{default}->{comps}}) {
- $comps->{$_}->{selected} = 1;
- foreach (@{$comps->{$_}->{packages}}) { $_->{selected} = 1; }
- }
+ foreach (@{$o->{default}->{comps}}) { $comps->{$_}->{selected} = 1; }
foreach (@{$o->{default}->{packages}}) { $packages->{$_}->{selected} = 1; }
}
diff --git a/perl-install/install_steps_stdio.pm b/perl-install/install_steps_stdio.pm
new file mode 100644
index 000000000..c752e62df
--- /dev/null
+++ b/perl-install/install_steps_stdio.pm
@@ -0,0 +1,196 @@
+package install_steps_stdio;
+
+use diagnostics;
+use strict;
+use vars qw(@ISA);
+
+@ISA = qw(install_steps);
+
+use common qw(:common);
+use partition_table qw(:types);
+use devices;
+use run_program;
+use install_steps;
+use install_any;
+use diskdrake;
+use lang;
+use log;
+
+1;
+
+sub chooseLanguage($) {
+ my $lang = ask_from_list('Language', 'Which language do you want?', [ lang::list() ]);
+ run_program::run('xmodmap', "/usr/bin/$lang.map");
+ $lang;
+}
+
+sub selectInstallOrUpgrade($) {
+ ask_yesorno('Install/Upgrade', 'Do you want to upgrade an already installed Mandrake?');
+}
+
+sub rebootNeeded($) {
+ my ($o) = @_;
+ ask_warn('', "You need to reboot for the partition table modifications to take place");
+ $o->SUPER::rebootNeeded;
+}
+
+sub choosePartitionsToFormat($$) {
+ my ($o, $fstab) = @_;
+ my @l = grep { $_->{mntpoint} && (isExt2($_) || isSwap($_)) } @$fstab;
+ my @r = ask_many_from_list('', "Choose the partitions you want to format",
+ [ map { $_->{mntpoint} } @l ],
+ [ map { $_->{notFormatted} } @l ]);
+ for (my $i = 0; $i < @l; $i++) {
+ $l[$i]->{toFormat} = $r[$i];
+ }
+}
+
+sub choosePackages($$$) {
+ my ($o, $packages, $comps) = @_;
+ my @comps = values %$comps;
+ my @r = ask_many_from_list('',
+ "Choose the packages you want to install",
+ [ map { $_->{name} } @comps ],
+ [ map { $_->{selected} } @comps ]);
+
+ for (my $i = 0; $i < @comps; $i++) {
+ $comps[$i]->{selected} = $r[$i];
+ }
+}
+
+sub installPackages {
+ my $o = shift;
+
+ $::testing and exit 0;
+
+ my $old = \&log::ld;
+ local *log::ld = sub {
+ my $m = shift;
+ if ($m =~ /^starting installing/) {
+ my $name = first($_[0] =~ m|([^/]*)-.+?-|);
+ print("installing package $name");
+ } else { goto $old }
+ };
+ $o->SUPER::installPackages(@_);
+}
+
+
+sub setRootPassword($) {
+ my ($o) = @_;
+
+ my (%w);
+ do {
+ $w{password} and print "You must enter the same password, please try again\n";
+ print "Password: "; $w{password} = readln();
+ print "Password (again for confirmation): ";
+ } until ($w{password} eq readln());
+
+ $o->{default}->{rootPassword} = $w{password};
+ $o->SUPER::setRootPassword;
+}
+
+sub addUser($) {
+ my ($o) = @_;
+ my %w;
+ print "\nCreating a normal user account:\n";
+ print "Name: "; $w{name} = readln() or return;
+ do {
+ $w{password} and print "You must enter the same password, please try again\n";
+ print "Password: "; $w{password} = readln();
+ print "Password (again for confirmation): ";
+ } until ($w{password} eq readln());
+ print "Real name: "; $w{realname} = readln();
+
+ $w{shell} = ask_from_list('', 'Shell', $o->{default}->{shells});
+
+ $o->{default}->{user} = { map { $_ => $w{$_}->get_text } qw(name password realname shell) };
+ $o->SUPER::addUser;
+}
+
+sub createBootdisk($) {
+ my ($o) = @_;
+
+ $o->SUPER::createBootdisk if
+ $o->{default}->{mkbootdisk} = ask_yesorno('',
+"A custom bootdisk provides a way of booting into your Linux system without
+depending on the normal bootloader. This is useful if you don't want to install
+lilo on your system, or another operating system removes lilo, or lilo doesn't
+work with your hardware configuration. A custom bootdisk can also be used with
+the Mandrake rescue image, making it much easier to recover from severe system
+failures. Would you like to create a bootdisk for your system?");
+}
+
+sub exitInstall {
+ ask_warn('',
+"Congratulations, installation is complete.
+Remove the boot media and press return to reboot.
+For information on fixes which are available for this release of Linux Mandrake,
+consult the Errata available from http://www.linux-mandrake.com/.
+Information on configuring your system is available in the post
+install chapter of the Official Linux Mandrake User's Guide.");
+}
+
+
+
+sub readln {
+ my $l = <STDIN>;
+ chomp $l;
+ $l;
+}
+
+sub ask_warn {
+ my ($title, @msgs) = @_;
+ print "----------\n", map { "$_\n" } @_;
+ print "Press enter"; readln();
+}
+
+sub ask_yesorno {
+ my ($title, @msgs) = @_;
+ print "----------\n", join("\n", @_);
+ print " (yes/No) "; readln() =~ /y/i;
+
+}
+
+sub check_it {
+ my ($i, $n) = @_;
+ $i =~ /^\s*\d+\s*$/ && 1 <= $i && $i <= $n
+}
+
+sub ask_from_list {
+ my ($title, @msgs) = @_;
+ my $list = pop @msgs;
+ print "----------\n", map { "$_\n" } @msgs;
+ my $n = 0; foreach (@$list) { $n++; print "$n: $_\n"; }
+ my $i;
+ do {
+ defined $i and print "Bad choice, try again\n";
+ print "Your choice? (1/$n) ";
+ $i = readln();
+ } until (check_it($i, $n));
+ $list->[$i - 1];
+}
+
+sub ask_many_from_list {
+ my ($title, @msgs) = @_;
+ my $default = pop @msgs;
+ my $list = pop @msgs;
+ my @defaults;
+ print "----------\n", map { "$_\n" } @msgs;
+ my $n = 0; foreach (@$list) {
+ $n++;
+ print "$n: $_\n";
+ push @defaults, $n if $default->[$n - 1];
+ }
+ my $i;
+ TRY_AGAIN:
+ defined $i and print "Bad choice, try again\n";
+ print "Your choice? (default ", join(',', @defaults), " enter `none' for none) ";
+ $i = readln();
+ my @t = split ',', $i;
+ foreach (@t) { check_it($_, $n) or goto TRY_AGAIN }
+
+ my @rr = (0) x @$list;
+ foreach (@t) { $rr[$_ - 1] = 1; }
+ @rr;
+}
+
diff --git a/perl-install/partition_table.pm b/perl-install/partition_table.pm
index d4c8b2484..3ebd47122 100644
--- a/perl-install/partition_table.pm
+++ b/perl-install/partition_table.pm
@@ -168,7 +168,7 @@ sub read($;$) {
$hd->{primary} = $pt;
$hd->{extended} = undef;
- $clearall and return $hd->{isDirty} = 1;
+ $clearall and return $hd->{isDirty} = $hd->{needKernelReread} = 1;
my @l = (@{$pt->{normal}}, $pt->{extended});
foreach my $i (@l) { foreach (@l) {
@@ -226,8 +226,11 @@ sub write($) {
$hd->{isDirty} = 0;
# now sync disk and re-read the partition table
- sync();
- partition_table_raw::kernel_read($hd);
+ if ($hd->{needKernelReread}) {
+ sync();
+ partition_table_raw::kernel_read($hd);
+ $hd->{needKernelReread} = 0;
+ }
}
sub active($$) {
@@ -249,7 +252,7 @@ sub remove($$) {
splice(@{$hd->{primary}->{normal}}, $i, 1);
%$_ = ();
- return $hd->{isDirty} = 1;
+ return $hd->{isDirty} = $hd->{needKernelReread} = 1;
}
$i++;
}
@@ -260,7 +263,7 @@ sub remove($$) {
%{$last->{extended}} = $_->{extended} ? %{$_->{extended}} : ();
splice(@{$hd->{extended}}, $i, 1);
- return $hd->{isDirty} = 1;
+ return $hd->{isDirty} = $hd->{needKernelReread} = 1;
}
$last = $_;
$i++;
@@ -276,7 +279,7 @@ sub add($$) {
$part->{notFormatted} = 1;
$part->{isFormatted} = 0;
$part->{rootDevice} = $hd->{device};
- $hd->{isDirty} = 1;
+ $hd->{isDirty} = $hd->{needKernelReread} = 1;
adjustStartAndEnd($hd, $part);
if (is_empty_array_ref($hd->{primary}->{normal})) {
diff --git a/perl-install/share/list b/perl-install/share/list
new file mode 100644
index 000000000..83ca02797
--- /dev/null
+++ b/perl-install/share/list
@@ -0,0 +1,37 @@
+/bin/ash
+/sbin/mke2fs
+/usr/lib/rpm/rpmrc
+/usr/X11R6/bin/xmodmap
+/usr/X11R6/bin/XF86_VGA16
+/usr/X11R6/lib/X11/locale/compose.dir
+/usr/X11R6/lib/X11/locale/iso8859-1/Compose
+/usr/X11R6/lib/X11/locale/iso8859-1/XLC_LOCALE
+/usr/X11R6/lib/X11/locale/locale.alias
+/usr/X11R6/lib/X11/locale/locale.dir
+/usr/lib/perl5/5.00503/AutoLoader.pm
+/usr/lib/perl5/5.00503/Carp.pm
+/usr/lib/perl5/5.00503/Exporter.pm
+/usr/lib/perl5/5.00503/SelfLoader.pm
+/usr/lib/perl5/5.00503/Term/Cap.pm
+/usr/lib/perl5/5.00503/Term/ReadLine.pm
+/usr/lib/perl5/5.00503/diagnostics.pm
+/usr/lib/perl5/5.00503/dumpvar.pl
+/usr/lib/perl5/5.00503/i386-linux/Config.pm
+/usr/lib/perl5/5.00503/i386-linux/DynaLoader.pm
+/usr/lib/perl5/5.00503/i386-linux/Socket.pm
+/usr/lib/perl5/5.00503/i386-linux/auto/Socket/Socket.bs
+/usr/lib/perl5/5.00503/i386-linux/auto/Socket/Socket.so
+/usr/lib/perl5/5.00503/i386-linux/bits/syscall.ph
+/usr/lib/perl5/5.00503/i386-linux/sys/syscall.ph
+/usr/lib/perl5/5.00503/i386-linux/syscall.ph
+/usr/lib/perl5/5.00503/i386-linux/_h2ph_pre.ph
+/usr/lib/perl5/5.00503/i386-linux/asm/unistd.ph
+/usr/lib/perl5/5.00503/lib.pm
+/usr/lib/perl5/5.00503/perl5db.pl
+/usr/lib/perl5/5.00503/pod/perldiag.pod
+/usr/lib/perl5/5.00503/strict.pm
+/usr/lib/perl5/5.00503/vars.pm
+/usr/lib/perl5/site_perl/5.005/i386-linux/Gtk.pm
+/usr/lib/perl5/site_perl/5.005/i386-linux/Gtk/Types.pm
+/usr/lib/perl5/site_perl/5.005/i386-linux/auto/Gtk/Gtk.bs
+/usr/lib/perl5/site_perl/5.005/i386-linux/auto/Gtk/Gtk.so