summaryrefslogtreecommitdiffstats
path: root/boot-env/OpenSLX/BootEnvironment/Preboot
diff options
context:
space:
mode:
authorSebastian Schmelzer2010-09-02 17:50:49 +0200
committerSebastian Schmelzer2010-09-02 17:50:49 +0200
commit416ab8a37f1b07dc9f6c0fb3ff1a8ff2036510b5 (patch)
tree4715f7d742fec50931017f38fe6ff0a89d4ceccc /boot-env/OpenSLX/BootEnvironment/Preboot
parentFix for the problem reported on the list (sed filter forgotten for the (diff)
downloadcore-416ab8a37f1b07dc9f6c0fb3ff1a8ff2036510b5.tar.gz
core-416ab8a37f1b07dc9f6c0fb3ff1a8ff2036510b5.tar.xz
core-416ab8a37f1b07dc9f6c0fb3ff1a8ff2036510b5.zip
change dir structure
Diffstat (limited to 'boot-env/OpenSLX/BootEnvironment/Preboot')
-rw-r--r--boot-env/OpenSLX/BootEnvironment/Preboot/Base.pm111
-rw-r--r--boot-env/OpenSLX/BootEnvironment/Preboot/CD.pm155
2 files changed, 0 insertions, 266 deletions
diff --git a/boot-env/OpenSLX/BootEnvironment/Preboot/Base.pm b/boot-env/OpenSLX/BootEnvironment/Preboot/Base.pm
deleted file mode 100644
index 89f0e07e..00000000
--- a/boot-env/OpenSLX/BootEnvironment/Preboot/Base.pm
+++ /dev/null
@@ -1,111 +0,0 @@
-# Copyright (c) 2008-2009 - OpenSLX GmbH
-#
-# This program is free software distributed under the GPL version 2.
-# See http://openslx.org/COPYING
-#
-# If you have any feedback please consult http://openslx.org/feedback and
-# send your suggestions, praise, or complaints to feedback@openslx.org
-#
-# General information about OpenSLX can be found at http://openslx.org/
-# -----------------------------------------------------------------------------
-# BootEnvironment::Preboot::Base.pm
-# - base of the Preboot-BootEnvironment API.
-# -----------------------------------------------------------------------------
-package OpenSLX::BootEnvironment::Preboot::Base;
-
-use strict;
-use warnings;
-
-use File::Basename;
-
-use Clone qw(clone);
-
-use OpenSLX::Basics;
-use OpenSLX::MakeInitRamFS::Engine::Preboot;
-use OpenSLX::Utils;
-
-sub new
-{
- my $class = shift;
-
- my $self = {};
-
- return bless $self, $class;
-}
-
-sub initialize
-{
- my $self = shift;
- my $params = shift;
-
- $self->{'dry-run'} = $params->{'dry-run'};
-
- return 1;
-}
-
-sub makePrebootInitRamFS
-{
- my $self = shift;
- my $info = shift;
- my $initramfs = shift;
- my $client = shift;
-
- my $vendorOS = $info->{'vendor-os'};
- my $kernelFile = basename(followLink($info->{'kernel-file'}));
-
- my $attrs = clone($info->{attrs} || {});
-
- my $bootURI = $client->{attrs}->{boot_uri};
- if (!$bootURI) {
- die _tr("client $client->{name} needs an URI in attribute 'boot_uri' to be used for preboot!");
- }
-
- chomp(my $slxVersion = qx{slxversion});
-
- my $params = {
- 'attrs' => $attrs,
- 'export-name' => undef,
- 'export-uri' => undef,
- 'initramfs' => $initramfs,
- 'kernel-params'
- => [ split ' ', ($info->{attrs}->{kernel_params} || '') ],
- 'kernel-version' => $kernelFile =~ m[-(.+)$] ? $1 : '',
- 'plugins' => '',
- 'root-path'
- => "$openslxConfig{'private-path'}/stage1/$vendorOS->{name}",
- 'slx-version' => $slxVersion,
- 'system-name' => $info->{name},
- 'preboot-id' => $client->{name},
- 'boot-uri' => $bootURI,
- };
-
- # TODO: make debug-level an explicit attribute, it's used in many places!
- my $kernelParams = $info->{attrs}->{kernel_params} || '';
- if ($kernelParams =~ m{debug(?:=(\d+))?}) {
- my $debugLevel = defined $1 ? $1 : '1';
- $params->{'debug-level'} = $debugLevel;
- }
-
- my $makeInitRamFSEngine
- = OpenSLX::MakeInitRamFS::Engine::Preboot->new($params);
- $makeInitRamFSEngine->execute($self->{'dry-run'});
-
- # copy back kernel-params, as they might have been changed (by plugins)
- $info->{attrs}->{kernel_params}
- = join ' ', $makeInitRamFSEngine->kernelParams();
-
- return;
-}
-
-sub createImage
-{
- my $self = shift;
- my $client = shift;
- my $info = shift;
-
- # override in subclasses!
-
- return 1;
-}
-
-1;
diff --git a/boot-env/OpenSLX/BootEnvironment/Preboot/CD.pm b/boot-env/OpenSLX/BootEnvironment/Preboot/CD.pm
deleted file mode 100644
index a6c36cd7..00000000
--- a/boot-env/OpenSLX/BootEnvironment/Preboot/CD.pm
+++ /dev/null
@@ -1,155 +0,0 @@
-# Copyright (c) 2008-2009 - OpenSLX GmbH
-#
-# This program is free software distributed under the GPL version 2.
-# See http://openslx.org/COPYING
-#
-# If you have any feedback please consult http://openslx.org/feedback and
-# send your suggestions, praise, or complaints to feedback@openslx.org
-#
-# General information about OpenSLX can be found at http://openslx.org/
-# -----------------------------------------------------------------------------
-# BootEnvironment::Preboot::CD.pm
-# - provides CD-specific implementation of the Preboot-BootEnvironment API.
-# -----------------------------------------------------------------------------
-package OpenSLX::BootEnvironment::Preboot::CD;
-
-use strict;
-use warnings;
-
-use base qw(OpenSLX::BootEnvironment::Preboot::Base);
-
-use File::Basename;
-use File::Path;
-
-use OpenSLX::Basics;
-use OpenSLX::Utils;
-
-sub createImage
-{
- my $self = shift;
- my $client = shift;
- my $info = shift;
-
- vlog(
- 0,
- _tr(
- "\ncreating CD-image for client %s (based on %s) ...",
- $client->{name}, $info->{name}
- )
- );
-
- my $imageDir = "$openslxConfig{'public-path'}/images/$client->{name}/cd";
- my $isoDir = "$imageDir/iso/isolinux";
- mkpath($isoDir) unless $self->{'dry-run'};
-
- # copy static data
- my $dataDir = "$openslxConfig{'base-path'}/share/boot-env/syslinux";
- for my $file ('LICENSE', 'README.iso', 'vesamenu.c32', 'isolinux.bin') {
- if (!-e "$isoDir/$file") {
- slxsystem(
- qq[cp -p "$dataDir/$file" "$isoDir/"]
- )
- unless $self->{'dry-run'};
- }
- }
-
- # copy kernel (take the one from the given system info)
- my $kernelFile = $info->{'kernel-file'};
- my $kernelName = basename($kernelFile);
- slxsystem(qq{cp -p "$kernelFile" "$isoDir/vmlinuz"})
- unless $self->{'dry-run'};
-
- # create initramfs
- my $initramfsName = qq{"$isoDir/initramfs"};
- $self->makePrebootInitRamFS($info, $initramfsName, $client);
-
- # write trivial isolinux config
- # include static defaults
- my $isolinuxConfig = "DEFAULT vesamenu.c32\n";
- $isolinuxConfig .= "PROMPT 0\n";
- $isolinuxConfig .= "TIMEOUT 100\n";
-
- # theme stuff
- my $basePath = $openslxConfig{'base-path'};
- my $configPath = $openslxConfig{'config-path'};
- my $isoTheme = $openslxConfig{'syslinux-theme'};
-
- my $isoThemePath;
- my $isoThemeInConfig
- = "$configPath/boot-env/syslinux/themes/${isoTheme}";
- my $isoThemeInBase
- = "$basePath/share/boot-env/syslinux/themes/${isoTheme}";
- if (-e "$isoThemeInConfig/theme.conf") {
- $isoThemePath = $isoThemeInConfig;
- }
- else {
- if (-e "$isoThemeInBase/theme.conf") {
- $isoThemePath = $isoThemeInBase;
- }
- }
- # include theme specific stuff
- if (defined $isoThemePath) {
- $isolinuxConfig .= slurpFile("$isoThemePath/theme.conf");
- }
-
- # copy background picture if exists
- my $pic;
- if (defined $isoTheme) {
- while ($isolinuxConfig =~ m{^\s*MENU BACKGROUND (\S+?)\s*$}gims) {
- chomp($pic = $1);
- }
- }
- if (defined $pic) {
- my $isoBackground = "$isoThemePath/$pic";
- if (-e $isoBackground && !$self->{'dry-run'}) {
- slxsystem(qq[cp "$isoBackground" "$isoDir/"]);
- }
- }
-
- # write trivial isolinux config
- $isolinuxConfig .= unshiftHereDoc(<<" End-of-Here");
- MENU TITLE Welcome to OpenSLX PreBoot ISO/CD (Mini Linux/Kexec)
- LABEL SLXSTDBOOT
- MENU LABEL OpenSLX PreBoot - Stateless Netboot Linux ...
- MENU DEFAULT
- KERNEL vmlinuz
- APPEND initrd=initramfs vga=0x317
- TEXT HELP
- Use this (default) entry if you have configured your client.
- You have chance to edit the kernel commandline by hitting
- the TAB key (e.g. for adding debug=3 to it for bug hunting).
- ENDTEXT
- LABEL LOCALBOOT
- MENU LABEL Boot locally (skip OpenSLX PreBoot) ...
- LOCALBOOT -1
- TEXT HELP
- Gets you out of here by booting from next device in BIOS
- boot order.
- ENDTEXT
- End-of-Here
- spitFile("$isoDir/isolinux.cfg", $isolinuxConfig);
-
- my $mkisoCmd = unshiftHereDoc(<<" End-of-Here");
- mkisofs
- -o "$imageDir/../$client->{name}.iso"
- -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4
- -r -J -l -boot-info-table -joliet-long
- -publisher "OpenSLX Project - http://www.openslx.org"
- -p "OpenSLX Project - openslx-devel\@openslx.org"
- -V "OpenSLX BootISO"
- -volset "OpenSLX Project - PreBoot ISO/CD for non PXE/TFTP start of a Linux Stateless Client"
- -c isolinux/boot.cat "$imageDir/iso"
- End-of-Here
- $mkisoCmd =~ s{\n\s*}{ }gms;
- my $logFile = "$imageDir/../$client->{name}.iso.log";
- if (slxsystem(qq{$mkisoCmd 2>"$logFile"})) {
- my $log = slurpFile($logFile);
- die _tr("unable to create ISO-image - log follows:\n%s", $log);
- }
-
- rmtree($imageDir);
-
- return 1;
-}
-
-1;