summaryrefslogtreecommitdiffstats
path: root/installer/OpenSLX/OSExport/ExportType/NFS.pm
diff options
context:
space:
mode:
authorOliver Tappe2007-03-12 19:22:58 +0100
committerOliver Tappe2007-03-12 19:22:58 +0100
commit58a64fc6a61e1c42bb93e507b03ce675afda3f66 (patch)
treee0c9f7b710ffffffd6d5bd58dcf8e329a380c97f /installer/OpenSLX/OSExport/ExportType/NFS.pm
parent* now uses OpenSLX::Utils (diff)
downloadcore-58a64fc6a61e1c42bb93e507b03ce675afda3f66.tar.gz
core-58a64fc6a61e1c42bb93e507b03ce675afda3f66.tar.xz
core-58a64fc6a61e1c42bb93e507b03ce675afda3f66.zip
* added slxos-export script and the corresponding engine and exporter implementation for NFS.
git-svn-id: http://svn.openslx.org/svn/openslx/trunk@760 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'installer/OpenSLX/OSExport/ExportType/NFS.pm')
-rw-r--r--installer/OpenSLX/OSExport/ExportType/NFS.pm83
1 files changed, 83 insertions, 0 deletions
diff --git a/installer/OpenSLX/OSExport/ExportType/NFS.pm b/installer/OpenSLX/OSExport/ExportType/NFS.pm
new file mode 100644
index 00000000..8bb8f7e5
--- /dev/null
+++ b/installer/OpenSLX/OSExport/ExportType/NFS.pm
@@ -0,0 +1,83 @@
+# NFS.pm
+# - provides NFS-specific overrides of the OpenSLX::OSExport::ExportType API.
+#
+# (c) 2006 - OpenSLX.com
+#
+# Oliver Tappe <ot@openslx.com>
+#
+package OpenSLX::OSExport::ExportType::NFS;
+
+use vars qw(@ISA $VERSION);
+@ISA = ('OpenSLX::OSExport::ExportType::Base');
+$VERSION = 1.01; # API-version . implementation-version
+
+use strict;
+use Carp;
+use File::Basename;
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+use OpenSLX::OSExport::ExportType::Base 1.01;
+
+################################################################################
+### interface methods
+################################################################################
+sub new
+{
+ my $class = shift;
+ my $self = {
+ 'name' => 'NFS',
+ };
+ return bless $self, $class;
+}
+
+sub initialize
+{
+ my $self = shift;
+ my $engine = shift;
+
+ $self->SUPER::initialize($engine);
+}
+
+sub exportVendorOS
+{
+ my $self = shift;
+ my $source = shift;
+ my $target = shift;
+
+ $self->exportViaRsync($source, $target);
+ $self->addTargetToNfsExports($target);
+}
+
+################################################################################
+### implementation methods
+################################################################################
+
+sub exportViaRsync
+{
+ my $self = shift;
+ 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";
+ 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;
+ if (!close(RSYNC)) {
+ die _tr("unable to export to target '%s', giving up! (%s)",
+ $target, $!);
+ }
+}
+
+sub addTargetToNfsExports
+{
+ my $self = shift;
+ my $target = shift;
+
+ my $exports = slurpFile("/etc/exports");
+print "$exports\n";
+}
+
+1;