diff options
Diffstat (limited to 'installer/OpenSLX/OSExport')
-rw-r--r-- | installer/OpenSLX/OSExport/BlockDevice/AoE.pm | 72 | ||||
-rw-r--r-- | installer/OpenSLX/OSExport/BlockDevice/Base.pm | 6 | ||||
-rw-r--r-- | installer/OpenSLX/OSExport/BlockDevice/DNBD2.pm | 78 | ||||
-rw-r--r-- | installer/OpenSLX/OSExport/BlockDevice/NBD.pm | 70 | ||||
-rw-r--r-- | installer/OpenSLX/OSExport/Distro/Any.pm | 56 | ||||
-rw-r--r-- | installer/OpenSLX/OSExport/Distro/Base.pm | 18 | ||||
-rw-r--r-- | installer/OpenSLX/OSExport/Distro/Debian.pm | 50 | ||||
-rw-r--r-- | installer/OpenSLX/OSExport/Distro/Fedora.pm | 62 | ||||
-rw-r--r-- | installer/OpenSLX/OSExport/Distro/Gentoo.pm | 50 | ||||
-rw-r--r-- | installer/OpenSLX/OSExport/Distro/SUSE.pm | 158 | ||||
-rw-r--r-- | installer/OpenSLX/OSExport/Distro/Ubuntu.pm | 54 | ||||
-rw-r--r-- | installer/OpenSLX/OSExport/Engine.pm | 492 | ||||
-rw-r--r-- | installer/OpenSLX/OSExport/FileSystem/Base.pm | 104 | ||||
-rw-r--r-- | installer/OpenSLX/OSExport/FileSystem/NFS.pm | 212 | ||||
-rw-r--r-- | installer/OpenSLX/OSExport/FileSystem/SquashFS.pm | 412 |
15 files changed, 947 insertions, 947 deletions
diff --git a/installer/OpenSLX/OSExport/BlockDevice/AoE.pm b/installer/OpenSLX/OSExport/BlockDevice/AoE.pm index 9a7450f5..d3916d6a 100644 --- a/installer/OpenSLX/OSExport/BlockDevice/AoE.pm +++ b/installer/OpenSLX/OSExport/BlockDevice/AoE.pm @@ -9,8 +9,8 @@ # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- # AoE.pm -# - provides ATA-over-Ethernet specific overrides of the -# OpenSLX::OSExport::BlockDevice API. +# - provides ATA-over-Ethernet specific overrides of the +# OpenSLX::OSExport::BlockDevice API. # ----------------------------------------------------------------------------- package OpenSLX::OSExport::BlockDevice::AoE; @@ -36,71 +36,71 @@ use OpenSLX::Utils; ################################################################################ sub new { - my $class = shift; - my $self = {'name' => 'aoe',}; - return bless $self, $class; + my $class = shift; + my $self = {'name' => 'aoe',}; + return bless $self, $class; } sub initialize { - my $self = shift; - my $engine = shift; - my $fs = shift; + my $self = shift; + my $engine = shift; + my $fs = shift; - $self->{'engine'} = $engine; - $self->{'fs'} = $fs; - return; + $self->{'engine'} = $engine; + $self->{'fs'} = $fs; + return; } sub getExportPort { - my $self = shift; - my $openslxDB = shift; + my $self = shift; + my $openslxDB = shift; - return $openslxDB->incrementGlobalCounter('next-nbd-server-port'); + return $openslxDB->incrementGlobalCounter('next-nbd-server-port'); } sub generateExportURI { - my $self = shift; - my $export = shift; + my $self = shift; + my $export = shift; - my $serverIP = $export->{server_ip} || ''; - my $server - = length($serverIP) ? $serverIP : generatePlaceholderFor('serverip'); - $server .= ":$export->{port}" if length($export->{port}); + my $serverIP = $export->{server_ip} || ''; + my $server + = length($serverIP) ? $serverIP : generatePlaceholderFor('serverip'); + $server .= ":$export->{port}" if length($export->{port}); - return "aoe://$server"; + return "aoe://$server"; } sub requiredBlockDeviceModules { - my $self = shift; + my $self = shift; - return qw( aoe ); + return qw( aoe ); } sub requiredBlockDeviceTools { - my $self = shift; + my $self = shift; - # TODO: is there any such tool? + # TODO: is there any such tool? - return; + return; } sub showExportConfigInfo { - my $self = shift; - my $export = shift; - - print(('#' x 80) . "\n"); - print _tr( - "Please make sure you start a corresponding aoe-server:\n\t%s\n", - "... (don't know how this is done yet)" - ); - print(('#' x 80) . "\n"); - return; + my $self = shift; + my $export = shift; + + print(('#' x 80) . "\n"); + print _tr( + "Please make sure you start a corresponding aoe-server:\n\t%s\n", + "... (don't know how this is done yet)" + ); + print(('#' x 80) . "\n"); + return; } 1; diff --git a/installer/OpenSLX/OSExport/BlockDevice/Base.pm b/installer/OpenSLX/OSExport/BlockDevice/Base.pm index 80868a80..d2395e30 100644 --- a/installer/OpenSLX/OSExport/BlockDevice/Base.pm +++ b/installer/OpenSLX/OSExport/BlockDevice/Base.pm @@ -9,14 +9,14 @@ # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- # Base.pm -# - provides empty base of the OpenSLX OSExport::BlockDevice API. +# - provides empty base of the OpenSLX OSExport::BlockDevice API. # ----------------------------------------------------------------------------- package OpenSLX::OSExport::BlockDevice::Base; use strict; use warnings; -our $VERSION = 1.01; # API-version . implementation-version +our $VERSION = 1.01; # API-version . implementation-version use OpenSLX::Basics; @@ -25,7 +25,7 @@ use OpenSLX::Basics; ################################################################################ sub new { - confess "Creating OpenSLX::OSExport::BlockDevice::Base-objects directly makes no sense!"; + confess "Creating OpenSLX::OSExport::BlockDevice::Base-objects directly makes no sense!"; } sub initialize diff --git a/installer/OpenSLX/OSExport/BlockDevice/DNBD2.pm b/installer/OpenSLX/OSExport/BlockDevice/DNBD2.pm index 8cd20904..8dcc340b 100644 --- a/installer/OpenSLX/OSExport/BlockDevice/DNBD2.pm +++ b/installer/OpenSLX/OSExport/BlockDevice/DNBD2.pm @@ -9,8 +9,8 @@ # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- # DNBD2.pm -# - provides DNBD2+Squashfs-specific overrides of the -# OpenSLX::OSExport::BlockDevice API. +# - provides DNBD2+Squashfs-specific overrides of the +# OpenSLX::OSExport::BlockDevice API. # ----------------------------------------------------------------------------- package OpenSLX::OSExport::BlockDevice::DNBD2; @@ -30,73 +30,73 @@ use OpenSLX::Utils; ################################################################################ sub new { - my $class = shift; - my $self = {'name' => 'dnbd2',}; - return bless $self, $class; + my $class = shift; + my $self = {'name' => 'dnbd2',}; + return bless $self, $class; } sub initialize { - my $self = shift; - my $engine = shift; - my $fs = shift; + my $self = shift; + my $engine = shift; + my $fs = shift; - $self->{'engine'} = $engine; - $self->{'fs'} = $fs; - return; + $self->{'engine'} = $engine; + $self->{'fs'} = $fs; + return; } sub getExportPort { - my $self = shift; - my $openslxDB = shift; + my $self = shift; + my $openslxDB = shift; - return $openslxDB->incrementGlobalCounter('next-nbd-server-port'); + return $openslxDB->incrementGlobalCounter('next-nbd-server-port'); } sub generateExportURI { - my $self = shift; - my $export = shift; + my $self = shift; + my $export = shift; - my $serverIP = $export->{server_ip} || ''; - my $server - = length($serverIP) ? $serverIP : generatePlaceholderFor('serverip'); - $server .= ":$export->{port}" if length($export->{port}); + my $serverIP = $export->{server_ip} || ''; + my $server + = length($serverIP) ? $serverIP : generatePlaceholderFor('serverip'); + $server .= ":$export->{port}" if length($export->{port}); - return "dnbd2://$server"; + return "dnbd2://$server"; } sub requiredBlockDeviceModules { - my $self = shift; + my $self = shift; - return qw( dnbd2 ); + return qw( dnbd2 ); } sub requiredBlockDeviceTools { - my $self = shift; + my $self = shift; - return qw( ); + return qw( ); } sub showExportConfigInfo { - my $self = shift; - my $export = shift; - - print '#' x 80 , "\n", - _tr( - "Please make sure you start a corresponding dnbd2-server:\n\t%s\n", - "dnbd2-server /etc/dnbd2/server.conf\n" - ), - "Create or modify a config file like /etc/dnbd2/server.conf, looking like:", - "<server>\n", - "$export->{port}\n", - "$self->{fs}->{'export-path'}\n", - '#' x 80, "\n"; - return; + my $self = shift; + my $export = shift; + + print '#' x 80 , "\n", + _tr( + "Please make sure you start a corresponding dnbd2-server:\n\t%s\n", + "dnbd2-server /etc/dnbd2/server.conf\n" + ), + "Create or modify a config file like /etc/dnbd2/server.conf, looking like:", + "<server>\n", + "$export->{port}\n", + "$self->{fs}->{'export-path'}\n", + '#' x 80, "\n"; + return; } 1; diff --git a/installer/OpenSLX/OSExport/BlockDevice/NBD.pm b/installer/OpenSLX/OSExport/BlockDevice/NBD.pm index fff4b024..73694fbc 100644 --- a/installer/OpenSLX/OSExport/BlockDevice/NBD.pm +++ b/installer/OpenSLX/OSExport/BlockDevice/NBD.pm @@ -9,8 +9,8 @@ # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- # NBD.pm -# - provides NBD+Squashfs-specific overrides of the -# OpenSLX::OSExport::BlockDevice API. +# - provides NBD+Squashfs-specific overrides of the +# OpenSLX::OSExport::BlockDevice API. # ----------------------------------------------------------------------------- package OpenSLX::OSExport::BlockDevice::NBD; @@ -30,69 +30,69 @@ use OpenSLX::Utils; ################################################################################ sub new { - my $class = shift; - my $self = {'name' => 'nbd',}; - return bless $self, $class; + my $class = shift; + my $self = {'name' => 'nbd',}; + return bless $self, $class; } sub initialize { - my $self = shift; - my $engine = shift; - my $fs = shift; + my $self = shift; + my $engine = shift; + my $fs = shift; - $self->{'engine'} = $engine; - $self->{'fs'} = $fs; - return; + $self->{'engine'} = $engine; + $self->{'fs'} = $fs; + return; } sub getExportPort { - my $self = shift; - my $openslxDB = shift; + my $self = shift; + my $openslxDB = shift; - return $openslxDB->incrementGlobalCounter('next-nbd-server-port'); + return $openslxDB->incrementGlobalCounter('next-nbd-server-port'); } sub generateExportURI { - my $self = shift; - my $export = shift; + my $self = shift; + my $export = shift; - my $serverIP = $export->{server_ip} || ''; - my $server - = length($serverIP) ? $serverIP : generatePlaceholderFor('serverip'); - $server .= ":$export->{port}" if length($export->{port}); + my $serverIP = $export->{server_ip} || ''; + my $server + = length($serverIP) ? $serverIP : generatePlaceholderFor('serverip'); + $server .= ":$export->{port}" if length($export->{port}); - return "nbd://$server"; + return "nbd://$server"; } sub requiredBlockDeviceModules { - my $self = shift; + my $self = shift; - return qw( nbd ); + return qw( nbd ); } sub requiredBlockDeviceTools { - my $self = shift; + my $self = shift; - return qw( nbd-client ); + return qw( nbd-client ); } sub showExportConfigInfo { - my $self = shift; - my $export = shift; - - print(('#' x 80) . "\n"); - print _tr( - "Please make sure you start a corresponding nbd-server:\n\t%s\n", - "nbd-server $export->{port} $self->{fs}->{'export-path'} -r" - ); - print(('#' x 80) . "\n"); - return; + my $self = shift; + my $export = shift; + + print(('#' x 80) . "\n"); + print _tr( + "Please make sure you start a corresponding nbd-server:\n\t%s\n", + "nbd-server $export->{port} $self->{fs}->{'export-path'} -r" + ); + print(('#' x 80) . "\n"); + return; } 1; diff --git a/installer/OpenSLX/OSExport/Distro/Any.pm b/installer/OpenSLX/OSExport/Distro/Any.pm index bf780bb9..59de2f32 100644 --- a/installer/OpenSLX/OSExport/Distro/Any.pm +++ b/installer/OpenSLX/OSExport/Distro/Any.pm @@ -9,7 +9,7 @@ # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- # Any.pm -# - provides generic overrides of the OpenSLX OSExport API. +# - provides generic overrides of the OpenSLX OSExport API. # ----------------------------------------------------------------------------- package OpenSLX::OSExport::Distro::Any; @@ -25,41 +25,41 @@ use OpenSLX::Basics; ################################################################################ sub new { - my $class = shift; - my $self = { - 'base-name' => 'any', - }; - return bless $self, $class; + my $class = shift; + my $self = { + 'base-name' => 'any', + }; + return bless $self, $class; } sub initDistroInfo { - my $self = shift; + my $self = shift; - $self->{'export-filter'} = " - - /var/tmp/* - - /var/spool/* - - /var/run/* - - /var/lock/* - - /var/log/* - - /var/lib/xdm - - /var/lib/smart - - /var/cache/yum - - /var/cache/man/* - - /usr/share/vmware/* - - /tmp/* - - /sys/* - - /proc/* - - /mnt/* - - /media/* + $self->{'export-filter'} = " + - /var/tmp/* + - /var/spool/* + - /var/run/* + - /var/lock/* + - /var/log/* + - /var/lib/xdm + - /var/lib/smart + - /var/cache/yum + - /var/cache/man/* + - /usr/share/vmware/* + - /tmp/* + - /sys/* + - /proc/* + - /mnt/* + - /media/* + /lib/modules/*/misc/vmblock.o + /lib/modules/*/misc/vmnet.o + /lib/modules/*/misc/vmmon.o - - /lib/klibc/events/* - - /boot/initrd* - - /boot/grub - "; - return; + - /lib/klibc/events/* + - /boot/initrd* + - /boot/grub + "; + return; } 1;
\ No newline at end of file diff --git a/installer/OpenSLX/OSExport/Distro/Base.pm b/installer/OpenSLX/OSExport/Distro/Base.pm index 29659f09..b6fc1fae 100644 --- a/installer/OpenSLX/OSExport/Distro/Base.pm +++ b/installer/OpenSLX/OSExport/Distro/Base.pm @@ -9,15 +9,15 @@ # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- # Base.pm -# - provides empty base of the distro-specific part of the OpenSLX -# OSExport API. +# - provides empty base of the distro-specific part of the OpenSLX +# OSExport API. # ----------------------------------------------------------------------------- package OpenSLX::OSExport::Distro::Base; use strict; use warnings; -our $VERSION = 1.01; # API-version . implementation-version +our $VERSION = 1.01; # API-version . implementation-version use OpenSLX::Basics; @@ -26,18 +26,18 @@ use OpenSLX::Basics; ################################################################################ sub new { - confess "Creating OpenSLX::OSExport::Distro::Base-objects directly makes no sense!"; + confess "Creating OpenSLX::OSExport::Distro::Base-objects directly makes no sense!"; } sub initialize { - my $self = shift; - my $engine = shift; + my $self = shift; + my $engine = shift; - $self->{'engine'} = $engine; + $self->{'engine'} = $engine; - $self->initDistroInfo(); - return; + $self->initDistroInfo(); + return; } sub initDistroInfo diff --git a/installer/OpenSLX/OSExport/Distro/Debian.pm b/installer/OpenSLX/OSExport/Distro/Debian.pm index 4da68ffb..d1ae7d88 100644 --- a/installer/OpenSLX/OSExport/Distro/Debian.pm +++ b/installer/OpenSLX/OSExport/Distro/Debian.pm @@ -9,7 +9,7 @@ # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- # Debian.pm -# - provides Debian-specific overrides of the OpenSLX OSExport API. +# - provides Debian-specific overrides of the OpenSLX OSExport API. # ----------------------------------------------------------------------------- package OpenSLX::OSExport::Distro::Debian; @@ -25,35 +25,35 @@ use OpenSLX::Basics; ################################################################################ sub new { - my $class = shift; - my $self = { - 'base-name' => 'debian', - }; - return bless $self, $class; + my $class = shift; + my $self = { + 'base-name' => 'debian', + }; + return bless $self, $class; } sub initDistroInfo { - my $self = shift; + my $self = shift; - $self->{'export-filter'} = " - - /var/tmp/* - - /var/spool/* - - /var/run/* - - /var/log/* - - /var/lib/xdm - - /var/cache/man/* - - /usr/share/vmware/* - - /tmp/* - - /sys/* - - /proc/* - - /mnt/* - - /media/* - - /lib/klibc/events/* - - /boot/initrd* - - /boot/grub - "; - return; + $self->{'export-filter'} = " + - /var/tmp/* + - /var/spool/* + - /var/run/* + - /var/log/* + - /var/lib/xdm + - /var/cache/man/* + - /usr/share/vmware/* + - /tmp/* + - /sys/* + - /proc/* + - /mnt/* + - /media/* + - /lib/klibc/events/* + - /boot/initrd* + - /boot/grub + "; + return; } 1;
\ No newline at end of file diff --git a/installer/OpenSLX/OSExport/Distro/Fedora.pm b/installer/OpenSLX/OSExport/Distro/Fedora.pm index a643c91a..4e8c0bf0 100644 --- a/installer/OpenSLX/OSExport/Distro/Fedora.pm +++ b/installer/OpenSLX/OSExport/Distro/Fedora.pm @@ -9,7 +9,7 @@ # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- # Fedora.pm -# - provides Fedora-specific overrides of the OpenSLX OSExport API. +# - provides Fedora-specific overrides of the OpenSLX OSExport API. # ----------------------------------------------------------------------------- package OpenSLX::OSExport::Distro::Fedora; @@ -25,41 +25,41 @@ use OpenSLX::Basics; ################################################################################ sub new { - my $class = shift; - my $self = { - 'base-name' => 'fedora', - }; - return bless $self, $class; + my $class = shift; + my $self = { + 'base-name' => 'fedora', + }; + return bless $self, $class; } sub initDistroInfo { - my $self = shift; + my $self = shift; - # TODO: check and refine this! - $self->{'export-filter'} = " - - /var/tmp/* - - /var/spool/* - - /var/run/* - - /var/lock/* - - /var/log/* - - /var/lib/xdm - - /var/lib/smart - - /var/cache/yum - - /var/cache/man/* - - /usr/share/vmware/* - - /tmp/* - - /sys/* - - /proc/* - - /mnt/* - - /media/* - - /lib/klibc/events/* - - /boot/initrd* - - /boot/grub - - *.rpmsave - - *.rpmnew - "; - return; + # TODO: check and refine this! + $self->{'export-filter'} = " + - /var/tmp/* + - /var/spool/* + - /var/run/* + - /var/lock/* + - /var/log/* + - /var/lib/xdm + - /var/lib/smart + - /var/cache/yum + - /var/cache/man/* + - /usr/share/vmware/* + - /tmp/* + - /sys/* + - /proc/* + - /mnt/* + - /media/* + - /lib/klibc/events/* + - /boot/initrd* + - /boot/grub + - *.rpmsave + - *.rpmnew + "; + return; } 1;
\ No newline at end of file diff --git a/installer/OpenSLX/OSExport/Distro/Gentoo.pm b/installer/OpenSLX/OSExport/Distro/Gentoo.pm index d46b6037..1df759dd 100644 --- a/installer/OpenSLX/OSExport/Distro/Gentoo.pm +++ b/installer/OpenSLX/OSExport/Distro/Gentoo.pm @@ -9,7 +9,7 @@ # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- # Gentoo.pm -# - provides Gentoo-specific overrides of the OpenSLX OSExport API. +# - provides Gentoo-specific overrides of the OpenSLX OSExport API. # ----------------------------------------------------------------------------- package OpenSLX::OSExport::Distro::Gentoo; @@ -25,35 +25,35 @@ use OpenSLX::Basics; ################################################################################ sub new { - my $class = shift; - my $self = { - 'base-name' => 'gentoo', - }; - return bless $self, $class; + my $class = shift; + my $self = { + 'base-name' => 'gentoo', + }; + return bless $self, $class; } sub initDistroInfo { - my $self = shift; + my $self = shift; - $self->{'export-filter'} = " - - /var/tmp/* - - /var/spool/* - - /var/run/* - - /var/log/* - - /var/lib/xdm - - /var/lib/init.d/* - - /var/cache/man/* - - /usr/share/vmware/* - - /tmp/* - - /sys/* - - /proc/* - - /mnt/* - - /media/* - - /boot/initrd* - - /boot/grub - "; - return; + $self->{'export-filter'} = " + - /var/tmp/* + - /var/spool/* + - /var/run/* + - /var/log/* + - /var/lib/xdm + - /var/lib/init.d/* + - /var/cache/man/* + - /usr/share/vmware/* + - /tmp/* + - /sys/* + - /proc/* + - /mnt/* + - /media/* + - /boot/initrd* + - /boot/grub + "; + return; } 1;
\ No newline at end of file diff --git a/installer/OpenSLX/OSExport/Distro/SUSE.pm b/installer/OpenSLX/OSExport/Distro/SUSE.pm index 5d7ed615..7f5d5548 100644 --- a/installer/OpenSLX/OSExport/Distro/SUSE.pm +++ b/installer/OpenSLX/OSExport/Distro/SUSE.pm @@ -9,7 +9,7 @@ # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- # SUSE.pm -# - provides SUSE-specific overrides of the OpenSLX OSExport API. +# - provides SUSE-specific overrides of the OpenSLX OSExport API. # ----------------------------------------------------------------------------- package OpenSLX::OSExport::Distro::SUSE; @@ -25,89 +25,89 @@ use OpenSLX::Basics; ################################################################################ sub new { - my $class = shift; - my $self = { - 'base-name' => 'suse', - }; - return bless $self, $class; + my $class = shift; + my $self = { + 'base-name' => 'suse', + }; + return bless $self, $class; } sub initDistroInfo { - my $self = shift; + my $self = shift; - $self->{'export-filter'} = " - - /var/tmp/* - - /var/spool/* - - /var/run/* - - /var/mail - - /var/log/* - - /var/lock/* - - /var/lib/zypp/* - - /var/lib/zmd - - /var/lib/xdm - - /var/lib/vm* - - /var/lib/suspend* - - /var/lib/smart - - /var/lib/sax - - /var/lib/hardware/* - - /var/lib/gdm/* - - /var/lib/dhcp* - - /var/lib/bluetooth/ - - /var/lib/YaST2/you/mnt/* - - /var/lib/YaST2/backup_boot_sectors - - /var/cache/sax - - /var/cache/libx11/compose/* - - /var/cache/beagle - - /var/cache/yum - - /var/cache/man/* - - /var/adm/backup/rpmdb/* - - /var/adm/mount/AP* - - /var/adm/SuSEconfig - - /usr/share/vmware/* - - /usr/lib/zen-updater - + /usr/lib/python*/*/*.o - + /usr/lib/perl5/*/*/*/*.o - + /usr/lib/gcc/*/*/*.o - + /usr/lib/*.o - + /usr/X11R6/lib/modules/drivers/*.o - + /usr/X11R6/lib/modules/drivers/linux/*.o - - /usr/bin/zen-* - - /usr/bin/nw-manager - - /usr/X11R6/bin/BackGround - - /usr/bin/BackGround - - /tmp/* - - /sys/* - - /proc/* - - /opt/kde3/share/autostart/suseplugger.desktop - - /opt/kde3/share/autostart/susewatcher.desktop - - /opt/kde3/share/autostart/runupdater.desktop - - /opt/kde3/share/autostart/profile_chooser-autostart.desktop - - /opt/kde3/share/autostart/opensuseupdater.desktop - - /opt/kde3/share/autostart/knetworkmanager-autostart.desktop - - /opt/kde3/share/autostart/kerry.autostart.desktop - - /opt/kde3/share/autostart/kinternet.desktop - - /opt/kde3/share/autostart/beagled.desktop - - /opt/kde3/share/autostart/SUSEgreeter.desktop - - /opt/kde3/share/autostart/zen-updater-auto.desktop - - /opt/gnome/share/autostart/beagle*.desktop - - /mnt/* - - /media/* - + /media - + /lib/modules/*/misc/vmblock.o - + /lib/modules/*/misc/vmnet.o - + /lib/modules/*/misc/vmmon.o - - /etc/dhcpd.conf* - - /etc/cron.*/* - - /etc/sysconfig/network/ifcfg-* - - /etc/X11/xdm/SuSEconfig.xdm - - /boot/initrd* - - /boot/grub - - *.rpmsave - - *.rpmnew - - *.YaST2save - "; - return; + $self->{'export-filter'} = " + - /var/tmp/* + - /var/spool/* + - /var/run/* + - /var/mail + - /var/log/* + - /var/lock/* + - /var/lib/zypp/* + - /var/lib/zmd + - /var/lib/xdm + - /var/lib/vm* + - /var/lib/suspend* + - /var/lib/smart + - /var/lib/sax + - /var/lib/hardware/* + - /var/lib/gdm/* + - /var/lib/dhcp* + - /var/lib/bluetooth/ + - /var/lib/YaST2/you/mnt/* + - /var/lib/YaST2/backup_boot_sectors + - /var/cache/sax + - /var/cache/libx11/compose/* + - /var/cache/beagle + - /var/cache/yum + - /var/cache/man/* + - /var/adm/backup/rpmdb/* + - /var/adm/mount/AP* + - /var/adm/SuSEconfig + - /usr/share/vmware/* + - /usr/lib/zen-updater + + /usr/lib/python*/*/*.o + + /usr/lib/perl5/*/*/*/*.o + + /usr/lib/gcc/*/*/*.o + + /usr/lib/*.o + + /usr/X11R6/lib/modules/drivers/*.o + + /usr/X11R6/lib/modules/drivers/linux/*.o + - /usr/bin/zen-* + - /usr/bin/nw-manager + - /usr/X11R6/bin/BackGround + - /usr/bin/BackGround + - /tmp/* + - /sys/* + - /proc/* + - /opt/kde3/share/autostart/suseplugger.desktop + - /opt/kde3/share/autostart/susewatcher.desktop + - /opt/kde3/share/autostart/runupdater.desktop + - /opt/kde3/share/autostart/profile_chooser-autostart.desktop + - /opt/kde3/share/autostart/opensuseupdater.desktop + - /opt/kde3/share/autostart/knetworkmanager-autostart.desktop + - /opt/kde3/share/autostart/kerry.autostart.desktop + - /opt/kde3/share/autostart/kinternet.desktop + - /opt/kde3/share/autostart/beagled.desktop + - /opt/kde3/share/autostart/SUSEgreeter.desktop + - /opt/kde3/share/autostart/zen-updater-auto.desktop + - /opt/gnome/share/autostart/beagle*.desktop + - /mnt/* + - /media/* + + /media + + /lib/modules/*/misc/vmblock.o + + /lib/modules/*/misc/vmnet.o + + /lib/modules/*/misc/vmmon.o + - /etc/dhcpd.conf* + - /etc/cron.*/* + - /etc/sysconfig/network/ifcfg-* + - /etc/X11/xdm/SuSEconfig.xdm + - /boot/initrd* + - /boot/grub + - *.rpmsave + - *.rpmnew + - *.YaST2save + "; + return; } 1; diff --git a/installer/OpenSLX/OSExport/Distro/Ubuntu.pm b/installer/OpenSLX/OSExport/Distro/Ubuntu.pm index c26aa706..0f60b63f 100644 --- a/installer/OpenSLX/OSExport/Distro/Ubuntu.pm +++ b/installer/OpenSLX/OSExport/Distro/Ubuntu.pm @@ -9,7 +9,7 @@ # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- # Ubuntu.pm -# - provides Ubuntu-specific overrides of the OpenSLX OSExport API. +# - provides Ubuntu-specific overrides of the OpenSLX OSExport API. # ----------------------------------------------------------------------------- package OpenSLX::OSExport::Distro::Ubuntu; @@ -25,37 +25,37 @@ use OpenSLX::Basics; ################################################################################ sub new { - my $class = shift; - my $self = { - 'base-name' => 'ubuntu', - }; - return bless $self, $class; + my $class = shift; + my $self = { + 'base-name' => 'ubuntu', + }; + return bless $self, $class; } sub initDistroInfo { - my $self = shift; + my $self = shift; - $self->{'export-filter'} = " - - /var/tmp/* - - /var/spool/* - - /var/run/* - - /var/log/* - - /var/lib/xdm - - /var/cache/man/* - - /usr/share/vmware/* - - /tmp/* - - /sys/* - - /proc/* - - /mnt/* - - /media/* - - /lib/klibc/events/* - - /initrd* - - /etc/cron.*/* - - /boot/initrd* - - /boot/grub - "; - return; + $self->{'export-filter'} = " + - /var/tmp/* + - /var/spool/* + - /var/run/* + - /var/log/* + - /var/lib/xdm + - /var/cache/man/* + - /usr/share/vmware/* + - /tmp/* + - /sys/* + - /proc/* + - /mnt/* + - /media/* + - /lib/klibc/events/* + - /initrd* + - /etc/cron.*/* + - /boot/initrd* + - /boot/grub + "; + return; } 1;
\ No newline at end of file diff --git a/installer/OpenSLX/OSExport/Engine.pm b/installer/OpenSLX/OSExport/Engine.pm index 743a46b9..7aba36da 100644 --- a/installer/OpenSLX/OSExport/Engine.pm +++ b/installer/OpenSLX/OSExport/Engine.pm @@ -9,7 +9,7 @@ # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- # Engine.pm -# - provides driver engine for the OSExport API. +# - provides driver engine for the OSExport API. # ----------------------------------------------------------------------------- package OpenSLX::OSExport::Engine; @@ -38,30 +38,30 @@ our ( ); %supportedExportFileSystems = ( - 'nfs' => 'NFS', - 'sqfs' => 'SquashFS', + 'nfs' => 'NFS', + 'sqfs' => 'SquashFS', ); %supportedExportBlockDevices = ( - 'dnbd2' => 'DNBD2', - 'nbd' => 'NBD', - 'aoe' => 'AoE', + 'dnbd2' => 'DNBD2', + 'nbd' => 'NBD', + 'aoe' => 'AoE', ); @supportedExportTypes = ( - 'nfs', - 'sqfs-aoe', - 'sqfs-dnbd2', - 'sqfs-nbd', + 'nfs', + 'sqfs-aoe', + 'sqfs-dnbd2', + 'sqfs-nbd', ); %supportedDistros = ( - '<any>' => {module => 'Any'}, - 'debian' => {module => 'Debian'}, - 'fedora' => {module => 'Fedora'}, - 'gentoo' => {module => 'Gentoo'}, - 'suse' => {module => 'SUSE'}, - 'ubuntu' => {module => 'Ubuntu'}, + '<any>' => {module => 'Any'}, + 'debian' => {module => 'Debian'}, + 'fedora' => {module => 'Fedora'}, + 'gentoo' => {module => 'Gentoo'}, + 'suse' => {module => 'SUSE'}, + 'ubuntu' => {module => 'Ubuntu'}, ); ################################################################################ @@ -69,117 +69,117 @@ our ( ################################################################################ sub new { - my $class = shift; + my $class = shift; - my $self = {}; + my $self = {}; - return bless $self, $class; + return bless $self, $class; } sub initializeFromExisting { - my $self = shift; - my $exportName = shift; + my $self = shift; + my $exportName = shift; - my $openslxDB = instantiateClass("OpenSLX::ConfigDB"); - $openslxDB->connect(); + my $openslxDB = instantiateClass("OpenSLX::ConfigDB"); + $openslxDB->connect(); - my $export = $openslxDB->fetchExportByFilter({'name' => $exportName}); - if (!defined $export) { - die _tr("Export '%s' not found in DB, giving up!", $exportName); - } - my $vendorOS = - $openslxDB->fetchVendorOSByFilter({'id' => $export->{vendor_os_id}}); + my $export = $openslxDB->fetchExportByFilter({'name' => $exportName}); + if (!defined $export) { + die _tr("Export '%s' not found in DB, giving up!", $exportName); + } + my $vendorOS = + $openslxDB->fetchVendorOSByFilter({'id' => $export->{vendor_os_id}}); - $openslxDB->disconnect(); + $openslxDB->disconnect(); - $self->_initialize($vendorOS->{name}, $vendorOS->{id}, $export->{name}, - $export->{type}); - return; + $self->_initialize($vendorOS->{name}, $vendorOS->{id}, $export->{name}, + $export->{type}); + return; } sub initializeForNew { - my $self = shift; - my $vendorOSName = shift; - my $exportType = lc(shift); + my $self = shift; + my $vendorOSName = shift; + my $exportType = lc(shift); - my $openslxDB = instantiateClass("OpenSLX::ConfigDB"); - $openslxDB->connect(); + my $openslxDB = instantiateClass("OpenSLX::ConfigDB"); + $openslxDB->connect(); - my $vendorOS = $openslxDB->fetchVendorOSByFilter({'name' => $vendorOSName}); - if (!defined $vendorOS) { - die _tr("vendor-OS '%s' not found in DB, giving up!", $vendorOSName); - } + my $vendorOS = $openslxDB->fetchVendorOSByFilter({'name' => $vendorOSName}); + if (!defined $vendorOS) { + die _tr("vendor-OS '%s' not found in DB, giving up!", $vendorOSName); + } - my $exportName = "${vendorOSName}::${exportType}"; + my $exportName = "${vendorOSName}::${exportType}"; - $openslxDB->disconnect(); + $openslxDB->disconnect(); - $self->_initialize($vendorOS->{name}, $vendorOS->{id}, $exportName, - $exportType); - return; + $self->_initialize($vendorOS->{name}, $vendorOS->{id}, $exportName, + $exportType); + return; } sub exportVendorOS { - my $self = shift; - - if (!$self->{'exporter'}->checkRequirements($self->{'vendor-os-path'})) { - die _tr( - "clients wouldn't be able to access the exported root-fs!\nplease " - . "install the missing module(s) or use another export-type."); - } - - $self->{'exporter'}->exportVendorOS($self->{'vendor-os-path'},); - vlog( - 0, - _tr( - "vendor-OS '%s' successfully exported to '%s'!", - $self->{'vendor-os-path'}, - $self->{exporter}->{'export-path'} - ) - ); - $self->_addExportToConfigDB(); - return; + my $self = shift; + + if (!$self->{'exporter'}->checkRequirements($self->{'vendor-os-path'})) { + die _tr( + "clients wouldn't be able to access the exported root-fs!\nplease " + . "install the missing module(s) or use another export-type."); + } + + $self->{'exporter'}->exportVendorOS($self->{'vendor-os-path'},); + vlog( + 0, + _tr( + "vendor-OS '%s' successfully exported to '%s'!", + $self->{'vendor-os-path'}, + $self->{exporter}->{'export-path'} + ) + ); + $self->_addExportToConfigDB(); + return; } sub purgeExport { - my $self = shift; - - if ($self->{'exporter'}->purgeExport()) { - vlog( - 0, - _tr( - "export '%s' successfully removed!", - $self->{exporter}->{'export-path'} - ) - ); - } - $self->_removeExportFromConfigDB(); - return; + my $self = shift; + + if ($self->{'exporter'}->purgeExport()) { + vlog( + 0, + _tr( + "export '%s' successfully removed!", + $self->{exporter}->{'export-path'} + ) + ); + } + $self->_removeExportFromConfigDB(); + return; } sub generateExportURI { - my $self = shift; + my $self = shift; - return $self->{exporter}->generateExportURI(@_); + return $self->{exporter}->generateExportURI(@_); } sub requiredFSMods { - my $self = shift; + my $self = shift; - return $self->{exporter}->requiredFSMods(); + return $self->{exporter}->requiredFSMods(); } sub requiredFSTools { - my $self = shift; + my $self = shift; - return $self->{exporter}->requiredFSTools(); + return $self->{exporter}->requiredFSTools(); } ################################################################################ @@ -187,175 +187,175 @@ sub requiredFSTools ################################################################################ sub _initialize { - my $self = shift; - my $vendorOSName = shift; - my $vendorOSId = shift; - my $exportName = shift; - my $exportType = lc(shift); - - if ($vendorOSName eq '<<<default>>>') { - die _tr("you can't do that with the default vendor-OS!\n"); - } - if (!grep { $_ eq $exportType } @supportedExportTypes) { - vlog(0, - _tr("Sorry, export type '%s' is unsupported.\n", $exportType) - . _tr("List of supported export types:\n\t") - . join("\n\t", sort @supportedExportTypes)); - exit 1; - } - $exportType =~ m[^(\w+)(?:-(\w+))?$]; - my $exportFS = lc($1); - my $exportBD = lc($2); - vlog(2, "export-filesys='$exportFS' export-blockdev='$exportBD'"); - - $self->{'vendor-os-name'} = $vendorOSName; - $self->{'vendor-os-id'} = $vendorOSId; - $self->{'export-name'} = $exportName; - $self->{'export-type'} = $exportType; - $vendorOSName =~ m[^(.+?\-[^-]+)]; - my $distroName = $1; - $self->{'distro-name'} = $distroName; - - # load module for the requested distro: - if (!exists $supportedDistros{lc($distroName)}) { - # try without _x86_64: - $distroName =~ s[_x86_64$][]; - if (!exists $supportedDistros{lc($distroName)}) { - # try basic distro-type (e.g. debian or suse): - $distroName =~ s[-.+$][]; - if (!exists $supportedDistros{lc($distroName)}) { - # fallback to generic implementation: - $distroName = '<any>'; - } - } - } - my $distroModuleName = $supportedDistros{lc($distroName)}->{module}; - my $distro = - instantiateClass("OpenSLX::OSExport::Distro::$distroModuleName"); - $distro->initialize($self); - $self->{distro} = $distro; - - # load module for the requested export type: - my $fsModuleName = $supportedExportFileSystems{$exportFS}; - my $exporter = - instantiateClass("OpenSLX::OSExport::FileSystem::$fsModuleName"); - if (length($exportBD)) { - my $blockModuleName = $supportedExportBlockDevices{$exportBD}; - my $blockDevice = - instantiateClass("OpenSLX::OSExport::BlockDevice::$blockModuleName"); - $blockDevice->initialize($self, $exporter); - $exporter->initialize($self, $blockDevice); - } else { - $exporter->initialize($self); - } - $self->{'exporter'} = $exporter; - - # setup source and target paths: - $self->{'vendor-os-path'} = - "$openslxConfig{'private-path'}/stage1/$vendorOSName"; - vlog( - 1, - _tr( - "vendor-OS from '%s' will be exported to '%s'", - $self->{'vendor-os-path'}, - $exporter->{'export-path'} - ) - ); - return; + my $self = shift; + my $vendorOSName = shift; + my $vendorOSId = shift; + my $exportName = shift; + my $exportType = lc(shift); + + if ($vendorOSName eq '<<<default>>>') { + die _tr("you can't do that with the default vendor-OS!\n"); + } + if (!grep { $_ eq $exportType } @supportedExportTypes) { + vlog(0, + _tr("Sorry, export type '%s' is unsupported.\n", $exportType) + . _tr("List of supported export types:\n\t") + . join("\n\t", sort @supportedExportTypes)); + exit 1; + } + $exportType =~ m[^(\w+)(?:-(\w+))?$]; + my $exportFS = lc($1); + my $exportBD = lc($2); + vlog(2, "export-filesys='$exportFS' export-blockdev='$exportBD'"); + + $self->{'vendor-os-name'} = $vendorOSName; + $self->{'vendor-os-id'} = $vendorOSId; + $self->{'export-name'} = $exportName; + $self->{'export-type'} = $exportType; + $vendorOSName =~ m[^(.+?\-[^-]+)]; + my $distroName = $1; + $self->{'distro-name'} = $distroName; + + # load module for the requested distro: + if (!exists $supportedDistros{lc($distroName)}) { + # try without _x86_64: + $distroName =~ s[_x86_64$][]; + if (!exists $supportedDistros{lc($distroName)}) { + # try basic distro-type (e.g. debian or suse): + $distroName =~ s[-.+$][]; + if (!exists $supportedDistros{lc($distroName)}) { + # fallback to generic implementation: + $distroName = '<any>'; + } + } + } + my $distroModuleName = $supportedDistros{lc($distroName)}->{module}; + my $distro = + instantiateClass("OpenSLX::OSExport::Distro::$distroModuleName"); + $distro->initialize($self); + $self->{distro} = $distro; + + # load module for the requested export type: + my $fsModuleName = $supportedExportFileSystems{$exportFS}; + my $exporter = + instantiateClass("OpenSLX::OSExport::FileSystem::$fsModuleName"); + if (length($exportBD)) { + my $blockModuleName = $supportedExportBlockDevices{$exportBD}; + my $blockDevice = + instantiateClass("OpenSLX::OSExport::BlockDevice::$blockModuleName"); + $blockDevice->initialize($self, $exporter); + $exporter->initialize($self, $blockDevice); + } else { + $exporter->initialize($self); + } + $self->{'exporter'} = $exporter; + + # setup source and target paths: + $self->{'vendor-os-path'} = + "$openslxConfig{'private-path'}/stage1/$vendorOSName"; + vlog( + 1, + _tr( + "vendor-OS from '%s' will be exported to '%s'", + $self->{'vendor-os-path'}, + $exporter->{'export-path'} + ) + ); + return; } sub _addExportToConfigDB { - my $self = shift; - - my $openslxDB = instantiateClass("OpenSLX::ConfigDB"); - $openslxDB->connect(); - - my $export = $openslxDB->fetchExportByFilter( - { - 'name' => $self->{'export-name'}, - 'vendor_os_id' => $self->{'vendor-os-id'}, - } - ); - if (defined $export) { - vlog( - 0, - _tr( - "No need to change export '%s' in OpenSLX-database.\n", - $self->{'export-name'} - ) - ); - $self->{exporter}->showExportConfigInfo($export); - } else { - $export = { - 'vendor_os_id' => $self->{'vendor-os-id'}, - 'name' => $self->{'export-name'}, - 'type' => $self->{'export-type'}, - }; - - my $id = $self->{exporter}->addExportToConfigDB($export, $openslxDB); - vlog( - 0, - _tr( - "Export '%s' has been added to DB (ID=%s)...\n", - $self->{'export-name'}, $id - ) - ); - - $self->{exporter}->showExportConfigInfo($export) if $id; - } - - my $system = $openslxDB->fetchSystemByFilter({ - 'name' => $self->{'export-name'}, - }); - if (!defined $system) { - # now create a default system for that export, using the standard kernel: - system("slxconfig add-system $self->{'export-name'}"); - } - - $openslxDB->disconnect(); - return; + my $self = shift; + + my $openslxDB = instantiateClass("OpenSLX::ConfigDB"); + $openslxDB->connect(); + + my $export = $openslxDB->fetchExportByFilter( + { + 'name' => $self->{'export-name'}, + 'vendor_os_id' => $self->{'vendor-os-id'}, + } + ); + if (defined $export) { + vlog( + 0, + _tr( + "No need to change export '%s' in OpenSLX-database.\n", + $self->{'export-name'} + ) + ); + $self->{exporter}->showExportConfigInfo($export); + } else { + $export = { + 'vendor_os_id' => $self->{'vendor-os-id'}, + 'name' => $self->{'export-name'}, + 'type' => $self->{'export-type'}, + }; + + my $id = $self->{exporter}->addExportToConfigDB($export, $openslxDB); + vlog( + 0, + _tr( + "Export '%s' has been added to DB (ID=%s)...\n", + $self->{'export-name'}, $id + ) + ); + + $self->{exporter}->showExportConfigInfo($export) if $id; + } + + my $system = $openslxDB->fetchSystemByFilter({ + 'name' => $self->{'export-name'}, + }); + if (!defined $system) { + # now create a default system for that export, using the standard kernel: + system("slxconfig add-system $self->{'export-name'}"); + } + + $openslxDB->disconnect(); + return; } sub _removeExportFromConfigDB { - my $self = shift; - - my $openslxDB = instantiateClass("OpenSLX::ConfigDB"); - $openslxDB->connect(); - - # remove export from DB: - my $exportName = $self->{'export-name'}; - my $export = $openslxDB->fetchExportByFilter({'name' => $exportName,}); - if (!defined $export) { - vlog( - 0, - _tr( - "Export '%s' doesn't exist in OpenSLX-database.\n", $exportName - ) - ); - } else { - # remove all systems using this export and then remove the - # export itself: - my @systemIDs = - map { $_->{id} } - $openslxDB->fetchSystemByFilter({'export_id' => $export->{id}}, 'id'); - vlog( - 1, - _tr( - "removing systems '%s' from DB, since they belong to the export" - . " being deleted.\n", - join ',', - @systemIDs - ) - ); - $openslxDB->removeSystem(\@systemIDs); - $openslxDB->removeExport($export->{id}); - vlog(0, _tr("Export '%s' has been removed from DB.\n", $exportName)); - } - - $openslxDB->disconnect(); - return; + my $self = shift; + + my $openslxDB = instantiateClass("OpenSLX::ConfigDB"); + $openslxDB->connect(); + + # remove export from DB: + my $exportName = $self->{'export-name'}; + my $export = $openslxDB->fetchExportByFilter({'name' => $exportName,}); + if (!defined $export) { + vlog( + 0, + _tr( + "Export '%s' doesn't exist in OpenSLX-database.\n", $exportName + ) + ); + } else { + # remove all systems using this export and then remove the + # export itself: + my @systemIDs = + map { $_->{id} } + $openslxDB->fetchSystemByFilter({'export_id' => $export->{id}}, 'id'); + vlog( + 1, + _tr( + "removing systems '%s' from DB, since they belong to the export" + . " being deleted.\n", + join ',', + @systemIDs + ) + ); + $openslxDB->removeSystem(\@systemIDs); + $openslxDB->removeExport($export->{id}); + vlog(0, _tr("Export '%s' has been removed from DB.\n", $exportName)); + } + + $openslxDB->disconnect(); + return; } 1; diff --git a/installer/OpenSLX/OSExport/FileSystem/Base.pm b/installer/OpenSLX/OSExport/FileSystem/Base.pm index a59cc944..1014d596 100644 --- a/installer/OpenSLX/OSExport/FileSystem/Base.pm +++ b/installer/OpenSLX/OSExport/FileSystem/Base.pm @@ -9,14 +9,14 @@ # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- # Base.pm -# - provides empty base of the OpenSLX OSExport::FileSystem API. +# - provides empty base of the OpenSLX OSExport::FileSystem API. # ----------------------------------------------------------------------------- package OpenSLX::OSExport::FileSystem::Base; use strict; use warnings; -our $VERSION = 1.01; # API-version . implementation-version +our $VERSION = 1.01; # API-version . implementation-version use File::Basename; @@ -28,7 +28,7 @@ use OpenSLX::Utils; ################################################################################ sub new { - confess "Creating OpenSLX::OSExport::FileSystem::Base-objects directly makes no sense!"; + confess "Creating OpenSLX::OSExport::FileSystem::Base-objects directly makes no sense!"; } sub initialize @@ -45,16 +45,16 @@ sub purgeExport sub checkRequirements { - return 1; + return 1; } sub addExportToConfigDB { - my $self = shift; - my $export = shift; - my $openslxDB = shift; + my $self = shift; + my $export = shift; + my $openslxDB = shift; - return $openslxDB->addExport($export); + return $openslxDB->addExport($export); } sub generateExportURI @@ -78,54 +78,54 @@ sub showExportConfigInfo ################################################################################ sub _pickKernelVersion { - my $self = shift; - my $vendorOSPath = shift; - - my $kernel = followLink("$vendorOSPath/boot/vmlinuz"); - if (!-e $kernel) { - # 'vmlinuz'-link doesn't exist, so we have to pick the kernel manually - my $osSetupEngine = instantiateClass("OpenSLX::OSSetup::Engine"); - $osSetupEngine->initialize($self->{engine}->{'vendor-os-name'}, 'none'); - $kernel = $osSetupEngine->pickKernelFile("$vendorOSPath/boot"); - } - my $kernelName = basename($kernel); - if ($kernelName !~ m[-(.+)$]) { - die _tr("unable to determine version of kernel '%s'!", $kernelName); - } - return $1; + my $self = shift; + my $vendorOSPath = shift; + + my $kernel = followLink("$vendorOSPath/boot/vmlinuz"); + if (!-e $kernel) { + # 'vmlinuz'-link doesn't exist, so we have to pick the kernel manually + my $osSetupEngine = instantiateClass("OpenSLX::OSSetup::Engine"); + $osSetupEngine->initialize($self->{engine}->{'vendor-os-name'}, 'none'); + $kernel = $osSetupEngine->pickKernelFile("$vendorOSPath/boot"); + } + my $kernelName = basename($kernel); + if ($kernelName !~ m[-(.+)$]) { + die _tr("unable to determine version of kernel '%s'!", $kernelName); + } + return $1; } sub _locateKernelModule { - my $self = shift; - my $vendorOSPath = shift; - my $moduleName = shift; - my $defaultPaths = shift; - - vlog(1, _tr("locating kernel-module '%s'", $moduleName)); - # check default paths first: - foreach my $defPath (@$defaultPaths) { - vlog(2, "trying $defPath/$moduleName"); - my $target = followLink("$defPath/$moduleName", $vendorOSPath); - return $target unless !-e $target; - } - # use brute force to search for the newest incarnation of the module: - use File::Find; - my $location; - my $locationAge = 9999999; - vlog(2, "searching in $vendorOSPath/lib/modules"); - find sub { - return unless $_ eq $moduleName; - if (-M _ < $locationAge) { - $locationAge = -M _; - $location = $File::Find::name; - vlog(2, "located at $location (age=$locationAge days)"); - } - }, "$vendorOSPath/lib/modules"; - if (defined $location) { - return followLink($location, $vendorOSPath); - } - return; + my $self = shift; + my $vendorOSPath = shift; + my $moduleName = shift; + my $defaultPaths = shift; + + vlog(1, _tr("locating kernel-module '%s'", $moduleName)); + # check default paths first: + foreach my $defPath (@$defaultPaths) { + vlog(2, "trying $defPath/$moduleName"); + my $target = followLink("$defPath/$moduleName", $vendorOSPath); + return $target unless !-e $target; + } + # use brute force to search for the newest incarnation of the module: + use File::Find; + my $location; + my $locationAge = 9999999; + vlog(2, "searching in $vendorOSPath/lib/modules"); + find sub { + return unless $_ eq $moduleName; + if (-M _ < $locationAge) { + $locationAge = -M _; + $location = $File::Find::name; + vlog(2, "located at $location (age=$locationAge days)"); + } + }, "$vendorOSPath/lib/modules"; + if (defined $location) { + return followLink($location, $vendorOSPath); + } + return; } 1; diff --git a/installer/OpenSLX/OSExport/FileSystem/NFS.pm b/installer/OpenSLX/OSExport/FileSystem/NFS.pm index 9ab1ddfe..f14bc497 100644 --- a/installer/OpenSLX/OSExport/FileSystem/NFS.pm +++ b/installer/OpenSLX/OSExport/FileSystem/NFS.pm @@ -9,7 +9,7 @@ # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- # NFS.pm -# - provides NFS-specific overrides of the OpenSLX::OSExport::FileSystem API. +# - provides NFS-specific overrides of the OpenSLX::OSExport::FileSystem API. # ----------------------------------------------------------------------------- package OpenSLX::OSExport::FileSystem::NFS; @@ -28,107 +28,107 @@ use OpenSLX::Utils; ################################################################################ sub new { - my $class = shift; - my $self = { - 'name' => 'nfs', - }; - return bless $self, $class; + my $class = shift; + my $self = { + 'name' => 'nfs', + }; + return bless $self, $class; } sub initialize { - my $self = shift; - my $engine = shift; + my $self = shift; + my $engine = shift; - $self->{'engine'} = $engine; - my $exportBasePath = "$openslxConfig{'public-path'}/export"; - $self->{'export-path'} = "$exportBasePath/nfs/$engine->{'vendor-os-name'}"; - return; + $self->{'engine'} = $engine; + my $exportBasePath = "$openslxConfig{'public-path'}/export"; + $self->{'export-path'} = "$exportBasePath/nfs/$engine->{'vendor-os-name'}"; + return; } sub exportVendorOS { - my $self = shift; - my $source = shift; + my $self = shift; + my $source = shift; - my $target = $self->{'export-path'}; - $self->_copyViaRsync($source, $target); - return; + my $target = $self->{'export-path'}; + $self->_copyViaRsync($source, $target); + return; } sub purgeExport { - my $self = shift; - - my $target = $self->{'export-path'}; - if (system("rm -r $target")) { - vlog(0, _tr("unable to remove export '%s'!", $target)); - return 0; - } - return 1; + my $self = shift; + + my $target = $self->{'export-path'}; + if (system("rm -r $target")) { + vlog(0, _tr("unable to remove export '%s'!", $target)); + return 0; + } + return 1; } sub checkRequirements { - my $self = shift; - my $vendorOSPath = shift; - - # determine most appropriate kernel version ... - my $kernelVer = $self->_pickKernelVersion($vendorOSPath); - - # ... and check if that kernel-version provides all the required modules - my $nfsMod = $self->_locateKernelModule( - $vendorOSPath, - 'nfs.ko', - [ - "$vendorOSPath/lib/modules/$kernelVer/kernel/fs/nfs", - "$vendorOSPath/lib/modules/$kernelVer/kernel/fs" - ] - ); - if (!defined $nfsMod) { - warn _tr("unable to find nfs-module for kernel version '%s'.", - $kernelVer); - return; - } - return 1; + my $self = shift; + my $vendorOSPath = shift; + + # determine most appropriate kernel version ... + my $kernelVer = $self->_pickKernelVersion($vendorOSPath); + + # ... and check if that kernel-version provides all the required modules + my $nfsMod = $self->_locateKernelModule( + $vendorOSPath, + 'nfs.ko', + [ + "$vendorOSPath/lib/modules/$kernelVer/kernel/fs/nfs", + "$vendorOSPath/lib/modules/$kernelVer/kernel/fs" + ] + ); + if (!defined $nfsMod) { + warn _tr("unable to find nfs-module for kernel version '%s'.", + $kernelVer); + return; + } + return 1; } sub generateExportURI { - my $self = shift; - my $export = shift; - my $vendorOS = shift; - - my $serverIP = $export->{server_ip} || ''; - my $server - = length($serverIP) ? $serverIP : generatePlaceholderFor('serverip'); - my $port = $export->{port} || ''; - $server .= ":$port" if length($port); - - my $exportPath = "$openslxConfig{'public-path'}/export"; - return "nfs://$server$exportPath/nfs/$vendorOS->{name}"; + my $self = shift; + my $export = shift; + my $vendorOS = shift; + + my $serverIP = $export->{server_ip} || ''; + my $server + = length($serverIP) ? $serverIP : generatePlaceholderFor('serverip'); + my $port = $export->{port} || ''; + $server .= ":$port" if length($port); + + my $exportPath = "$openslxConfig{'public-path'}/export"; + return "nfs://$server$exportPath/nfs/$vendorOS->{name}"; } sub requiredFSMods { - my $self = shift; + my $self = shift; - return qw( nfs ); + return qw( nfs ); } sub showExportConfigInfo { - my $self = shift; - my $export = shift; + my $self = shift; + my $export = shift; - print (('#' x 80)."\n"); - print _tr("Please make sure the following line is contained in /etc/exports\nin order to activate the NFS-export of this vendor-OS:\n\t%s\n", - "$self->{'export-path'}\t*(ro,no_root_squash,async,no_subtree_check)"); - print (('#' x 80)."\n"); + print (('#' x 80)."\n"); + print _tr("Please make sure the following line is contained in /etc/exports\nin order to activate the NFS-export of this vendor-OS:\n\t%s\n", + "$self->{'export-path'}\t*(ro,no_root_squash,async,no_subtree_check)"); + print (('#' x 80)."\n"); # TODO : add something a bit more clever here... -# my $exports = slurpFile("/etc/exports"); - return; +# my $exports = slurpFile("/etc/exports"); + return; } ################################################################################ @@ -136,48 +136,48 @@ sub showExportConfigInfo ################################################################################ sub _copyViaRsync { - my $self = shift; - my $source = shift; - my $target = shift; - - if (system("mkdir -p $target")) { - die _tr("unable to create directory '%s', giving up! (%s)\n", - $target, $!); - } - my $includeExcludeList = $self->_determineIncludeExcludeList(); - vlog(1, _tr("using include-exclude-filter:\n%s\n", $includeExcludeList)); - my $rsyncFH; - my $additionalRsyncOptions = $ENV{SLX_RSYNC_OPTIONS} || ''; - my $rsyncCmd - = "rsync -av --delete-excluded --exclude-from=- $additionalRsyncOptions" - . " $source/ $target"; - vlog(2, "executing: $rsyncCmd\n"); - open($rsyncFH, '|-', $rsyncCmd) - or die _tr("unable to start rsync for source '%s', giving up! (%s)", - $source, $!); - print $rsyncFH $includeExcludeList; - close($rsyncFH) - or die _tr("unable to export to target '%s', giving up! (%s)", - $target, $!); - return; + my $self = shift; + my $source = shift; + my $target = shift; + + if (system("mkdir -p $target")) { + die _tr("unable to create directory '%s', giving up! (%s)\n", + $target, $!); + } + my $includeExcludeList = $self->_determineIncludeExcludeList(); + vlog(1, _tr("using include-exclude-filter:\n%s\n", $includeExcludeList)); + my $rsyncFH; + my $additionalRsyncOptions = $ENV{SLX_RSYNC_OPTIONS} || ''; + my $rsyncCmd + = "rsync -av --delete-excluded --exclude-from=- $additionalRsyncOptions" + . " $source/ $target"; + vlog(2, "executing: $rsyncCmd\n"); + open($rsyncFH, '|-', $rsyncCmd) + or die _tr("unable to start rsync for source '%s', giving up! (%s)", + $source, $!); + print $rsyncFH $includeExcludeList; + close($rsyncFH) + or die _tr("unable to export to target '%s', giving up! (%s)", + $target, $!); + return; } sub _determineIncludeExcludeList { - my $self = shift; - - # Rsync uses a first match strategy, so we 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 - = "$openslxConfig{'config-path'}/distro-info/$distroName/export-filter"; - my $includeExcludeList - = slurpFile($localFilterFile, { failIfMissing => 0 }); - $includeExcludeList .= $self->{engine}->{distro}->{'export-filter'}; - $includeExcludeList =~ s[^\s+][]igms; - # remove any leading whitespace, as rsync doesn't like it - return $includeExcludeList; + my $self = shift; + + # Rsync uses a first match strategy, so we 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 + = "$openslxConfig{'config-path'}/distro-info/$distroName/export-filter"; + my $includeExcludeList + = slurpFile($localFilterFile, { failIfMissing => 0 }); + $includeExcludeList .= $self->{engine}->{distro}->{'export-filter'}; + $includeExcludeList =~ s[^\s+][]igms; + # remove any leading whitespace, as rsync doesn't like it + return $includeExcludeList; } 1; diff --git a/installer/OpenSLX/OSExport/FileSystem/SquashFS.pm b/installer/OpenSLX/OSExport/FileSystem/SquashFS.pm index 87407ca3..d9760642 100644 --- a/installer/OpenSLX/OSExport/FileSystem/SquashFS.pm +++ b/installer/OpenSLX/OSExport/FileSystem/SquashFS.pm @@ -9,8 +9,8 @@ # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- # SquashFS.pm -# - provides SquashFS-specific overrides of the OpenSLX::OSExport::ExportType -# API. +# - provides SquashFS-specific overrides of the OpenSLX::OSExport::ExportType +# API. # ----------------------------------------------------------------------------- package OpenSLX::OSExport::FileSystem::SquashFS; @@ -30,153 +30,153 @@ use OpenSLX::Utils; ################################################################################ sub new { - my $class = shift; - my $self = {'name' => 'sqfs',}; - return bless $self, $class; + my $class = shift; + my $self = {'name' => 'sqfs',}; + return bless $self, $class; } sub initialize { - my $self = shift; - my $engine = shift; - my $blockDevice = shift || confess('need to pass in block-device!'); - - $self->{'engine'} = $engine; - $self->{'block-device'} = $blockDevice; - my $exportBasePath = "$openslxConfig{'public-path'}/export"; - $self->{'export-path'} = "$exportBasePath/sqfs/$engine->{'vendor-os-name'}"; - return; + my $self = shift; + my $engine = shift; + my $blockDevice = shift || confess('need to pass in block-device!'); + + $self->{'engine'} = $engine; + $self->{'block-device'} = $blockDevice; + my $exportBasePath = "$openslxConfig{'public-path'}/export"; + $self->{'export-path'} = "$exportBasePath/sqfs/$engine->{'vendor-os-name'}"; + return; } sub exportVendorOS { - my $self = shift; - my $source = shift; - - my $includeExcludeList = $self->_determineIncludeExcludeList(); - # in order to do the filtering as part of mksquashfs, we need to map - # our internal (rsync-)filter format to regexes: - $includeExcludeList = - $self->_mapRsyncFilter2Regex($source, $includeExcludeList); - vlog(1, _tr("using include-exclude-filter:\n%s\n", $includeExcludeList)); - my $target = $self->{'export-path'}; - - my $sourceTime = (stat($source))[9] || 0; - my $targetTime = (stat($target))[9] || 0; - vlog(2, "source-time=$sourceTime target-time=$targetTime"); - - if ($targetTime && $sourceTime < $targetTime) { - vlog( - 0, - "!!! creation of squashfs skipped, as vendor-OS hasn't changed since last export!\n" - . "!!! Use 'touch $source' to force an export." - ); - } else { - $self->_createSquashFS($source, $target, $includeExcludeList); - } - $self->_addBlockDeviceTagToExport($target); - return; + my $self = shift; + my $source = shift; + + my $includeExcludeList = $self->_determineIncludeExcludeList(); + # in order to do the filtering as part of mksquashfs, we need to map + # our internal (rsync-)filter format to regexes: + $includeExcludeList = + $self->_mapRsyncFilter2Regex($source, $includeExcludeList); + vlog(1, _tr("using include-exclude-filter:\n%s\n", $includeExcludeList)); + my $target = $self->{'export-path'}; + + my $sourceTime = (stat($source))[9] || 0; + my $targetTime = (stat($target))[9] || 0; + vlog(2, "source-time=$sourceTime target-time=$targetTime"); + + if ($targetTime && $sourceTime < $targetTime) { + vlog( + 0, + "!!! creation of squashfs skipped, as vendor-OS hasn't changed since last export!\n" + . "!!! Use 'touch $source' to force an export." + ); + } else { + $self->_createSquashFS($source, $target, $includeExcludeList); + } + $self->_addBlockDeviceTagToExport($target); + return; } sub purgeExport { - my $self = shift; - - my $target = $self->{'export-path'}; - if ($self->_removeBlockDeviceTagFromExport($target)) { - # no more tags, we can remove the image: - if (slxsystem("rm $target")) { - vlog(0, _tr("unable to remove export '%s'!", $target)); - return 0; - } - } - return 1; + my $self = shift; + + my $target = $self->{'export-path'}; + if ($self->_removeBlockDeviceTagFromExport($target)) { + # no more tags, we can remove the image: + if (slxsystem("rm $target")) { + vlog(0, _tr("unable to remove export '%s'!", $target)); + return 0; + } + } + return 1; } sub checkRequirements { - my $self = shift; - my $vendorOSPath = shift; - - # determine most appropriate kernel version ... - my $kernelVer = $self->_pickKernelVersion($vendorOSPath); - - # ... and check if that kernel-version provides all the required modules - my @blockModNames = $self->{'block-device'}->requiredBlockDeviceModules(); - foreach my $blockModName (@blockModNames) { - my $blockMod = - $self->_locateKernelModule($vendorOSPath, "$blockModName.ko", - ["$vendorOSPath/lib/modules/$kernelVer/kernel/drivers/block"]); - if (!defined $blockMod) { - warn _tr( - "unable to find blockdevice-module '%s' for kernel version '%s'.", - $blockModName, $kernelVer - ); - return; - } - } - my $squashfsMod = $self->_locateKernelModule( - $vendorOSPath, - 'squashfs.ko', - [ - "$vendorOSPath/lib/modules/$kernelVer/kernel/fs/squashfs", - "$vendorOSPath/lib/modules/$kernelVer/kernel/fs" - ] - ); - if (!defined $squashfsMod) { - warn _tr("unable to find squashfs-module for kernel version '%s'.", - $kernelVer); - return; - } - return 1; + my $self = shift; + my $vendorOSPath = shift; + + # determine most appropriate kernel version ... + my $kernelVer = $self->_pickKernelVersion($vendorOSPath); + + # ... and check if that kernel-version provides all the required modules + my @blockModNames = $self->{'block-device'}->requiredBlockDeviceModules(); + foreach my $blockModName (@blockModNames) { + my $blockMod = + $self->_locateKernelModule($vendorOSPath, "$blockModName.ko", + ["$vendorOSPath/lib/modules/$kernelVer/kernel/drivers/block"]); + if (!defined $blockMod) { + warn _tr( + "unable to find blockdevice-module '%s' for kernel version '%s'.", + $blockModName, $kernelVer + ); + return; + } + } + my $squashfsMod = $self->_locateKernelModule( + $vendorOSPath, + 'squashfs.ko', + [ + "$vendorOSPath/lib/modules/$kernelVer/kernel/fs/squashfs", + "$vendorOSPath/lib/modules/$kernelVer/kernel/fs" + ] + ); + if (!defined $squashfsMod) { + warn _tr("unable to find squashfs-module for kernel version '%s'.", + $kernelVer); + return; + } + return 1; } sub addExportToConfigDB { - my $self = shift; - my $export = shift; - my $openslxDB = shift; + my $self = shift; + my $export = shift; + my $openslxDB = shift; - $export->{port} = $self->{'block-device'}->getExportPort($openslxDB); + $export->{port} = $self->{'block-device'}->getExportPort($openslxDB); - my $res = $openslxDB->addExport($export); - return $res; + my $res = $openslxDB->addExport($export); + return $res; } sub generateExportURI { - my $self = shift; - my $export = shift; - my $vendorOS = shift; + my $self = shift; + my $export = shift; + my $vendorOS = shift; - my $URI = $self->{'block-device'}->generateExportURI($export); - $URI .= '/squashfs'; - return $URI; + my $URI = $self->{'block-device'}->generateExportURI($export); + $URI .= '/squashfs'; + return $URI; } sub requiredFSMods { - my $self = shift; + my $self = shift; - my @mods = $self->{'block-device'}->requiredBlockDeviceModules(); - push @mods, 'squashfs '; - return @mods; + my @mods = $self->{'block-device'}->requiredBlockDeviceModules(); + push @mods, 'squashfs '; + return @mods; } sub requiredFSTools { - my $self = shift; + my $self = shift; - return $self->{'block-device'}->requiredBlockDeviceTools(); + return $self->{'block-device'}->requiredBlockDeviceTools(); } sub showExportConfigInfo { - my $self = shift; - my $export = shift; + my $self = shift; + my $export = shift; - $self->{'block-device'}->showExportConfigInfo($export); - return; + $self->{'block-device'}->showExportConfigInfo($export); + return; } ################################################################################ @@ -185,122 +185,122 @@ sub showExportConfigInfo sub _createSquashFS { - my $self = shift; - my $source = shift; - my $target = shift; - my $includeExcludeList = shift; - - system("rm -f $target"); - # mksquasfs isn't significantly faster if fs already exists, but it - # causes the filesystem to grow somewhat, so we remove it in order to - # get the smallest FS-file possible. - - my $baseDir = dirname($target); - if (!-e $baseDir) { - if (system("mkdir -p $baseDir")) { - die _tr("unable to create directory '%s', giving up! (%s)\n", - $baseDir, $!); - } - } - - # dump filter to a file ... - my $filterFile = "/tmp/slx-nbdsquash-filter-$$"; - spitFile($filterFile, $includeExcludeList); - - # ... invoke mksquashfs ... - vlog(0, _tr("invoking mksquashfs...")); - my $mksquashfsBinary = - "$openslxConfig{'base-path'}/share/squashfs/mksquashfs"; - my $res = system("$mksquashfsBinary $source $target -ff $filterFile"); - unlink($filterFile); - # ... remove filter file if done - if ($res) { - die _tr( - "unable to create squashfs for source '%s' as target '%s', giving up! (%s)", - $source, $target, $!); - } + my $self = shift; + my $source = shift; + my $target = shift; + my $includeExcludeList = shift; + + system("rm -f $target"); + # mksquasfs isn't significantly faster if fs already exists, but it + # causes the filesystem to grow somewhat, so we remove it in order to + # get the smallest FS-file possible. + + my $baseDir = dirname($target); + if (!-e $baseDir) { + if (system("mkdir -p $baseDir")) { + die _tr("unable to create directory '%s', giving up! (%s)\n", + $baseDir, $!); + } + } + + # dump filter to a file ... + my $filterFile = "/tmp/slx-nbdsquash-filter-$$"; + spitFile($filterFile, $includeExcludeList); + + # ... invoke mksquashfs ... + vlog(0, _tr("invoking mksquashfs...")); + my $mksquashfsBinary = + "$openslxConfig{'base-path'}/share/squashfs/mksquashfs"; + my $res = system("$mksquashfsBinary $source $target -ff $filterFile"); + unlink($filterFile); + # ... remove filter file if done + if ($res) { + die _tr( + "unable to create squashfs for source '%s' as target '%s', giving up! (%s)", + $source, $target, $!); + } } sub _determineIncludeExcludeList { - my $self = shift; - - # Rsync uses a first match strategy, so we 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 = - "$openslxConfig{'config-path'}/distro-info/$distroName/export-filter"; - my $includeExcludeList - = slurpFile($localFilterFile, { failIfMissing => 0 }); - $includeExcludeList .= $self->{engine}->{distro}->{'export-filter'}; - $includeExcludeList =~ s[^\s+][]igms; - # remove any leading whitespace, as rsync doesn't like it - return $includeExcludeList; + my $self = shift; + + # Rsync uses a first match strategy, so we 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 = + "$openslxConfig{'config-path'}/distro-info/$distroName/export-filter"; + my $includeExcludeList + = slurpFile($localFilterFile, { failIfMissing => 0 }); + $includeExcludeList .= $self->{engine}->{distro}->{'export-filter'}; + $includeExcludeList =~ s[^\s+][]igms; + # remove any leading whitespace, as rsync doesn't like it + return $includeExcludeList; } sub _mapRsyncFilter2Regex { - my $self = shift; - my $sourcePath = shift; - my $rsyncFilter = shift; - - return join( - "\n", - map { - if ($_ =~ m[^([-+]\s*)(.+?)\s*$]) - { - my $action = $1; - my $regex = $2; - $regex =~ s[\*\*][.+]g; - # '**' matches everything - $regex =~ s[\*][[^/]+]g; - # '*' matches anything except slashes - $regex =~ s[\?][[^/]?]g; - # '*' matches any single char except slash - $regex =~ s[\?][[^/]?]g; - # '*' matches any single char except slash - $regex =~ s[\.][\\.]g; - # escape any dots - if (substr($regex, 0, 1) eq '/') { - # absolute path given, need to extend by source-path: - "$action^$sourcePath$regex\$"; - } else { - # filename pattern given, need to anchor to the end only: - "$action$regex\$"; - } - } else { - $_; - } - } - split "\n", - $rsyncFilter - ); + my $self = shift; + my $sourcePath = shift; + my $rsyncFilter = shift; + + return join( + "\n", + map { + if ($_ =~ m[^([-+]\s*)(.+?)\s*$]) + { + my $action = $1; + my $regex = $2; + $regex =~ s[\*\*][.+]g; + # '**' matches everything + $regex =~ s[\*][[^/]+]g; + # '*' matches anything except slashes + $regex =~ s[\?][[^/]?]g; + # '*' matches any single char except slash + $regex =~ s[\?][[^/]?]g; + # '*' matches any single char except slash + $regex =~ s[\.][\\.]g; + # escape any dots + if (substr($regex, 0, 1) eq '/') { + # absolute path given, need to extend by source-path: + "$action^$sourcePath$regex\$"; + } else { + # filename pattern given, need to anchor to the end only: + "$action$regex\$"; + } + } else { + $_; + } + } + split "\n", + $rsyncFilter + ); } sub _addBlockDeviceTagToExport { - my $self = shift; - my $target = shift; + my $self = shift; + my $target = shift; - my $tagName = "$target" . '@' . lc($self->{'block-device'}->{name}); - linkFile(basename($target), $tagName); - return; + my $tagName = "$target" . '@' . lc($self->{'block-device'}->{name}); + linkFile(basename($target), $tagName); + return; } sub _removeBlockDeviceTagFromExport { - my $self = shift; - my $target = shift; - - my $tagName = "$target" . '@' . lc($self->{'block-device'}->{name}); - slxsystem("rm $tagName"); - # now find out whether or not there are any other tags left: - my $vendorOSName = basename($target); - opendir(DIR, dirname($target)); - my @tags = grep { /^$vendorOSName\@/ } readdir(DIR); - return @tags ? 0 : 1; - # return 1 if no more tags (i.e. it is safe to remove the image) + my $self = shift; + my $target = shift; + + my $tagName = "$target" . '@' . lc($self->{'block-device'}->{name}); + slxsystem("rm $tagName"); + # now find out whether or not there are any other tags left: + my $vendorOSName = basename($target); + opendir(DIR, dirname($target)); + my @tags = grep { /^$vendorOSName\@/ } readdir(DIR); + return @tags ? 0 : 1; + # return 1 if no more tags (i.e. it is safe to remove the image) } 1; |