summaryrefslogtreecommitdiffstats
path: root/perl-install/install_steps.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>1999-07-01 12:55:28 +0000
committerPascal Rigaux <pixel@mandriva.com>1999-07-01 12:55:28 +0000
commit3b8e5409e6265e10709f46ac179f3ea7d014fcac (patch)
treebf01ae2f5351a8bb6afe3ef30389af4eeef23d4e /perl-install/install_steps.pm
parent776c50b96e47354b7c32b56f5b1965d266fd23a7 (diff)
downloaddrakx-backup-do-not-use-3b8e5409e6265e10709f46ac179f3ea7d014fcac.tar
drakx-backup-do-not-use-3b8e5409e6265e10709f46ac179f3ea7d014fcac.tar.gz
drakx-backup-do-not-use-3b8e5409e6265e10709f46ac179f3ea7d014fcac.tar.bz2
drakx-backup-do-not-use-3b8e5409e6265e10709f46ac179f3ea7d014fcac.tar.xz
drakx-backup-do-not-use-3b8e5409e6265e10709f46ac179f3ea7d014fcac.zip
*** empty log message ***
Diffstat (limited to 'perl-install/install_steps.pm')
-rw-r--r--perl-install/install_steps.pm263
1 files changed, 122 insertions, 141 deletions
diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm
index 123507929..9e4a3c1c0 100644
--- a/perl-install/install_steps.pm
+++ b/perl-install/install_steps.pm
@@ -3,70 +3,84 @@ package install_steps;
use diagnostics;
use strict;
+use common qw(:file :system);
use lang;
use keyboard;
use pkgs;
use cpio;
use log;
use fsedit;
-
+use commands;
+use smp;
1;
-sub new($) {
- my ($type, $I) = @_;
+sub new($$) {
+ my ($type, $o) = @_;
- bless $I, ref $type || $type;
+ bless $o, ref $type || $type;
}
+sub selectInstallOrUpgrade($) {
+ my ($o) = @_;
+ $o->{isUpgrade} || $o->{default}->{isUpgrade} || 0;
+}
+sub selectInstallClass($) {
+ my ($o) = @_;
+ $o->{installClass} || $o->{default}->{installClass} || 'Custom';
+}
+sub setupSCSIInterfaces {
+ die "TODO";
+}
sub doPartitionDisks($$$) {
- my ($I, $hds) = @_;
- fsedit::auto_allocate($hds, $I->{partitions});
+ my ($o, $hds) = @_;
+ fsedit::auto_allocate($hds, $o->{partitions});
}
-sub choosePackages($$$$) {
- my ($I, $packages, $comps, $isUpgrade) = @_;
+sub choosePackages($$$) {
+ my ($o, $packages, $comps) = @_;
- foreach ('base', @{$I->{comps}}) {
+ foreach ('base', @{$o->{comps}}) {
$comps->{$_}->{selected} = 1;
foreach (@{$_->{packages}}) { $_->{selected} = 1; }
}
- foreach (@{$I->{packages}}) { $_->{selected} = 1; }
+ foreach (@{$o->{packages}}) { $_->{selected} = 1; }
smp::detect() and $packages->{"kernel-smp"}->{selected} = 1;
}
-sub beforeInstallPackages($$$) {
- my ($I, $method, $fstab, $isUpgrade) = @_;
+sub beforeInstallPackages($$) {
+ my ($o, $fstab) = @_;
- $method->prepareMedia($fstab);
+ $o->{method}->prepareMedia($fstab);
foreach (qw(dev etc home mnt tmp var var/tmp var/lib var/lib/rpm)) {
- mkdir "$prefix/$_", 0755;
+ mkdir "$o->{prefix}/$_", 0755;
}
- unless ($isUpgrade) {
+ unless ($o->{isUpgrade}) {
local *F;
- open F, "> $prefix/etc/hosts" or die "Failed to create etc/hosts: $!";
+ open F, "> $o->{prefix}/etc/hosts" or die "Failed to create etc/hosts: $!";
print F "127.0.0.1 localhost localhost.localdomain\n";
}
}
-sub installPackages($$$$$) {
- my ($I, $prefix, $method, $packages, $isUpgrade) = @_;
-
- pkgs::install($prefix, $method, $packages, $isUpgrade, 0);
+sub installPackages($$) {
+ my ($o, $packages) = @_;
+ my $toInstall = [ $packages->{basesystem},
+ grep { $_->{selected} && $_->{name} ne "basesystem" } values %$packages ];
+ pkgs::install($o->{prefix}, $o->{method}, $toInstall, $o->{isUpgrade}, 0);
}
-sub afterInstallPackages($$$$) {
- my ($prefix, $keymap, $isUpgrade) = @_;
+sub afterInstallPackages($$) {
+ my ($o, $keymap) = @_;
- unless ($isUpgrade) {
- keyboard::write($prefix, $keymap);
- lang::write($prefix);
+ unless ($o->{isUpgrade}) {
+ keyboard::write($o->{prefix}, $keymap);
+ lang::write($o->{prefix});
}
# why not?
sync(); sync();
@@ -74,46 +88,44 @@ sub afterInstallPackages($$$$) {
# configPCMCIA($o->{rootPath}, $o->{pcmcia});
}
-sub addUser($$) {
- my ($I, $prefix) = @_;
+sub addUser($) {
+ my ($o) = @_;
+ my $p = $o->{prefix};
my $new_uid;
- #my @uids = map { (split)[2] } cat__("$prefix/etc/passwd");
+ #my @uids = map { (split)[2] } cat__("$p/etc/passwd");
#for ($new_uid = 500; member($new_uid, @uids); $new_uid++) {}
for ($new_uid = 500; getpwuid($new_uid); $new_uid++) {}
my $new_gid;
- #my @gids = map { (split)[2] } cat__("$prefix/etc/group");
+ #my @gids = map { (split)[2] } cat__("$p/etc/group");
#for ($new_gid = 500; member($new_gid, @gids); $new_gid++) {}
for ($new_gid = 500; getgrgid($new_gid); $new_gid++) {}
- my $homedir = "$prefix/home/$default->{user}->{name}";
+ my $homedir = "$p/home/$o->{user}->{name}";
- my $pw = crypt_($default->{user}->{password});
+ my $pw = crypt_($o->{user}->{password});
- unless ($testing) {
- {
- local *F;
- open F, ">> $prefix/etc/passwd" or die "can't append to passwd file: $!";
- print F "$default->{user}->{name}:$pw:$new_uid:$new_gid:$default->{user}->{realname}:/home/$default->{user}->{name}:$default->{user}->{shell}\n";
+ local *F;
+ open F, ">> $p/etc/passwd" or die "can't append to passwd file: $!";
+ print F "$o->{user}->{name}:$pw:$new_uid:$new_gid:$o->{user}->{realname}:/home/$o->{user}->{name}:$o->{user}->{shell}\n";
- open F, ">> $prefix/etc/group" or die "can't append to group file: $!";
- print F "$default->{user}->{name}::$new_gid:\n";
- }
- eval { commands::cp("-f", "$prefix/etc/skel", $homedir) }; $@ and log::l("copying of skel failed: $@"), mkdir($homedir, 0750);
- commands::chown_("-r", "$new_uid.$new_gid", $homedir);
- }
+ open F, ">> $p/etc/group" or die "can't append to group file: $!";
+ print F "$o->{user}->{name}::$new_gid:\n";
+
+ eval { commands::cp("-f", "$p/etc/skel", $homedir) }; $@ and log::l("copying of skel failed: $@"), mkdir($homedir, 0750);
+ commands::chown_("-r", "$new_uid.$new_gid", $homedir);
}
sub setRootPassword($$) {
- my ($I, $prefix) = @_;
-
- my $pw = $default->{rootPassword};
+ my ($o) = @_;
+ my $p = $o->{prefix};
+ my $pw = $o->{rootPassword};
$pw = crypt_($pw);
- my @lines = cat_("$prefix/etc/passwd", 'die');
+ my @lines = cat_("$p/etc/passwd", 'die');
local *F;
- open F, "> $prefix/etc/passwd" or die "can't write in passwd: $!\n";
+ open F, "> $p/etc/passwd" or die "can't write in passwd: $!\n";
foreach (@lines) {
s/^root:.*?:/root:$pw:/;
print F $_;
@@ -122,99 +134,68 @@ sub setRootPassword($$) {
sub setupXfree {
-# my ($method, $prefix, $psp) = @_;
-# int fd, i;
-# char buf[200], * chptr;
-# char server[50];
-# int rc;
-# char * path;
-# char * procPath;
-# rpmdb db;
-# rpmTransactionSet trans;
-# struct callbackInfo cbi;
-# rpmProblemSet probs;
-#
-# if (rpmdbOpen(prefix, &db, O_RDWR | O_CREAT, 0644)) {
-# errorWindow(_("Fatal error reopening RPM database"));
-# return INST_ERROR;
-# }
-# log::l("reopened rpm database");
-#
-# path = alloca(strlen(prefix) + 200);
-# procPath = alloca(strlen(prefix) + 50);
-# sprintf(path, "%s/usr/X11R6/bin/Xconfigurator", prefix);
-#
-# # This is a cheap trick to see if our X component was installed
-# if (access(path, X_OK)) {
-# log::l("%s cannot be run", path);
-# return INST_OKAY;
-# }
-#
-# # need proc to do pci probing
-# sprintf(procPath, "%s/proc", prefix);
-# umount(procPath);
-# if ((rc = doMount("/proc", procPath, "proc", 0, 0))) {
-# return INST_ERROR;
-# }
-#
-# # this handles kickstart and normal/expert modes
-# if ((rc=xfree86Config(prefix, "--pick")))
-# return INST_ERROR;
-#
-# sprintf(path, "%s/tmp/SERVER", prefix);
-# if ((fd = open(path, O_RDONLY)) < 0) {
-# log::l("failed to open %s: %s", path, strerror(errno));
-# return INST_ERROR;
-# }
-#
-# buf[0] = '\0';
-# read(fd, buf, sizeof(buf));
-# close(fd);
-# chptr = buf;
-# while (chptr < (buf + sizeof(buf) - 1) && *chptr && *chptr != ' ')
-# chptr++;
-#
-# if (chptr >= (buf + sizeof(buf) - 1) || *chptr != ' ') {
-# log::l("couldn't find ' ' in %s", path);
-# return INST_ERROR;
-# }
-#
-# *chptr = '\0';
-# strcpy(server, "XFree86-");
-# strcat(server, buf);
-#
-# log::l("I will install the %s package", server);
-#
-# for (i = 0; i < psp->numPackages; i++) {
-# if (!strcmp(psp->packages[i]->name, server)) {
-# log::l("\tfound package: %s", psp->packages[i]->name);
-# swOpen(1, psp->packages[i]->size);
-# trans = rpmtransCreateSet(db, prefix);
-# rpmtransAddPackage(trans, psp->packages[i]->h, NULL,
-# psp->packages[i], 0, NULL);
-#
-# cbi.method = method;
-# cbi.upgrade = 0;
-#
-# rpmRunTransactions(trans, swCallback, &cbi, NULL, &probs, 0,
-# 0xffffffff);
-#
-# swClose();
-# break;
-# }
-# }
-#
-# # this handles kickstart and normal/expert modes
-# if ((rc=xfree86Config(prefix, "--continue")))
-# return INST_ERROR;
-#
-# # done with proc now
-# umount(procPath);
-#
-# rpmdbClose(db);
-#
-# log::l("rpm database closed");
-#
-# return INST_OKAY;
+
+ if (rpmdbOpen(prefix, &db, O_RDWR | O_CREAT, 0644)) {
+ errorWindow(_("Fatal error reopening RPM database"));
+ return INST_ERROR;
+ }
+ log::l("reopened rpm database");
+
+ sprintf(path, "%s/tmp/SERVER", prefix);
+ if ((fd = open(path, O_RDONLY)) < 0) {
+ log::l("failed to open %s: %s", path, strerror(errno));
+ return INST_ERROR;
+ }
+
+ buf[0] = '\0';
+ read(fd, buf, sizeof(buf));
+ close(fd);
+ chptr = buf;
+ while (chptr < (buf + sizeof(buf) - 1) && *chptr && *chptr != ' ')
+ chptr++;
+
+ if (chptr >= (buf + sizeof(buf) - 1) || *chptr != ' ') {
+ log::l("couldn't find ' ' in %s", path);
+ return INST_ERROR;
+ }
+
+ *chptr = '\0';
+ strcpy(server, "XFree86-");
+ strcat(server, buf);
+
+ log::l("I will install the %s package", server);
+
+ for (i = 0; i < psp->numPackages; i++) {
+ if (!strcmp(psp->packages[i]->name, server)) {
+ log::l("\tfound package: %s", psp->packages[i]->name);
+ swOpen(1, psp->packages[i]->size);
+ trans = rpmtransCreateSet(db, prefix);
+ rpmtransAddPackage(trans, psp->packages[i]->h, NULL,
+ psp->packages[i], 0, NULL);
+
+ cbi.method = method;
+ cbi.upgrade = 0;
+
+ rpmRunTransactions(trans, swCallback, &cbi, NULL, &probs, 0,
+ 0xffffffff);
+
+ swClose();
+ break;
+ }
+ }
+
+ # this handles kickstart and normal/expert modes
+ if ((rc=xfree86Config(prefix, "--continue")))
+ return INST_ERROR;
+
+ # done with proc now
+ umount(procPath);
+
+ rpmdbClose(db);
+
+ log::l("rpm database closed");
+
+ return INST_OKAY;
}
+sub exitInstall {}