summaryrefslogtreecommitdiffstats
path: root/installer
diff options
context:
space:
mode:
authorOliver Tappe2007-02-12 22:44:09 +0100
committerOliver Tappe2007-02-12 22:44:09 +0100
commit1455d67711a5353adabdba8183d3bc603ea7f216 (patch)
treeaff1e168c4e7bc30860613581bf472794cf621ff /installer
parentInserted start script for policykitd (needed for device access in KDE (diff)
downloadcore-1455d67711a5353adabdba8183d3bc603ea7f216.tar.gz
core-1455d67711a5353adabdba8183d3bc603ea7f216.tar.xz
core-1455d67711a5353adabdba8183d3bc603ea7f216.zip
* added perl-ified slxos-setup script and the relevant perl-modules, still not done, but
nearly there git-svn-id: http://svn.openslx.org/svn/openslx/trunk@698 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'installer')
-rw-r--r--installer/OpenSLX/OSSetup/Distro/Base.pm90
-rw-r--r--installer/OpenSLX/OSSetup/Distro/SUSE_10_1.pm52
-rw-r--r--installer/OpenSLX/OSSetup/Distro/SUSE_10_2.pm52
-rw-r--r--installer/OpenSLX/OSSetup/Engine.pm650
-rw-r--r--installer/OpenSLX/OSSetup/MetaPackager/Base.pm68
-rw-r--r--installer/OpenSLX/OSSetup/MetaPackager/yum.pm71
-rw-r--r--installer/OpenSLX/OSSetup/Packager/Base.pm84
-rw-r--r--installer/OpenSLX/OSSetup/Packager/rpm.pm88
-rwxr-xr-xinstaller/slxos-setup143
-rw-r--r--installer/systems/suse101/settings2
10 files changed, 1299 insertions, 1 deletions
diff --git a/installer/OpenSLX/OSSetup/Distro/Base.pm b/installer/OpenSLX/OSSetup/Distro/Base.pm
new file mode 100644
index 00000000..cc0f7fd9
--- /dev/null
+++ b/installer/OpenSLX/OSSetup/Distro/Base.pm
@@ -0,0 +1,90 @@
+# Base.pm - provides empty base of the OpenSLX OSSetup API.
+#
+# (c) 2006 - OpenSLX.com
+#
+# Oliver Tappe <ot@openslx.com>
+#
+package OpenSLX::OSSetup::Distro::Base;
+
+use vars qw($VERSION);
+$VERSION = 1.01; # API-version . implementation-version
+
+use strict;
+use Carp;
+use File::Basename;
+use OpenSLX::Basics;
+
+################################################################################
+### interface methods
+################################################################################
+sub new
+{
+ confess "Creating OpenSLX::OSSetup::System::Base-objects directly makes no sense!";
+}
+
+sub initialize
+{
+ my $self = shift;
+ my $engine = shift;
+
+ $self->{'engine'} = $engine;
+
+ $self->{'stage1a-binaries'} = {
+ "$openslxConfig{'share-path'}/busybox/busybox" => 'bin',
+ };
+
+ $self->{'stage1b-faked-files'} = [
+ '/etc/mtab',
+ ];
+
+ $self->{'stage1c-faked-files'} = [
+ ];
+}
+
+sub fixPrerequiredFiles
+{
+}
+
+1;
+################################################################################
+
+=pod
+
+=head1 NAME
+
+OpenSLX::OSSetup::System::Base - the base class for all OSSetup backends
+
+=head1 SYNOPSIS
+
+ package OpenSLX::OSSetup::coolnewOS;
+
+ use vars qw(@ISA $VERSION);
+ @ISA = ('OpenSLX::OSSetup::Base');
+ $VERSION = 1.01;
+
+ use coolnewOS;
+
+ sub new
+ {
+ my $class = shift;
+ my $self = {};
+ return bless $self, $class;
+ }
+
+ # override all methods of OpenSLX::OSSetup::Base in order to implement
+ # a full OS-setup backend
+ ...
+
+I<The synopsis above outlines a class that implements a
+OSSetup backend for the (imaginary) operating system B<coolnewOS>>
+
+=head1 DESCRIPTION
+
+This class defines the OSSetup interface for the OpenSLX.
+
+Aim of the OSSetup abstraction is to make it possible to install a large set
+of different operating systems transparently.
+
+...
+
+=cut
diff --git a/installer/OpenSLX/OSSetup/Distro/SUSE_10_1.pm b/installer/OpenSLX/OSSetup/Distro/SUSE_10_1.pm
new file mode 100644
index 00000000..ebf8902b
--- /dev/null
+++ b/installer/OpenSLX/OSSetup/Distro/SUSE_10_1.pm
@@ -0,0 +1,52 @@
+# SUSE_10_2.pm
+# - provides SUSE-10.1-specific overrides of the OpenSLX OSSetup API.
+#
+# (c) 2006 - OpenSLX.com
+#
+# Oliver Tappe <ot@openslx.com>
+#
+package OpenSLX::OSSetup::Distro::SUSE_10_1;
+
+use vars qw(@ISA $VERSION);
+@ISA = ('OpenSLX::OSSetup::Distro::Base');
+$VERSION = 1.01; # API-version . implementation-version
+
+use strict;
+use Carp;
+use OpenSLX::Basics;
+use OpenSLX::OSSetup::Distro::Base 1.01;
+
+################################################################################
+### implementation
+################################################################################
+sub new
+{
+ my $class = shift;
+ my $self = {
+ 'base-name' => 'suse-10.1',
+ };
+ return bless $self, $class;
+}
+
+sub initialize
+{
+ my $self = shift;
+ my $engine = shift;
+
+ $self->SUPER::initialize($engine);
+ $self->{'packager-type'} = 'rpm';
+ $self->{'meta-packager-type'} = $ENV{SLX_META_PACKAGER} || 'yum';
+ $ENV{YAST_IS_RUNNING} = "instsys";
+}
+
+sub fixPrerequiredFiles
+{
+ my $self = shift;
+ my $stage1cDir = shift;
+
+ if (system("chown root: $stage1cDir/etc/{group,passwd,shadow}")) {
+ die _tr("unable to fix pre-required files (%s)", $!);
+ }
+}
+
+1; \ No newline at end of file
diff --git a/installer/OpenSLX/OSSetup/Distro/SUSE_10_2.pm b/installer/OpenSLX/OSSetup/Distro/SUSE_10_2.pm
new file mode 100644
index 00000000..59c2353c
--- /dev/null
+++ b/installer/OpenSLX/OSSetup/Distro/SUSE_10_2.pm
@@ -0,0 +1,52 @@
+# SUSE_10_2.pm
+# - provides SUSE-10.2-specific overrides of the OpenSLX OSSetup API.
+#
+# (c) 2006 - OpenSLX.com
+#
+# Oliver Tappe <ot@openslx.com>
+#
+package OpenSLX::OSSetup::Distro::SUSE_10_2;
+
+use vars qw(@ISA $VERSION);
+@ISA = ('OpenSLX::OSSetup::Distro::Base');
+$VERSION = 1.01; # API-version . implementation-version
+
+use strict;
+use Carp;
+use OpenSLX::Basics;
+use OpenSLX::OSSetup::Distro::Base 1.01;
+
+################################################################################
+### implementation
+################################################################################
+sub new
+{
+ my $class = shift;
+ my $self = {
+ 'base-name' => 'suse-10.2',
+ };
+ return bless $self, $class;
+}
+
+sub initialize
+{
+ my $self = shift;
+ my $engine = shift;
+
+ $self->SUPER::initialize($engine);
+ $self->{'packager-type'} = 'rpm';
+ $self->{'meta-packager-type'} = $ENV{SLX_META_PACKAGER} || 'yum';
+ $ENV{YAST_IS_RUNNING} = "instsys";
+}
+
+sub fixPrerequiredFiles
+{
+ my $self = shift;
+ my $stage1cDir = shift;
+
+ if (system("chown root: $stage1cDir/etc/{group,passwd,shadow}")) {
+ die _tr("unable to fix pre-required files (%s)", $!);
+ }
+}
+
+1; \ No newline at end of file
diff --git a/installer/OpenSLX/OSSetup/Engine.pm b/installer/OpenSLX/OSSetup/Engine.pm
new file mode 100644
index 00000000..b17a094b
--- /dev/null
+++ b/installer/OpenSLX/OSSetup/Engine.pm
@@ -0,0 +1,650 @@
+# Engine.pm - provides driver enginge for the OSSetup API.
+#
+# (c) 2006 - OpenSLX.com
+#
+# Oliver Tappe <ot@openslx.com>
+#
+package OpenSLX::OSSetup::Engine;
+
+use vars qw($VERSION);
+$VERSION = 1.01; # API-version . implementation-version
+
+use strict;
+use Carp;
+use File::Basename;
+use OpenSLX::Basics;
+
+################################################################################
+### interface methods
+################################################################################
+sub new
+{
+ my $class = shift;
+
+ my $self = {
+ };
+
+ return bless $self, $class;
+}
+
+sub initialize
+{
+ my $self = shift;
+ my $distroName = shift;
+ my $protectSystemPath = shift;
+
+ # load module for the requested distro:
+ $distroName = uc($distroName);
+ $distroName =~ tr[-.][_];
+ my $distroModule = "OpenSLX::OSSetup::Distro::$distroName";
+ unless (eval "require $distroModule") {
+ if ($! == 2) {
+ die _tr("Distro-module <%s> not found!\n", $distroModule);
+ } else {
+ die _tr("Unable to load distro-module <%s> (%s)\n", $distroModule, $@);
+ }
+ }
+ my $modVersion = $distroModule->VERSION;
+ if ($modVersion < 1.01) {
+ die _tr('Could not load module <%s> (Version <%s> required, but <%s> found)',
+ $distroModule, 1.01, $modVersion);
+ }
+ $distroModule->import;
+ my $distro = $distroModule->new;
+ $distro->initialize($self);
+ $self->{distro} = $distro;
+
+ # setup path to distribution-specific info:
+ my $distroInfoDir = "../lib/distro-info/$distro->{'base-name'}";
+ if (!-d $distroInfoDir) {
+ die _tr("unable to find distro-info for system '%s'", $distro->{'base-name'})."\n";
+ }
+ $self->{'distro-info-dir'} = $distroInfoDir;
+ $self->readDistroInfo();
+
+ $self->setupSystemPaths($protectSystemPath);
+
+ $self->createPackager();
+ $self->createMetaPackager();
+}
+
+sub setupStage1A
+{
+ my $self = shift;
+
+ vlog 1, "setting up stage1a for $self->{distro}->{'base-name'}...";
+ $self->stage1A_createBusyboxEnvironment();
+ $self->stage1A_setupResolver();
+ $self->stage1A_copyPrerequiredFiles();
+ $self->stage1A_copyTrustedPackageKeys();
+ $self->stage1A_createRequiredFiles();
+}
+
+sub setupStage1B
+{
+ my $self = shift;
+
+ vlog 1, "setting up stage1b for $self->{distro}->{'base-name'}...";
+ $self->stage1B_chrootAndBootstrap();
+}
+
+sub setupStage1C
+{
+ my $self = shift;
+
+ vlog 1, "setting up stage1c for $self->{distro}->{'base-name'}...";
+ $self->stage1C_chrootAndInstallBasicSystem();
+}
+
+sub setupStage1D
+{
+ my $self = shift;
+
+ vlog 1, "setting up stage1d for $self->{distro}->{'base-name'}...";
+ $self->stage1D_setupPackageSources();
+ $self->stage1D_updateBasicSystem();
+ $self->stage1D_installPackageSelection();
+}
+
+sub setupStage1
+{
+ my $self = shift;
+
+ $self->setupStage1A();
+ my $pid = fork();
+ if (!$pid) {
+ # child, execute the tasks that involve a chrooted environment:
+ $self->setupStage1B();
+ $self->setupStage1C();
+ exit 0;
+ }
+
+ # parent, wait for child to do its work inside the chroot
+ waitpid($pid, 0);
+ $self->stage1C_cleanupBasicSystem();
+ $self->setupStage1D();
+}
+
+sub setupRepositories
+{
+ my $self = shift;
+
+ $self->setupStage1D();
+}
+
+sub fixPrerequiredFiles
+{
+}
+
+################################################################################
+### implementation methods
+################################################################################
+sub readDistroInfo
+{
+ my $self = shift;
+
+ vlog 1, "reading configuration info for $self->{distro}->{'base-name'}...";
+ my (%repository,
+ %selection,
+ $base_url,
+ $package_subdir,
+ $prereq_packages,
+ $bootstrap_prereq_packages,
+ $bootstrap_packages);
+ foreach my $fn ('settings', 'settings.local') {
+ my $file = "$self->{'distro-info-dir'}/$fn";
+ if (-e $file) {
+ vlog 3, "reading configuration file $file...";
+ my $config = slurpFile($file);
+ if (!eval $config) {
+ die _tr("error in config-file <%s> (%s)", $file, $@)."\n";
+ }
+ }
+ }
+ $self->{'distro-info'} = {
+ 'package-subdir' => $package_subdir,
+ 'prereq-packages' => $prereq_packages,
+ 'bootstrap-prereq-packages' => $bootstrap_prereq_packages,
+ 'bootstrap-packages' => $bootstrap_packages,
+ 'repository' => \%repository,
+ 'selection' => \%selection,
+ };
+ if ($openslxConfig{'verbose-level'} >= 2) {
+ # dump distro-info:
+ foreach my $r (sort keys %repository) {
+ vlog 2, "repository '$r':";
+ foreach my $k (sort keys %{$repository{$r}}) {
+ vlog 2, "\t$k = '$repository{$r}->{$k}'";
+ }
+ }
+ foreach my $s (sort keys %selection) {
+ my @selLines = split "\n", $selection{$s};
+ vlog 2, "selection '$s':";
+ foreach my $sl (@selLines) {
+ vlog 2, "\t$sl";
+ }
+ }
+ }
+}
+
+sub setupSystemPaths
+{
+ my $self = shift;
+ my $protectSystemPath = shift;
+
+ $self->{'system-path'}
+ = "$openslxConfig{'stage1-path'}/$self->{distro}->{'base-name'}";
+ vlog 1, "system will be installed to '$self->{'system-path'}'";
+ if ($protectSystemPath && -e $self->{'system-path'}) {
+ die _tr("'%s' already exists, giving up!", $self->{'system-path'});
+ }
+
+ # specify individual paths for the respective substages:
+ $self->{stage1aDir} = "$self->{'system-path'}/stage1a";
+ $self->{stage1bSubdir} = 'slxbootstrap';
+ $self->{stage1cSubdir} = 'slxfinal';
+
+ # we create *all* of the above folders by creating stage1cDir:
+ my $stage1cDir
+ = "$self->{'stage1aDir'}/$self->{'stage1bSubdir'}/$self->{'stage1cSubdir'}";
+ if (system("mkdir -p $stage1cDir")) {
+ die _tr("unable to create directory '%s', giving up! (%s)",
+ $stage1cDir, $!);
+ }
+}
+
+sub createPackager
+{
+ my $self = shift;
+
+ my $packagerModule
+ = "OpenSLX::OSSetup::Packager::$self->{distro}->{'packager-type'}";
+ unless (eval "require $packagerModule") {
+ if ($! == 2) {
+ die _tr("Packager-module <%s> not found!\n", $packagerModule);
+ } else {
+ die _tr("Unable to load packager-module <%s> (%s)\n", $packagerModule, $@);
+ }
+ }
+ my $modVersion = $packagerModule->VERSION;
+ if ($modVersion < 1.01) {
+ die _tr('Could not load module <%s> (Version <%s> required, but <%s> found)',
+ $packagerModule, 1.01, $modVersion);
+ }
+ $packagerModule->import;
+ my $packager = $packagerModule->new;
+ $packager->initialize($self);
+ $self->{'packager'} = $packager;
+}
+
+sub createMetaPackager
+{
+ my $self = shift;
+
+ my $metaPackagerModule
+ = "OpenSLX::OSSetup::MetaPackager::$self->{distro}->{'meta-packager-type'}";
+ unless (eval "require $metaPackagerModule") {
+ if ($! == 2) {
+ die _tr("Meta-packager-module <%s> not found!\n", $metaPackagerModule);
+ } else {
+ die _tr("Unable to load meta-packager-module <%s> (%s)\n", $metaPackagerModule, $@);
+ }
+ }
+ my $modVersion = $metaPackagerModule->VERSION;
+ if ($modVersion < 1.01) {
+ die _tr('Could not load module <%s> (Version <%s> required, but <%s> found)',
+ $metaPackagerModule, 1.01, $modVersion);
+ }
+ $metaPackagerModule->import;
+ my $metaPackager = $metaPackagerModule->new;
+ $metaPackager->initialize($self);
+ $self->{'meta-packager'} = $metaPackager;
+}
+
+sub selectBaseURL
+{
+ my $self = shift;
+ my $repoInfo = shift;
+
+ my $baseURL = $repoInfo->{url};
+ if (!defined $baseURL) {
+ my @baseURLs = string2Array($repoInfo->{urls});
+ # TODO: insert a closest mirror algorithm here!
+ $baseURL = $baseURLs[0];
+ }
+ return $baseURL;
+}
+
+sub stage1A_createBusyboxEnvironment
+{
+ my $self = shift;
+
+ # copy busybox and all required binaries into stage1a-dir:
+ vlog 1, "creating busybox-environment...";
+ copyFile("$openslxConfig{'share-path'}/busybox/busybox",
+ "$self->{stage1aDir}/bin");
+
+ # determine all required libraries and copy those, too:
+ vlog 2, "calling slxldd for busybox";
+ my $requiredLibsStr = `slxldd $openslxConfig{'share-path'}/busybox/busybox`;
+ chomp $requiredLibsStr;
+ vlog 2, "slxldd results:\n$requiredLibsStr";
+ foreach my $lib (split "\n", $requiredLibsStr) {
+ vlog 3, "copying lib '$lib'";
+ my $libDir = dirname($lib);
+ copyFile($lib, "$self->{stage1aDir}/$libDir");
+ }
+
+ # create all needed links to busybox:
+ my $links
+ = slurpFile("$openslxConfig{'share-path'}/busybox/busybox.links");
+ foreach my $linkTarget (split "\n", $links) {
+ linkFile('/bin/busybox', "$self->{stage1aDir}/$linkTarget");
+ }
+}
+
+sub stage1A_setupResolver
+{
+ my $self = shift;
+
+ copyFile('/etc/resolv.conf', "$self->{stage1aDir}/etc");
+ copyFile('/lib/libresolv*', "$self->{stage1aDir}/lib");
+ copyFile('/lib/libnss_dns*', "$self->{stage1aDir}/lib");
+
+ my $stage1cDir
+ = "$self->{'stage1aDir'}/$self->{'stage1bSubdir'}/$self->{'stage1cSubdir'}";
+ copyFile('/etc/resolv.conf', "$stage1cDir/etc");
+}
+
+sub stage1A_copyPrerequiredFiles
+{
+ my $self = shift;
+
+ return unless -d "$self->{'distro-info-dir'}/prereqfiles";
+
+ vlog 2, "copying folder with pre-required files...";
+ my $stage1cDir
+ = "$self->{'stage1aDir'}/$self->{'stage1bSubdir'}/$self->{'stage1cSubdir'}";
+ my $cmd = qq[
+ tar --exclude=.svn -cp -C $self->{'distro-info-dir'}/prereqfiles . \\
+ | tar -xp -C $stage1cDir
+ ];
+ if (system($cmd)) {
+ die _tr("unable to copy folder with pre-required files to folder <%s> (%s)",
+ $stage1cDir, $!);
+ }
+ $self->{distro}->fixPrerequiredFiles($stage1cDir);
+}
+
+sub stage1A_copyTrustedPackageKeys
+{
+ my $self = shift;
+
+ return unless -d "$self->{'distro-info-dir'}/trusted-package-keys";
+
+ vlog 2, "copying folder with trusted package keys...";
+ my $stage1bDir
+ = "$self->{'stage1aDir'}/$self->{'stage1bSubdir'}";
+ my $cmd = qq[
+ tar --exclude=.svn -cp -C $self->{'distro-info-dir'} trusted-package-keys \\
+ | tar -xp -C $stage1bDir
+ ];
+ if (system($cmd)) {
+ die _tr("unable to copy folder with trusted package keys to folder <%s> (%s)",
+ $stage1bDir, $!);
+ }
+ system("chmod 444 $stage1bDir/trusted-package-keys/*");
+
+ # install ultimately trusted keys (from distributor):
+ my $stage1cDir
+ = "$stage1bDir/$self->{'stage1cSubdir'}";
+ my $keyDir = "$self->{'distro-info-dir'}/trusted-package-keys";
+ copyFile("$keyDir/pubring.gpg", "$stage1cDir/usr/lib/rpm/gnupg");
+}
+
+sub stage1A_createRequiredFiles
+{
+ my $self = shift;
+
+ vlog 2, "creating required files...";
+ # fake all files required by stage1b (by creating them empty):
+ my $stage1bDir
+ = "$self->{'stage1aDir'}/$self->{'stage1bSubdir'}";
+ foreach my $fake (@{$self->{distro}->{'stage1b-faked-files'}}) {
+ fakeFile("$stage1bDir/$fake");
+ }
+
+ # fake all files required by stage1c (by creating them empty):
+ my $stage1cDir
+ = "$stage1bDir/$self->{'stage1cSubdir'}";
+ foreach my $fake (@{$self->{distro}->{'stage1c-faked-files'}}) {
+ fakeFile("$stage1cDir/$fake");
+ }
+
+ mkdir "$stage1cDir/dev";
+ if (system("mknod $stage1cDir/dev/null c 1 3")) {
+ die _tr("unable to create node <%s> (%s)", "$stage1cDir/dev/null", $!);
+ }
+}
+
+sub stage1B_chrootAndBootstrap
+{
+ my $self = shift;
+
+ vlog 2, "chrooting into $self->{stage1aDir}...";
+ # chdir into stage1aDir...
+ chdir $self->{stage1aDir}
+ or die _tr("unable to chdir into <%s> (%s)", $self->{stage1aDir}, $!);
+ # ...do chroot
+ chroot "."
+ or die _tr("unable to chroot into <%s> (%s)", $self->{stage1aDir}, $!);
+
+ $ENV{PATH} = "/bin:/sbin:/usr/bin:/usr/sbin";
+
+ # chdir into slxbootstrap, as we want to drop packages into there:
+ chdir "/$self->{stage1bSubdir}"
+ or die _tr("unable to chdir into <%s> (%s)", "/$self->{stage1bSubdir}", $!);
+
+ # fetch prerequired packages:
+ my $baseURL
+ = $self->selectBaseURL($self->{'distro-info'}->{repository}->{base});
+ my $pkgDirURL = $baseURL;
+ if (length($self->{'distro-info'}->{'package-subdir'})) {
+ $pkgDirURL .= "/$self->{'distro-info'}->{'package-subdir'}";
+ }
+ my @pkgs = string2Array($self->{'distro-info'}->{'prereq-packages'});
+ my @prereqPkgs = downloadFilesFrom(\@pkgs, $pkgDirURL);
+ $self->{packager}->unpackPackages(\@prereqPkgs);
+
+ @pkgs = string2Array($self->{'distro-info'}->{'bootstrap-prereq-packages'});
+ my @bootstrapPrereqPkgs = downloadFilesFrom(\@pkgs, $pkgDirURL);
+ $self->{'local-bootstrap-prereq-packages'} = \@bootstrapPrereqPkgs;
+
+ @pkgs = string2Array($self->{'distro-info'}->{'bootstrap-packages'});
+ my @bootstrapPkgs = downloadFilesFrom(\@pkgs, $pkgDirURL);
+ my @allPkgs = (@prereqPkgs, @bootstrapPrereqPkgs, @bootstrapPkgs);
+ $self->{'local-bootstrap-packages'} = \@allPkgs;
+}
+
+sub stage1C_chrootAndInstallBasicSystem
+{
+ my $self = shift;
+
+ my $stage1bDir = "/$self->{stage1bSubdir}";
+ vlog 2, "chrooting into $stage1bDir...";
+ # chdir into stage1bDir...
+ chdir $stage1bDir
+ or die _tr("unable to chdir into <%s> (%s)", $stage1bDir, $!);
+ # ...do chroot
+ chroot "."
+ or die _tr("unable to chroot into <%s> (%s)", $stage1bDir, $!);
+
+ $ENV{PATH} = "/bin:/sbin:/usr/bin:/usr/sbin";
+ my $stage1cDir = "/$self->{stage1cSubdir}";
+
+ # install all prerequired bootstrap packages
+ $self->{packager}->installPrerequiredPackages(
+ $self->{'local-bootstrap-prereq-packages'}, $stage1cDir
+ );
+
+ # import any additional trusted package keys to rpm-DB:
+ my $keyDir = "/trusted-package-keys";
+ opendir(KEYDIR, $keyDir)
+ or die _tr("unable to opendir <%s> (%s)", $keyDir, $!);
+ my @keyFiles
+ = map { "$keyDir/$_" }
+ grep { $_ !~ m[^(\.\.?|pubring.gpg)$] }
+ readdir(KEYDIR);
+ closedir(KEYDIR);
+ $self->{packager}->importTrustedPackageKeys(\@keyFiles, $stage1cDir);
+
+ # install all other bootstrap packages
+ $self->{packager}->installPackages(
+ $self->{'local-bootstrap-packages'}, $stage1cDir
+ );
+}
+
+sub stage1C_cleanupBasicSystem
+{
+ my $self = shift;
+
+ my $stage1cDir
+ = "$self->{'stage1aDir'}/$self->{'stage1bSubdir'}/$self->{'stage1cSubdir'}";
+ if (system("mv $stage1cDir/* $self->{'system-path'}/")) {
+ die _tr("unable to move final setup to <%s> (%s)",
+ $self->{'system-path'}, $!);
+ }
+ if (system("rm -rf $self->{stage1aDir}")) {
+ die _tr("unable to remove temporary folder <%s> (%s)",
+ $self->{stage1aDir}, $!);
+ }
+}
+
+sub stage1D_setupPackageSources()
+{
+ my $self = shift;
+
+ vlog 1, "setting up package sources for meta packager...";
+ my ($rk, $repo);
+ while(($rk, $repo) = each %{$self->{'distro-info'}->{repository}}) {
+ vlog 2, "setting up package source $rk...";
+ $self->{'meta-packager'}->setupPackageSource($rk, $repo);
+ }
+}
+
+sub stage1D_updateBasicSystem()
+{
+ my $self = shift;
+
+ # chdir into systemDir...
+ my $systemDir = $self->{'system-path'};
+ vlog 2, "chrooting into $systemDir...";
+ chdir $systemDir
+ or die _tr("unable to chdir into <%s> (%s)", $systemDir, $!);
+ # ...do chroot
+ chroot "."
+ or die _tr("unable to chroot into <%s> (%s)", $systemDir, $!);
+
+ vlog 1, "updating basic system...";
+ $self->{'meta-packager'}->updateBasicSystem();
+}
+
+sub stage1D_installPackageSelection
+{
+ my $self = shift;
+
+ vlog 1, "installing package selection...";
+}
+
+################################################################################
+### utility functions
+################################################################################
+sub copyFile
+{
+ my $fileName = shift;
+ my $dirName = shift;
+
+ my $baseName = basename($fileName);
+ my $targetName = "$dirName/$baseName";
+ if (!-e $targetName) {
+ my $targetDir = dirname($targetName);
+ system("mkdir -p $targetDir") unless -d $targetDir;
+ if (system("cp -p $fileName $targetDir/")) {
+ die _tr("unable to copy file '%s' to dir '%s' (%s)",
+ $fileName, $targetDir, $!);
+ }
+ }
+}
+
+sub fakeFile
+{
+ my $fullPath = shift;
+
+ my $targetDir = dirname($fullPath);
+ system("mkdir", "-p", $targetDir) unless -d $targetDir;
+ if (system("touch", $fullPath)) {
+ die _tr("unable to create file '%s' (%s)",
+ $fullPath, $!);
+ }
+}
+
+sub linkFile
+{
+ my $linkTarget = shift;
+ my $linkName = shift;
+
+ my $targetDir = dirname($linkName);
+ system("mkdir -p $targetDir") unless -d $targetDir;
+ if (system("ln -s $linkTarget $linkName")) {
+ die _tr("unable to create link '%s' to '%s' (%s)",
+ $linkName, $linkTarget, $!);
+ }
+}
+
+sub slurpFile
+{
+ my $file = shift;
+ open(F, "< $file")
+ or die _tr("could not open file '%s' for reading! (%s)", $file, $!);
+ $/ = undef;
+ my $text = <F>;
+ close(F);
+ return $text;
+}
+
+sub string2Array
+{
+ my $str = shift;
+
+ return
+ map { $_ =~ s[^\s*(.+?)\s*$][$1]; $_ }
+ grep { length($_) > 0 } split "\n", $str;
+}
+
+sub downloadFilesFrom
+{
+ my $files = shift;
+ my $baseURL = shift;
+
+ my @foundFiles;
+ foreach my $fileVariantStr (@$files) {
+ my $foundFile;
+ foreach my $file (split '\s+', $fileVariantStr) {
+ vlog 2, "fetching $file...";
+ if (system("wget", "$baseURL/$file") == 0) {
+ $foundFile = basename($file);
+ last;
+ }
+ }
+ if (!defined $foundFile) {
+ die _tr("unable to fetch <%s> from <%s> (%s)", $fileVariantStr,
+ $baseURL, $!);
+ }
+ push @foundFiles, $foundFile;
+ }
+ return @foundFiles;
+}
+
+1;
+################################################################################
+
+=pod
+
+=head1 NAME
+
+OpenSLX::OSSetup::System::Base - the base class for all OSSetup backends
+
+=head1 SYNOPSIS
+
+ package OpenSLX::OSSetup::coolnewOS;
+
+ use vars qw(@ISA $VERSION);
+ @ISA = ('OpenSLX::OSSetup::Base');
+ $VERSION = 1.01;
+
+ use coolnewOS;
+
+ sub new
+ {
+ my $class = shift;
+ my $self = {};
+ return bless $self, $class;
+ }
+
+ # override all methods of OpenSLX::OSSetup::Base in order to implement
+ # a full OS-setup backend
+ ...
+
+I<The synopsis above outlines a class that implements a
+OSSetup backend for the (imaginary) operating system B<coolnewOS>>
+
+=head1 DESCRIPTION
+
+This class defines the OSSetup interface for the OpenSLX.
+
+Aim of the OSSetup abstraction is to make it possible to install a large set
+of different operating systems transparently.
+
+...
+
+=cut
diff --git a/installer/OpenSLX/OSSetup/MetaPackager/Base.pm b/installer/OpenSLX/OSSetup/MetaPackager/Base.pm
new file mode 100644
index 00000000..0baa1a84
--- /dev/null
+++ b/installer/OpenSLX/OSSetup/MetaPackager/Base.pm
@@ -0,0 +1,68 @@
+# Base.pm - provides empty base of the OpenSLX OSSetup::MetaPackager API.
+#
+# (c) 2006 - OpenSLX.com
+#
+# Oliver Tappe <ot@openslx.com>
+#
+package OpenSLX::OSSetup::MetaPackager::Base;
+
+use vars qw($VERSION);
+$VERSION = 1.01; # API-version . implementation-version
+
+use strict;
+use Carp;
+
+################################################################################
+### interface methods
+################################################################################
+sub new
+{
+ confess "Creating OpenSLX::OSSetup::MetaPackager::Base-objects directly makes no sense!";
+}
+
+sub initialize
+{
+ my $self = shift;
+ my $engine = shift;
+
+ $self->{'engine'} = $engine;
+}
+
+sub setupPackageSource
+{
+}
+
+1;
+################################################################################
+
+=pod
+
+=head1 NAME
+
+OpenSLX::OSSetup::MetaPackager::Base - the base class for all OSSetup::MetaPackagers
+
+=head1 SYNOPSIS
+
+ package OpenSLX::OSSetup::MetaPackager::coolnewpkg;
+
+ use vars qw(@ISA $VERSION);
+ @ISA = ('OpenSLX::OSSetup::MetaPackager::Base');
+ $VERSION = 1.01;
+
+ use coolnewpkg;
+
+ sub new
+ {
+ my $class = shift;
+ my $self = {};
+ return bless $self, $class;
+ }
+
+ # override all methods of OpenSLX::OSSetup::MetaPackager::Base in order to
+ # implement the support for a new meta-packager
+ ...
+
+I<The synopsis above outlines a class that implements a
+OSSetup::MetaPackager for the (imaginary) meta-packager B<coolnewpkg>>
+
+=cut
diff --git a/installer/OpenSLX/OSSetup/MetaPackager/yum.pm b/installer/OpenSLX/OSSetup/MetaPackager/yum.pm
new file mode 100644
index 00000000..3673266d
--- /dev/null
+++ b/installer/OpenSLX/OSSetup/MetaPackager/yum.pm
@@ -0,0 +1,71 @@
+# yum.pm
+# - provides yum-specific overrides of the OpenSLX::OSSetup::MetaPackager API.
+#
+# (c) 2006 - OpenSLX.com
+#
+# Oliver Tappe <ot@openslx.com>
+#
+package OpenSLX::OSSetup::MetaPackager::yum;
+
+use vars qw(@ISA $VERSION);
+@ISA = ('OpenSLX::OSSetup::MetaPackager::Base');
+$VERSION = 1.01; # API-version . implementation-version
+
+use strict;
+use Carp;
+use OpenSLX::Basics;
+use OpenSLX::OSSetup::MetaPackager::Base 1.01;
+
+################################################################################
+### implementation
+################################################################################
+sub new
+{
+ my $class = shift;
+ my $self = {
+ 'name' => 'yum',
+ };
+ return bless $self, $class;
+}
+
+sub initialize
+{
+ my $self = shift;
+ my $engine = shift;
+
+ $self->SUPER::initialize($engine);
+ $ENV{LC_ALL} = 'POSIX';
+}
+
+sub setupPackageSource
+{
+ my $self = shift;
+ my $repoName = shift;
+ my $repoInfo = shift;
+
+ my $repoURL = $self->{engine}->selectBaseURL($repoInfo);
+ if (length($repoInfo->{'repo-subdir'})) {
+ $repoURL .= "/$repoInfo->{'repo-subdir'}";
+ }
+ my $repoDescr = "[$repoName]\nname=$repoInfo->{name}\nbaseurl=$repoURL\n";
+ system("cp /proc/cpuinfo $self->{engine}->{'system-path'}/proc");
+ system("mkdir -p $self->{engine}->{'system-path'}/etc/yum.repos.d");
+ my $repoFile
+ = "$self->{engine}->{'system-path'}/etc/yum.repos.d/$repoName.repo";
+ open(REPO, "> $repoFile")
+ or die _tr("unable to create repo-file <%s> (%s)", $repoFile, $1);
+ print REPO $repoDescr;
+ close(REPO);
+}
+
+sub updateBasicSystem
+{
+ my $self = shift;
+
+ if (system("yum -y update")) {
+ die _tr("unable to update basic system (%s)", $!);
+ }
+ system('rm /proc/cpuinfo');
+}
+
+1; \ No newline at end of file
diff --git a/installer/OpenSLX/OSSetup/Packager/Base.pm b/installer/OpenSLX/OSSetup/Packager/Base.pm
new file mode 100644
index 00000000..ca0fbbae
--- /dev/null
+++ b/installer/OpenSLX/OSSetup/Packager/Base.pm
@@ -0,0 +1,84 @@
+# Base.pm - provides empty base of the OpenSLX OSSetup::Packager API.
+#
+# (c) 2006 - OpenSLX.com
+#
+# Oliver Tappe <ot@openslx.com>
+#
+package OpenSLX::OSSetup::Packager::Base;
+
+use vars qw($VERSION);
+$VERSION = 1.01; # API-version . implementation-version
+
+use strict;
+use Carp;
+
+################################################################################
+### interface methods
+################################################################################
+sub new
+{
+ confess "Creating OpenSLX::OSSetup::Packager::Base-objects directly makes no sense!";
+}
+
+sub initialize
+{
+ my $self = shift;
+ my $distro = shift;
+
+ $self->{'distro'} = $distro;
+}
+
+sub unpackPackages
+{
+}
+
+sub unpackPackages
+{
+}
+
+sub importTrustedPackageKeys
+{
+}
+
+sub installPrerequiredPackages
+{
+}
+
+sub installPackages
+{
+}
+
+1;
+################################################################################
+
+=pod
+
+=head1 NAME
+
+OpenSLX::OSSetup::Packager::Base - the base class for all OSSetup::Packagers
+
+=head1 SYNOPSIS
+
+ package OpenSLX::OSSetup::Packager::coolnewpkg;
+
+ use vars qw(@ISA $VERSION);
+ @ISA = ('OpenSLX::OSSetup::Packager::Base');
+ $VERSION = 1.01;
+
+ use coolnewpkg;
+
+ sub new
+ {
+ my $class = shift;
+ my $self = {};
+ return bless $self, $class;
+ }
+
+ # override all methods of OpenSLX::OSSetup::Packager::Base in order to
+ # implement the support for a new packager
+ ...
+
+I<The synopsis above outlines a class that implements a
+OSSetup::Packager for the (imaginary) packager B<coolnewpkg>>
+
+=cut
diff --git a/installer/OpenSLX/OSSetup/Packager/rpm.pm b/installer/OpenSLX/OSSetup/Packager/rpm.pm
new file mode 100644
index 00000000..2fb2755b
--- /dev/null
+++ b/installer/OpenSLX/OSSetup/Packager/rpm.pm
@@ -0,0 +1,88 @@
+# rpm.pm
+# - provides rpm-specific overrides of the OpenSLX::OSSetup::Packager API.
+#
+# (c) 2006 - OpenSLX.com
+#
+# Oliver Tappe <ot@openslx.com>
+#
+package OpenSLX::OSSetup::Packager::rpm;
+
+use vars qw(@ISA $VERSION);
+@ISA = ('OpenSLX::OSSetup::Packager::Base');
+$VERSION = 1.01; # API-version . implementation-version
+
+use strict;
+use Carp;
+use OpenSLX::Basics;
+use OpenSLX::OSSetup::Packager::Base 1.01;
+
+################################################################################
+### implementation
+################################################################################
+sub new
+{
+ my $class = shift;
+ my $self = {
+ 'name' => 'rpm',
+ };
+ return bless $self, $class;
+}
+
+sub unpackPackages
+{
+ my $self = shift;
+ my $pkgs = shift;
+
+ foreach my $pkg (@$pkgs) {
+ vlog 2, "unpacking package $pkg...";
+ if (system("ash", "-c", "rpm2cpio $pkg | cpio -i -d")) {
+ die _tr("unable to unpack package <%s> (%s)", $pkg, $!);
+ }
+ }
+}
+
+sub importTrustedPackageKeys
+{
+ my $self = shift;
+ my $keyFiles = shift;
+ my $finalPath = shift;
+
+ return unless defined $keyFiles;
+
+ foreach my $keyFile (@$keyFiles) {
+ vlog 2, "importing package key $keyFile...";
+ if (system("rpm", "--root=$finalPath", "--import", "$keyFile")) {
+ die _tr("unable to import package key <%s> (%s)", $keyFile, $!);
+ }
+ }
+}
+
+sub installPrerequiredPackages
+{
+ my $self = shift;
+ my $pkgs = shift;
+ my $finalPath = shift;
+
+ return unless defined $pkgs && scalar(@$pkgs);
+
+ if (system("rpm", "--root=$finalPath", "-ivh", "--nodeps", "--noscripts",
+ "--force", @$pkgs)) {
+ die _tr("error during prerequired-package-installation (%s)", $!);
+ }
+ system("rm", "-rf", "$finalPath/var/lib/rpm");
+}
+
+sub installPackages
+{
+ my $self = shift;
+ my $pkgs = shift;
+ my $finalPath = shift;
+
+ return unless defined $pkgs && scalar(@$pkgs);
+
+ if (system("rpm", "--root=$finalPath", "-ivh", @$pkgs)) {
+ die _tr("error during package-installation (%s)", $!);
+ }
+}
+
+1; \ No newline at end of file
diff --git a/installer/slxos-setup b/installer/slxos-setup
new file mode 100755
index 00000000..30aa82dd
--- /dev/null
+++ b/installer/slxos-setup
@@ -0,0 +1,143 @@
+#! /usr/bin/perl
+#
+# slxos-setup -
+#
+# (c) 2006 - OpenSLX.com
+#
+# Oliver Tappe <ot@openslx.com>
+#
+use strict;
+
+my $abstract = q[
+slxos-setup
+ This script installs an operating system into a folder that can be used as
+ a stage1 system for OpenSLX.
+];
+
+use Getopt::Long qw(:config pass_through);
+use Pod::Usage;
+
+# add the folder this script lives in and the lib-folder to perl's
+# search path for modules:
+use FindBin;
+use lib "$FindBin::RealBin";
+use lib "$FindBin::RealBin/../lib";
+
+use OpenSLX::Basics;
+use OpenSLX::OSSetup::Engine;
+
+if ($> != 0) {
+ die _tr("Sorry, this script can only be executed by the superuser!\n");
+}
+
+my (
+ $helpReq,
+ $manReq,
+ $listReq,
+ $setupRepos,
+ $verbose,
+ $versionReq,
+);
+
+GetOptions(
+ 'help|?' => \$helpReq,
+ 'list' => \$listReq,
+ 'man' => \$manReq,
+ 'setup-repos' => \$setupRepos,
+ 'verbose' => \$verbose,
+ 'version' => \$versionReq,
+) or pod2usage(2);
+pod2usage(-msg => $abstract, -verbose => 0, -exitval => 1) if $helpReq;
+pod2usage(-verbose => 2) if $manReq;
+if ($versionReq) {
+ system('slxversion');
+ exit 1;
+}
+
+my @supportedDistros = (
+ 'debian-3.1',
+ 'debian-4.0',
+ 'fedora-6',
+ 'fedora-6-x86_64',
+ 'mandriva-2007.0',
+ 'suse-9.3',
+ 'suse-10.0',
+ 'suse-10.0-x86_64',
+ 'suse-10.1',
+ 'suse-10.1-x86_64',
+ 'suse-10.2',
+ 'suse-10.2-x86_64',
+ 'ubuntu-6.10',
+);
+
+openslxInit();
+
+if ($listReq) {
+ print _tr("List of supported distros:\n\t");
+ print join("\n\t", @supportedDistros)."\n";
+ exit 1;
+}
+
+if (scalar(@ARGV) != 1) {
+ print STDERR _tr("You need to specify exactly one distro name!\n");
+ pod2usage(2);
+}
+
+my $distroName = $ARGV[0];
+if (!grep { /^$distroName$/ } @supportedDistros) {
+ print _tr("Sorry, distro '%s' is unsupported.\n", $distroName);
+ print _tr("List of supported distros:\n\t");
+ print join("\n\t", @supportedDistros)."\n";
+ exit 1;
+}
+
+# we chdir into the script's folder such that all relative paths have
+# a known starting point:
+chdir($FindBin::RealBin)
+ or die _tr("can't chdir to script-path <%> (%s)", $FindBin::RealBin, $!);
+
+# create ossetup-engine and start it:
+my $engine = OpenSLX::OSSetup::Engine->new;
+if ($setupRepos) {
+ $engine->initialize($distroName, 0);
+ $engine->setupRepositories();
+} else {
+ $engine->initialize($distroName, 1);
+ $engine->setupStage1();
+}
+
+__END__
+
+=head1 NAME
+
+slxos-setup - OpenSLX-script to install an operating system into a folder which
+will be used as a stage1 system for OpenSLX.
+
+=head1 SYNOPSIS
+
+slxos-setup [options] <distro-name>
+
+ Options:
+ --help brief help message
+ --man show full documentation
+ --version show version
+
+=head1 OPTIONS
+
+=over 8
+
+=item B<--help>
+
+Prints a brief help message and exits.
+
+=item B<--man>
+
+Prints the manual page and exits.
+
+=item B<--version>
+
+Prints the version and exits.
+
+=back
+
+=cut \ No newline at end of file
diff --git a/installer/systems/suse101/settings b/installer/systems/suse101/settings
index bff9516a..8f0d223c 100644
--- a/installer/systems/suse101/settings
+++ b/installer/systems/suse101/settings
@@ -99,7 +99,7 @@ i586/libxml2-python-2.6.23-15.i586.rpm
i586/python-2.4.2-18.i586.rpm
i586/python-elementtree-1.2.6-18.i586.rpm
i586/python-sqlite-1.1.6-17.i586.rpm
-i586/python-urlgrabber-2.9.7-15.i586.rpm
+i586/python-urlgrabber-2.9.7-15.i586.rpm
i586/rpm-python-4.4.2-40.i586.rpm
i586/sqlite-3.2.8-14.i586.rpm
i586/yum-2.4.2-13.i586.rpm