summaryrefslogtreecommitdiffstats
path: root/installer/OpenSLX/OSExport
diff options
context:
space:
mode:
authorOliver Tappe2007-03-12 23:50:25 +0100
committerOliver Tappe2007-03-12 23:50:25 +0100
commit1341773fa52e38aaa1e6b9fcbae51f808aabe062 (patch)
tree8ae6b130763c5492faab21b00c6cfff8f6480a53 /installer/OpenSLX/OSExport
parent* added slxos-export script and the corresponding engine and exporter impleme... (diff)
downloadcore-1341773fa52e38aaa1e6b9fcbae51f808aabe062.tar.gz
core-1341773fa52e38aaa1e6b9fcbae51f808aabe062.tar.xz
core-1341773fa52e38aaa1e6b9fcbae51f808aabe062.zip
* added distro specific part for os-export and put default export-filter there
* the export filter is now built from the parts provided by us (in the distro-module) and the optional export-filter.local file (for which we provide an example) git-svn-id: http://svn.openslx.org/svn/openslx/trunk@761 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'installer/OpenSLX/OSExport')
-rw-r--r--installer/OpenSLX/OSExport/Distro/Base.pm99
-rw-r--r--installer/OpenSLX/OSExport/Distro/SUSE_10_2.pm99
-rw-r--r--installer/OpenSLX/OSExport/Engine.pm60
-rw-r--r--installer/OpenSLX/OSExport/ExportType/Base.pm15
-rw-r--r--installer/OpenSLX/OSExport/ExportType/NFS.pm25
5 files changed, 277 insertions, 21 deletions
diff --git a/installer/OpenSLX/OSExport/Distro/Base.pm b/installer/OpenSLX/OSExport/Distro/Base.pm
new file mode 100644
index 00000000..36c214a1
--- /dev/null
+++ b/installer/OpenSLX/OSExport/Distro/Base.pm
@@ -0,0 +1,99 @@
+# Base.pm - provides empty base of the distro-specific part of the
+# OpenSLX OSExport API.
+#
+# (c) 2006 - OpenSLX.com
+#
+# Oliver Tappe <ot@openslx.com>
+#
+package OpenSLX::OSExport::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::OSExport::Distro::Base-objects directly makes no sense!";
+}
+
+sub initialize
+{
+ my $self = shift;
+ my $engine = shift;
+
+ $self->{'engine'} = $engine;
+
+ $self->initDistroInfo();
+}
+
+sub initDistroInfo
+{
+ my $self = shift;
+
+ $self->{'clone-filter'} = "
+ - *.bak
+ - *.old
+ - *lost+found*
+ - *~
+ - .*.cmd
+ - .svn
+ - /*
+ + /bin
+ + /boot
+ + /dev
+ - /dev/*
+ + /etc
+ - /etc/dxs
+ - /etc/exports*
+ - /etc/opt/openslx
+ - /etc/resolv.conf.*
+ - /etc/samba/secrets.tdb
+ - /etc/shadow*
+ - /etc/vmware/installer.sh
+ + /home
+ - /home/*
+ + /lib
+ + /lib64
+ + /mnt
+ - /mnt/*
+ + /opt
+ - /opt/openslx
+ + /proc
+ - /proc/*
+ + /root
+ - /root/*
+ + /sbin
+ + /sys
+ - /sys/*
+ + /tmp
+ - /tmp/*
+ + /usr
+ - /usr/lib/vmware/modules/*
+ + /var
+ - /var/lib/vmware
+ - /var/opt/openslx
+ - /var/tmp/*
+ ";
+}
+
+1;
+################################################################################
+
+=pod
+
+=head1 NAME
+
+OpenSLX::OSExport::Distro::Base
+
+=head1 SYNOPSIS
+
+...
+
+=cut
diff --git a/installer/OpenSLX/OSExport/Distro/SUSE_10_2.pm b/installer/OpenSLX/OSExport/Distro/SUSE_10_2.pm
new file mode 100644
index 00000000..60ee21a4
--- /dev/null
+++ b/installer/OpenSLX/OSExport/Distro/SUSE_10_2.pm
@@ -0,0 +1,99 @@
+# SUSE_10_2.pm
+# - provides SUSE-10.2-specific overrides of the OpenSLX OSExport API.
+#
+# (c) 2006 - OpenSLX.com
+#
+# Oliver Tappe <ot@openslx.com>
+#
+package OpenSLX::OSExport::Distro::SUSE_10_2;
+
+use vars qw(@ISA $VERSION);
+@ISA = ('OpenSLX::OSExport::Distro::Base');
+$VERSION = 1.01; # API-version . implementation-version
+
+use strict;
+use Carp;
+use OpenSLX::Basics;
+use OpenSLX::OSExport::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);
+}
+
+sub initDistroInfo
+{
+ my $self = shift;
+
+ $self->SUPER::initDistroInfo();
+
+ $self->{'export-filter'} = "
+ - *.YaST2save
+ - *.o
+ - *.rpmnew
+ - *.rpmsave
+ - /boot/grub
+ - /boot/initrd*
+ - /etc/X11/xdm/SuSEconfig.xdm
+ - /etc/cron.*/*
+ - /etc/dhcpd.conf*
+ + /lib/modules/*/misc/vmmon.o
+ + /lib/modules/*/misc/vmnet.o
+ + /media
+ - /media/*
+ - /opt/kde3/share/autostart/SUSEgreeter.desktop
+ - /opt/kde3/share/autostart/beagled.desktop
+ - /opt/kde3/share/autostart/kerry.autostart.desktop
+ - /opt/kde3/share/autostart/knetworkmanager-autostart.desktop
+ - /opt/kde3/share/autostart/opensuseupdater.desktop
+ - /opt/kde3/share/autostart/profile_chooser-autostart.desktop
+ - /opt/kde3/share/autostart/runupdater.desktop
+ - /opt/kde3/share/autostart/suseplugger.desktop
+ - /usr/X11R6/bin/BackGround
+ - /usr/bin/nw-manager
+ - /usr/bin/zen-*
+ + /usr/lib/*.o
+ + /usr/lib/gcc/*/*/*.o
+ + /usr/lib/perl5/*/*/*/*.o
+ + /usr/lib/python*/*/*.o
+ - /usr/lib/zen-updater
+ - /usr/share/vmware/*
+ - /var/adm/SuSEconfig
+ - /var/adm/backup/rpmdb/*
+ - /var/cache/man/*
+ - /var/lib/YaST2/you/mnt/*
+ - /var/lib/dhcp*
+ - /var/lib/gdm/*
+ - /var/lib/hardware/*
+ - /var/lib/sax
+ - /var/lib/suspend*
+ - /var/lib/vm/*
+ - /var/lib/xdm
+ - /var/lib/zmd
+ - /var/lib/zypp/*
+ - /var/lib/zypp/cache/*
+ - /var/lock/*
+ - /var/log/*
+ - /var/mail
+ - /var/run/*
+ - /var/spool/*
+ - /var/tmp/*
+ ";
+}
+
+1; \ No newline at end of file
diff --git a/installer/OpenSLX/OSExport/Engine.pm b/installer/OpenSLX/OSExport/Engine.pm
index ed7a2900..085d10f7 100644
--- a/installer/OpenSLX/OSExport/Engine.pm
+++ b/installer/OpenSLX/OSExport/Engine.pm
@@ -13,7 +13,7 @@ use Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(
- %supportedExportTypes
+ %supportedExportTypes %supportedDistros
);
use strict;
@@ -21,7 +21,7 @@ use Carp;
use File::Basename;
use OpenSLX::Basics;
-use vars qw(%supportedExportTypes);
+use vars qw(%supportedExportTypes %supportedDistros);
%supportedExportTypes = (
'nfs'
@@ -32,6 +32,41 @@ use vars qw(%supportedExportTypes);
=> { module => 'NBD_Squash' },
);
+%supportedDistros = (
+ 'debian-3.1'
+ => { module => 'Debian_3_1' },
+ 'debian-4.0'
+ => { module => 'Debian_4_0' },
+ 'fedora-6'
+ => { module => 'Fedora_6' },
+ 'fedora-6-x86_64'
+ => { module => 'Fedora_6_x86_64' },
+ 'gentoo-2005.1'
+ => { module => 'Gentoo_2005_1' },
+ 'gentoo-2006.1'
+ => { module => 'Gentoo_2006_1' },
+ 'mandriva-2007.0'
+ => { module => 'Mandriva_2007_0' },
+ 'suse-9.3'
+ => { module => 'SUSE_9_3' },
+ 'suse-10.0'
+ => { module => 'SUSE_10_0' },
+ 'suse-10.0-x86_64'
+ => { module => 'SUSE_10_0_x86_64' },
+ 'suse-10.1'
+ => { module => 'SUSE_10_1' },
+ 'suse-10.1-x86_64'
+ => { module => 'SUSE_10_1_x86_64' },
+ 'suse-10.2'
+ => { module => 'SUSE_10_2' },
+ 'suse-10.2-x86_64'
+ => { module => 'SUSE_10_2_x86_64' },
+ 'ubuntu-6.06'
+ => { module => 'Ubuntu_6_06' },
+ 'ubuntu-6.10'
+ => { module => 'Ubuntu_6_10' },
+);
+
################################################################################
### interface methods
################################################################################
@@ -63,6 +98,27 @@ sub initialize
my $distroName = $1;
$self->{'distro-name'} = $distroName;
+ # load module for the requested distro:
+ my $distroModule
+ = "OpenSLX::OSExport::Distro::"
+ .$supportedDistros{lc($distroName)}->{module};
+ 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;
+
# load module for the requested export type:
my $exportTypeModule
= "OpenSLX::OSExport::ExportType::"
diff --git a/installer/OpenSLX/OSExport/ExportType/Base.pm b/installer/OpenSLX/OSExport/ExportType/Base.pm
index c65f39e0..6356ba94 100644
--- a/installer/OpenSLX/OSExport/ExportType/Base.pm
+++ b/installer/OpenSLX/OSExport/ExportType/Base.pm
@@ -26,21 +26,6 @@ sub initialize
my $engine = shift;
$self->{'engine'} = $engine;
-
- # read filter information:
- my (@includeList, @excludeList);
- my $distroName = $engine->{'distro-name'};
- my $filterFile = "../lib/distro-info/$distroName/export-filter";
- if (open(FILTER, "< $filterFile")) {
- while(<FILTER>) {
- chomp;
- push @includeList, "$_" if /^\+\s+/;
- push @excludeList, "$_" if /^\-\s+/;
- }
- close(FILTER);
- }
- $self->{'exclude-list'} = \@excludeList;
- $self->{'include-list'} = \@includeList;
}
sub exportVendorOS
diff --git a/installer/OpenSLX/OSExport/ExportType/NFS.pm b/installer/OpenSLX/OSExport/ExportType/NFS.pm
index 8bb8f7e5..659318be 100644
--- a/installer/OpenSLX/OSExport/ExportType/NFS.pm
+++ b/installer/OpenSLX/OSExport/ExportType/NFS.pm
@@ -58,19 +58,36 @@ sub exportViaRsync
my $source = shift;
my $target = shift;
- my $excludeIncludeList
- = join("\n", @{$self->{'include-list'}}, @{$self->{'exclude-list'}});
- vlog 1, "using exclude-include-filter:\n$excludeIncludeList\n";
+ my $includeExcludeList = $self->determineIncludeExcludeList();
+ vlog 1, "using include-exclude-filter:\n$includeExcludeList\n";
open(RSYNC, "| rsync -av --delete --exclude-from=- $source/ $target")
or die _tr("unable to start rsync for source '%s', giving up! (%s)",
$source, $!);
- print RSYNC $excludeIncludeList;
+ print RSYNC $includeExcludeList;
if (!close(RSYNC)) {
die _tr("unable to export to target '%s', giving up! (%s)",
$target, $!);
}
}
+sub determineIncludeExcludeList
+{
+ my $self = shift;
+
+ # Rsync uses a best (longest) match strategy. If there is more than one
+ # match with the same length, the first wins. This means that we have
+ # to mix the local specifications in front of the filterset given by
+ # the package (as the local filters should always overrule the vendor
+ # filters):
+ my $distroName = $self->{engine}->{'distro-name'};
+ my $localFilterFile = "../lib/distro-info/$distroName/export-filter.local";
+ my $includeExcludeList = slurpFile($localFilterFile, 1);
+ $includeExcludeList .= $self->{engine}->{distro}->{'export-filter'};
+ $includeExcludeList =~ s[^\s+][]igms;
+ # remove any leading whitespace, as rsync doesn't like it
+ return $includeExcludeList;
+}
+
sub addTargetToNfsExports
{
my $self = shift;