summaryrefslogtreecommitdiffstats
path: root/installer/OpenSLX/OSSetup/Distro
diff options
context:
space:
mode:
authorOliver Tappe2007-07-28 16:11:27 +0200
committerOliver Tappe2007-07-28 16:11:27 +0200
commitcbce11c51c6aa5674b01821a7adc7c31f7999c7e (patch)
tree38fd368f9b9d1a7db30131578d7fb77060d9800d /installer/OpenSLX/OSSetup/Distro
parent* added example settings file for ubuntu-6.10 (diff)
downloadcore-cbce11c51c6aa5674b01821a7adc7c31f7999c7e.tar.gz
core-cbce11c51c6aa5674b01821a7adc7c31f7999c7e.tar.xz
core-cbce11c51c6aa5674b01821a7adc7c31f7999c7e.zip
* changed several class interfaces as a result of trying to integrate support
for Debian & Ubunto installation (which is still not complete, though) * fixed some bugs along the way (especially the meta-packagers trying to invoke a private function of OpenSLX::OSSetup::Engine) git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1281 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'installer/OpenSLX/OSSetup/Distro')
-rw-r--r--installer/OpenSLX/OSSetup/Distro/Base.pm62
-rw-r--r--installer/OpenSLX/OSSetup/Distro/SUSE.pm6
-rw-r--r--installer/OpenSLX/OSSetup/Distro/SUSE_10_1.pm2
-rw-r--r--installer/OpenSLX/OSSetup/Distro/Ubuntu_6_10.pm7
4 files changed, 65 insertions, 12 deletions
diff --git a/installer/OpenSLX/OSSetup/Distro/Base.pm b/installer/OpenSLX/OSSetup/Distro/Base.pm
index 9b59a828..020215ea 100644
--- a/installer/OpenSLX/OSSetup/Distro/Base.pm
+++ b/installer/OpenSLX/OSSetup/Distro/Base.pm
@@ -20,6 +20,7 @@ our $VERSION = 1.01; # API-version . implementation-version
use File::Basename;
use OpenSLX::Basics;
+use OpenSLX::Utils;
################################################################################
### interface methods
@@ -121,6 +122,63 @@ sub initDistroInfo
sub startSession
{
+ my $self = shift;
+ my $osDir = shift;
+
+ # ensure that the session will be finished even if the script crashes:
+ addCleanupFunction(
+ "slxos-setup::distro::chroot", sub { $self->finishSession(); }
+ );
+
+ # make sure there's a /dev/zero and /dev/null
+ if (!-e "$osDir/dev" && !mkdir("$osDir/dev")) {
+ die _tr("unable to create folder '%s' (%s)\n", "$osDir/dev", $!);
+ }
+ if (!-e "$osDir/dev/zero" && slxsystem("mknod $osDir/dev/zero c 1 5")) {
+ die _tr("unable to create node '%s' (%s)\n", "$osDir/dev/zero", $!);
+ }
+ if (!-e "$osDir/dev/null" && slxsystem("mknod $osDir/dev/null c 1 3")) {
+ die _tr("unable to create node '%s' (%s)\n", "$osDir/dev/null", $!);
+ }
+
+ # fake proc, depending on what is needed ...
+ if (!-e "$osDir/proc" && !mkdir("$osDir/proc")) {
+ die _tr("unable to create folder '%s' (%s)\n", "$osDir/proc", $!);
+ }
+ if (!-e "$osDir/proc/cpuinfo" && slxsystem("cp /proc/cpuinfo $osDir/proc/")) {
+ die _tr("unable to copy file '%s' (%s)\n", "/proc/cpuinfo", $!);
+ }
+ # TODO: alternatively, we could mount proc, but that causes problems
+ # when we are not able to umount it properly (which may happen
+ # if 'umount' is not available in the chroot!)
+ #
+ # mount /proc
+# if (!-e "$osDir/proc") {
+# slxsystem("mkdir -p $osDir/proc");
+# }
+# if (slxsystem("mount -t proc proc $osDir/proc 2>/dev/null")) {
+# die _tr("unable to mount '%s' (%s)\n", "$osDir/proc", $!);
+# }
+
+ # enter chroot jail
+ chrootInto($osDir);
+ $ENV{PATH} = "/bin:/sbin:/usr/bin:/usr/sbin";
+
+ return;
+}
+
+sub finishSession
+{
+ my $self = shift;
+
+ removeCleanupFunction('slxos-setup::distro::chroot');
+
+ # unmount /proc
+# if (slxsystem('ash', '-c', 'umount /proc 2>/dev/null')) {
+# die _tr("unable to unmount '%s' (%s)\n", "/proc", $!);
+# }
+
+ return;
}
sub updateDistroConfig
@@ -130,10 +188,6 @@ sub updateDistroConfig
}
}
-sub finishSession
-{
-}
-
sub pickKernelFile
{
my $self = shift;
diff --git a/installer/OpenSLX/OSSetup/Distro/SUSE.pm b/installer/OpenSLX/OSSetup/Distro/SUSE.pm
index 065fbf2c..0662cd64 100644
--- a/installer/OpenSLX/OSSetup/Distro/SUSE.pm
+++ b/installer/OpenSLX/OSSetup/Distro/SUSE.pm
@@ -49,12 +49,8 @@ sub updateDistroConfig
{
my $self = shift;
- # make sure there's a /dev/zero, as SuSEconfig requires it:
- if (!-e "/dev/zero" && slxsystem("mknod /dev/zero c 1 5")) {
- die _tr("unable to create node '%s' (%s)\n", "/dev/zero", $!);
- }
# invoke SuSEconfig in order to allow it to update the configuration:
- if (slxsystem("SuSEconfig")) {
+ if (slxsystem('SuSEconfig')) {
die _tr("unable to run SuSEconfig (%s)", $!);
}
$self->SUPER::updateDistroConfig();
diff --git a/installer/OpenSLX/OSSetup/Distro/SUSE_10_1.pm b/installer/OpenSLX/OSSetup/Distro/SUSE_10_1.pm
index 27125f41..3a00dd0c 100644
--- a/installer/OpenSLX/OSSetup/Distro/SUSE_10_1.pm
+++ b/installer/OpenSLX/OSSetup/Distro/SUSE_10_1.pm
@@ -57,7 +57,7 @@ sub initDistroInfo
ftp://ftp.estpak.ee/pub/suse/opensuse/distribution/SL-10.1/non-oss-inst-source
ftp://ftp.jaist.ac.jp/pub/Linux/openSUSE/distribution/SL-10.1/non-oss-inst-source
",
- 'name' => 'openSUSE 10.2 non-OSS',
+ 'name' => 'openSUSE 10.1 non-OSS',
'repo-subdir' => 'suse',
},
'base_update' => {
diff --git a/installer/OpenSLX/OSSetup/Distro/Ubuntu_6_10.pm b/installer/OpenSLX/OSSetup/Distro/Ubuntu_6_10.pm
index 4225b9aa..2882212f 100644
--- a/installer/OpenSLX/OSSetup/Distro/Ubuntu_6_10.pm
+++ b/installer/OpenSLX/OSSetup/Distro/Ubuntu_6_10.pm
@@ -27,7 +27,9 @@ sub new
{
my $class = shift;
my $self = {
- 'base-name' => 'ubuntu-6.10',
+ 'base-name' => 'ubuntu-6.10',
+ 'arch' => 'i386',
+ 'release-name' => 'edgy',
};
return bless $self, $class;
}
@@ -38,6 +40,7 @@ sub initDistroInfo
$self->{config}->{'repository'} = {
'base' => {
'urls' => "
+ ftp://localhost/pub/ubuntu
",
'name' => 'Ubuntu 6.10',
'repo-subdir' => 'dists/edgy',
@@ -47,7 +50,7 @@ sub initDistroInfo
$self->{config}->{'package-subdir'} = 'pool';
$self->{config}->{'prereq-packages'} = "
- main/d/debootstrap/debootstrap_0.3.3.0ubuntu7_all.deb
+ main/d/debootstrap/debootstrap_1.0.0_all.deb
";
$self->{config}->{'bootstrap-prereq-packages'} = "