diff options
Diffstat (limited to 'installer/OpenSLX/OSSetup/MetaPackager')
-rw-r--r-- | installer/OpenSLX/OSSetup/MetaPackager/Base.pm | 14 | ||||
-rw-r--r-- | installer/OpenSLX/OSSetup/MetaPackager/apt.pm | 166 | ||||
-rw-r--r-- | installer/OpenSLX/OSSetup/MetaPackager/smart.pm | 148 | ||||
-rw-r--r-- | installer/OpenSLX/OSSetup/MetaPackager/yum.pm | 110 | ||||
-rw-r--r-- | installer/OpenSLX/OSSetup/MetaPackager/zypper.pm | 106 |
5 files changed, 272 insertions, 272 deletions
diff --git a/installer/OpenSLX/OSSetup/MetaPackager/Base.pm b/installer/OpenSLX/OSSetup/MetaPackager/Base.pm index 517e9f9a..af789888 100644 --- a/installer/OpenSLX/OSSetup/MetaPackager/Base.pm +++ b/installer/OpenSLX/OSSetup/MetaPackager/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 OSSetup::MetaPackager API. +# - provides empty base of the OpenSLX OSSetup::MetaPackager API. # ----------------------------------------------------------------------------- package OpenSLX::OSSetup::MetaPackager::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,16 +25,16 @@ use OpenSLX::Basics; ################################################################################ sub new { - confess "Creating OpenSLX::OSSetup::MetaPackager::Base-objects directly makes no sense!"; + confess "Creating OpenSLX::OSSetup::MetaPackager::Base-objects directly makes no sense!"; } sub initialize { - my $self = shift; - my $engine = shift; + my $self = shift; + my $engine = shift; - $self->{'engine'} = $engine; - return; + $self->{'engine'} = $engine; + return; } sub initPackageSources diff --git a/installer/OpenSLX/OSSetup/MetaPackager/apt.pm b/installer/OpenSLX/OSSetup/MetaPackager/apt.pm index a8a4f91e..ecb87a35 100644 --- a/installer/OpenSLX/OSSetup/MetaPackager/apt.pm +++ b/installer/OpenSLX/OSSetup/MetaPackager/apt.pm @@ -9,7 +9,7 @@ # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- # apt.pm -# - provides apt-get-specific overrides of the OpenSLX::OSSetup::MetaPackager API. +# - provides apt-get-specific overrides of the OpenSLX::OSSetup::MetaPackager API. # ----------------------------------------------------------------------------- package OpenSLX::OSSetup::MetaPackager::apt; @@ -26,117 +26,117 @@ use OpenSLX::Utils; ################################################################################ sub new { - my $class = shift; - my $self = { - 'name' => 'apt', - }; - return bless $self, $class; + my $class = shift; + my $self = { + 'name' => 'apt', + }; + return bless $self, $class; } sub initPackageSources { - my $self = shift; - - $ENV{LC_ALL} = 'POSIX'; - - # remove any existing sources - slxsystem('rm -f /etc/apt/sources.list'); - - # create default timezone if there isn't any - if (!-e '/etc/timezone') { - spitFile('/etc/timezone', "$openslxConfig{'default-timezone'}\n"); - } - - # create kernel config if there isn't any - if (!-e '/etc/kernel-img.conf') { - my $kernelConfig = unshiftHereDoc(<<" END-OF-HERE"); - # Kernel image management overrides - # See kernel-img.conf(5) for details - do_symlinks = yes - relative_links = yes - do_bootloader = no - do_bootfloppy = no - do_initrd = yes - link_in_boot = yes - END-OF-HERE - spitFile('/etc/kernel-img.conf', $kernelConfig); - } - - return 1; + my $self = shift; + + $ENV{LC_ALL} = 'POSIX'; + + # remove any existing sources + slxsystem('rm -f /etc/apt/sources.list'); + + # create default timezone if there isn't any + if (!-e '/etc/timezone') { + spitFile('/etc/timezone', "$openslxConfig{'default-timezone'}\n"); + } + + # create kernel config if there isn't any + if (!-e '/etc/kernel-img.conf') { + my $kernelConfig = unshiftHereDoc(<<" END-OF-HERE"); + # Kernel image management overrides + # See kernel-img.conf(5) for details + do_symlinks = yes + relative_links = yes + do_bootloader = no + do_bootfloppy = no + do_initrd = yes + link_in_boot = yes + END-OF-HERE + spitFile('/etc/kernel-img.conf', $kernelConfig); + } + + return 1; } sub setupPackageSource { - my $self = shift; - my $repoName = shift; - my $repoInfo = shift; - my $excludeList = shift; - my $repoURLs = shift; + my $self = shift; + my $repoName = shift; + my $repoInfo = shift; + my $excludeList = shift; + my $repoURLs = shift; - my $baseURL = shift @$repoURLs; - my $distribution = $repoInfo->{'distribution'}; - my $components = $repoInfo->{'components'}; + my $baseURL = shift @$repoURLs; + my $distribution = $repoInfo->{'distribution'}; + my $components = $repoInfo->{'components'}; - my $sourcesList = "deb $baseURL $distribution $components\n"; + my $sourcesList = "deb $baseURL $distribution $components\n"; - foreach my $mirrorURL (@$repoURLs) { - $sourcesList .= "deb $mirrorURL $distribution $components\n"; - } + foreach my $mirrorURL (@$repoURLs) { + $sourcesList .= "deb $mirrorURL $distribution $components\n"; + } - appendFile('/etc/apt/sources.list', $sourcesList); + appendFile('/etc/apt/sources.list', $sourcesList); - return; + return; } sub installPackages { - my $self = shift; - my $packages = shift; - my $doRefresh = shift || 0; - - $packages =~ tr{\n}{ }; - - if ($doRefresh && slxsystem("apt-get -y update")) { - die _tr("unable to update repository info (%s)\n", $!); - } - if ('/var/cache/debconf/slx-defaults.dat') { - $ENV{DEBCONF_DB_FALLBACK} - = "'File{/var/cache/debconf/slx-defaults.dat}'"; - } - $ENV{DEBIAN_FRONTEND} = 'noninteractive'; - if (slxsystem("apt-get -y install $packages")) { - die _tr("unable to install selection (%s)\n", $!); - } - delete $ENV{DEBCONF_DB_FALLBACK}; - delete $ENV{DEBIAN_FRONTEND}; - - return 1; + my $self = shift; + my $packages = shift; + my $doRefresh = shift || 0; + + $packages =~ tr{\n}{ }; + + if ($doRefresh && slxsystem("apt-get -y update")) { + die _tr("unable to update repository info (%s)\n", $!); + } + if ('/var/cache/debconf/slx-defaults.dat') { + $ENV{DEBCONF_DB_FALLBACK} + = "'File{/var/cache/debconf/slx-defaults.dat}'"; + } + $ENV{DEBIAN_FRONTEND} = 'noninteractive'; + if (slxsystem("apt-get -y install $packages")) { + die _tr("unable to install selection (%s)\n", $!); + } + delete $ENV{DEBCONF_DB_FALLBACK}; + delete $ENV{DEBIAN_FRONTEND}; + + return 1; } sub removePackages { - my $self = shift; - my $pkgSelection = shift; + my $self = shift; + my $pkgSelection = shift; - if (slxsystem("apt-get -y remove $pkgSelection")) { - die _tr("unable to remove selection (%s)\n", $!); - } + if (slxsystem("apt-get -y remove $pkgSelection")) { + die _tr("unable to remove selection (%s)\n", $!); + } - return 1; + return 1; } sub updateBasicVendorOS { - my $self = shift; + my $self = shift; - if (slxsystem("apt-get -y update")) { - die _tr("unable to update repository info (%s)\n", $!); - } - if (slxsystem("apt-get -y upgrade")) { - die _tr("unable to update this vendor-os (%s)\n", $!); - } + if (slxsystem("apt-get -y update")) { + die _tr("unable to update repository info (%s)\n", $!); + } + if (slxsystem("apt-get -y upgrade")) { + die _tr("unable to update this vendor-os (%s)\n", $!); + } - return 1; + return 1; } 1;
\ No newline at end of file diff --git a/installer/OpenSLX/OSSetup/MetaPackager/smart.pm b/installer/OpenSLX/OSSetup/MetaPackager/smart.pm index 27995e01..fc178cb7 100644 --- a/installer/OpenSLX/OSSetup/MetaPackager/smart.pm +++ b/installer/OpenSLX/OSSetup/MetaPackager/smart.pm @@ -9,7 +9,7 @@ # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- # smart.pm -# - provides smart-specific overrides of the OpenSLX::OSSetup::MetaPackager API. +# - provides smart-specific overrides of the OpenSLX::OSSetup::MetaPackager API. # ----------------------------------------------------------------------------- package OpenSLX::OSSetup::MetaPackager::smart; @@ -26,102 +26,102 @@ use OpenSLX::Utils; ################################################################################ sub new { - my $class = shift; - my $self = { - 'name' => 'smart', - }; - return bless $self, $class; + my $class = shift; + my $self = { + 'name' => 'smart', + }; + return bless $self, $class; } sub initPackageSources { - my $self = shift; + my $self = shift; - $ENV{LC_ALL} = 'POSIX'; + $ENV{LC_ALL} = 'POSIX'; - # remove any existing channels - slxsystem("rm -f /etc/smart/channels/*"); - if (slxsystem("smart channel -y --remove-all")) { - die _tr("unable to remove existing channels (%s)\n", $!); - } - return 1; + # remove any existing channels + slxsystem("rm -f /etc/smart/channels/*"); + if (slxsystem("smart channel -y --remove-all")) { + die _tr("unable to remove existing channels (%s)\n", $!); + } + return 1; } sub setupPackageSource { - my $self = shift; - my $repoName = shift; - my $repoInfo = shift; - my $excludeList = shift; - my $repoURLs = shift; - - my $repoSubdir = ''; - if ($repoInfo->{'repo-subdir'}) { - $repoSubdir = "/$repoInfo->{'repo-subdir'}"; - } - my $baseURL = shift @$repoURLs; - my $repoDescr - = qq[$repoName name="$repoInfo->{name}" baseurl=$baseURL$repoSubdir]; - $repoDescr .= " type=rpm-md"; - if (slxsystem("smart channel -y --add $repoDescr")) { - die _tr("unable to add channel '%s' (%s)\n", $repoName, $!); - } - - my $mirrorDescr; - foreach my $mirrorURL (@$repoURLs) { - $mirrorDescr .= " --add $baseURL$repoSubdir $mirrorURL$repoSubdir"; - } - if (defined $mirrorDescr) { - if (slxsystem("smart mirror $mirrorDescr")) { - die _tr( - "unable to add mirrors for channel '%s' (%s)\n", - $repoName, $! - ); - } - } - return 1; + my $self = shift; + my $repoName = shift; + my $repoInfo = shift; + my $excludeList = shift; + my $repoURLs = shift; + + my $repoSubdir = ''; + if ($repoInfo->{'repo-subdir'}) { + $repoSubdir = "/$repoInfo->{'repo-subdir'}"; + } + my $baseURL = shift @$repoURLs; + my $repoDescr + = qq[$repoName name="$repoInfo->{name}" baseurl=$baseURL$repoSubdir]; + $repoDescr .= " type=rpm-md"; + if (slxsystem("smart channel -y --add $repoDescr")) { + die _tr("unable to add channel '%s' (%s)\n", $repoName, $!); + } + + my $mirrorDescr; + foreach my $mirrorURL (@$repoURLs) { + $mirrorDescr .= " --add $baseURL$repoSubdir $mirrorURL$repoSubdir"; + } + if (defined $mirrorDescr) { + if (slxsystem("smart mirror $mirrorDescr")) { + die _tr( + "unable to add mirrors for channel '%s' (%s)\n", + $repoName, $! + ); + } + } + return 1; } sub installPackages { - my $self = shift; - my $packages = shift; - my $doRefresh = shift || 0; - - $packages =~ tr{\n}{ }; - - if ($doRefresh && slxsystem("smart update")) { - die _tr("unable to update channel info (%s)\n", $!); - } - if (slxsystem("smart install -y $packages")) { - die _tr("unable to install selection (%s)\n", $!); - } - return 1; + my $self = shift; + my $packages = shift; + my $doRefresh = shift || 0; + + $packages =~ tr{\n}{ }; + + if ($doRefresh && slxsystem("smart update")) { + die _tr("unable to update channel info (%s)\n", $!); + } + if (slxsystem("smart install -y $packages")) { + die _tr("unable to install selection (%s)\n", $!); + } + return 1; } sub removePackages { - my $self = shift; - my $pkgSelection = shift; + my $self = shift; + my $pkgSelection = shift; - if (slxsystem("smart remove -y $pkgSelection")) { - die _tr("unable to remove selection (%s)\n", $!); - } - return 1; + if (slxsystem("smart remove -y $pkgSelection")) { + die _tr("unable to remove selection (%s)\n", $!); + } + return 1; } sub updateBasicVendorOS { - my $self = shift; - - if (slxsystem("smart upgrade -y --update")) { - if ($! == 2) { - # file not found => smart isn't installed - die _tr("unable to update this vendor-os, as it seems to lack an installation of smart!\n"); - } - die _tr("unable to update this vendor-os (%s)\n", $!); - } - return 1; + my $self = shift; + + if (slxsystem("smart upgrade -y --update")) { + if ($! == 2) { + # file not found => smart isn't installed + die _tr("unable to update this vendor-os, as it seems to lack an installation of smart!\n"); + } + die _tr("unable to update this vendor-os (%s)\n", $!); + } + return 1; } 1;
\ No newline at end of file diff --git a/installer/OpenSLX/OSSetup/MetaPackager/yum.pm b/installer/OpenSLX/OSSetup/MetaPackager/yum.pm index eef310fe..a48f6c36 100644 --- a/installer/OpenSLX/OSSetup/MetaPackager/yum.pm +++ b/installer/OpenSLX/OSSetup/MetaPackager/yum.pm @@ -9,7 +9,7 @@ # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- # yum.pm -# - provides yum-specific overrides of the OpenSLX::OSSetup::MetaPackager API. +# - provides yum-specific overrides of the OpenSLX::OSSetup::MetaPackager API. # ----------------------------------------------------------------------------- package OpenSLX::OSSetup::MetaPackager::yum; @@ -26,90 +26,90 @@ use OpenSLX::Utils; ################################################################################ sub new { - my $class = shift; - my $self = { - 'name' => 'yum', - }; - return bless $self, $class; + my $class = shift; + my $self = { + 'name' => 'yum', + }; + return bless $self, $class; } sub initPackageSources { - my $self = shift; + my $self = shift; - $ENV{LC_ALL} = 'POSIX'; + $ENV{LC_ALL} = 'POSIX'; - slxsystem("rm -f /etc/yum.repos.d/*"); - slxsystem("mkdir -p /etc/yum.repos.d"); + slxsystem("rm -f /etc/yum.repos.d/*"); + slxsystem("mkdir -p /etc/yum.repos.d"); - return 1; + return 1; } sub setupPackageSource { - my $self = shift; - my $repoName = shift; - my $repoInfo = shift; - my $excludeList = shift; - my $repoURLs = shift; - - my $repoSubdir; - if (length($repoInfo->{'repo-subdir'})) { - $repoSubdir = "/$repoInfo->{'repo-subdir'}"; - } - my $baseURL = shift @$repoURLs; - - my $repoDescr - = "[$repoName]\nname=$repoInfo->{name}\nbaseurl=$baseURL$repoSubdir\n"; - - foreach my $mirrorURL (@$repoURLs) { - $repoDescr .= " $mirrorURL$repoSubdir\n"; - } - my $repoFile = "/etc/yum.repos.d/$repoName.repo"; - spitFile($repoFile, "$repoDescr\nexclude=$excludeList\n"); - - return 1; + my $self = shift; + my $repoName = shift; + my $repoInfo = shift; + my $excludeList = shift; + my $repoURLs = shift; + + my $repoSubdir; + if (length($repoInfo->{'repo-subdir'})) { + $repoSubdir = "/$repoInfo->{'repo-subdir'}"; + } + my $baseURL = shift @$repoURLs; + + my $repoDescr + = "[$repoName]\nname=$repoInfo->{name}\nbaseurl=$baseURL$repoSubdir\n"; + + foreach my $mirrorURL (@$repoURLs) { + $repoDescr .= " $mirrorURL$repoSubdir\n"; + } + my $repoFile = "/etc/yum.repos.d/$repoName.repo"; + spitFile($repoFile, "$repoDescr\nexclude=$excludeList\n"); + + return 1; } sub installPackages { - my $self = shift; - my $packages = shift; + my $self = shift; + my $packages = shift; - $packages =~ tr{\n}{ }; + $packages =~ tr{\n}{ }; - if (slxsystem("yum -y install $packages")) { - die _tr("unable to install selection (%s)\n", $!); - } + if (slxsystem("yum -y install $packages")) { + die _tr("unable to install selection (%s)\n", $!); + } - return 1; + return 1; } sub removePackages { - my $self = shift; - my $pkgSelection = shift; + my $self = shift; + my $pkgSelection = shift; - if (slxsystem("yum -y remove $pkgSelection")) { - die _tr("unable to remove selection (%s)\n", $!); - } + if (slxsystem("yum -y remove $pkgSelection")) { + die _tr("unable to remove selection (%s)\n", $!); + } - return 1; + return 1; } sub updateBasicVendorOS { - my $self = shift; + my $self = shift; - if (slxsystem("yum -y update")) { - if ($! == 2) { - # file not found => yum isn't installed - die _tr("unable to update this vendor-os, as it seems to lack an installation of yum!\n"); - } - die _tr("unable to update this vendor-os (%s)\n", $!); - } + if (slxsystem("yum -y update")) { + if ($! == 2) { + # file not found => yum isn't installed + die _tr("unable to update this vendor-os, as it seems to lack an installation of yum!\n"); + } + die _tr("unable to update this vendor-os (%s)\n", $!); + } - return 1; + return 1; } 1;
\ No newline at end of file diff --git a/installer/OpenSLX/OSSetup/MetaPackager/zypper.pm b/installer/OpenSLX/OSSetup/MetaPackager/zypper.pm index 9a732af0..04d16bad 100644 --- a/installer/OpenSLX/OSSetup/MetaPackager/zypper.pm +++ b/installer/OpenSLX/OSSetup/MetaPackager/zypper.pm @@ -9,7 +9,7 @@ # General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- # zypper.pm -# - provides zypper-specific overrides of the OpenSLX::OSSetup::MetaPackager API. +# - provides zypper-specific overrides of the OpenSLX::OSSetup::MetaPackager API. # ----------------------------------------------------------------------------- package OpenSLX::OSSetup::MetaPackager::zypper; @@ -26,88 +26,88 @@ use OpenSLX::Utils; ################################################################################ sub new { - my $class = shift; - my $self = { - 'name' => 'zypper', - }; - return bless $self, $class; + my $class = shift; + my $self = { + 'name' => 'zypper', + }; + return bless $self, $class; } sub initPackageSources { - my $self = shift; + my $self = shift; - $ENV{LC_ALL} = 'POSIX'; + $ENV{LC_ALL} = 'POSIX'; - # remove any existing channels - slxsystem("rm -f /etc/zypp/repos.d/*"); + # remove any existing channels + slxsystem("rm -f /etc/zypp/repos.d/*"); - return 1; + return 1; } sub setupPackageSource { - my $self = shift; - my $repoName = shift; - my $repoInfo = shift; - my $excludeList = shift; - my $repoURLs = shift; - - my $repoSubdir = ''; - if (length($repoInfo->{'repo-subdir'})) { - $repoSubdir = "/$repoInfo->{'repo-subdir'}"; - } - my $baseURL = shift @$repoURLs; - if (slxsystem("zypper addrepo -n $baseURL$repoSubdir $repoName")) { - die _tr("unable to add repo '%s' (%s)\n", $repoName, $!); - } - - return 1; + my $self = shift; + my $repoName = shift; + my $repoInfo = shift; + my $excludeList = shift; + my $repoURLs = shift; + + my $repoSubdir = ''; + if (length($repoInfo->{'repo-subdir'})) { + $repoSubdir = "/$repoInfo->{'repo-subdir'}"; + } + my $baseURL = shift @$repoURLs; + if (slxsystem("zypper addrepo -n $baseURL$repoSubdir $repoName")) { + die _tr("unable to add repo '%s' (%s)\n", $repoName, $!); + } + + return 1; } sub installPackages { - my $self = shift; - my $packages = shift; - my $doRefresh = shift || 0; + my $self = shift; + my $packages = shift; + my $doRefresh = shift || 0; - $packages =~ tr{\n}{ }; + $packages =~ tr{\n}{ }; - if ($doRefresh && slxsystem("zypper --non-interactive refresh")) { - die _tr("unable to update repo info (%s)\n", $!); - } - if (slxsystem("zypper --non-interactive install $packages")) { - die _tr("unable to install selection (%s)\n", $!); - } + if ($doRefresh && slxsystem("zypper --non-interactive refresh")) { + die _tr("unable to update repo info (%s)\n", $!); + } + if (slxsystem("zypper --non-interactive install $packages")) { + die _tr("unable to install selection (%s)\n", $!); + } - return 1; + return 1; } sub removePackages { - my $self = shift; - my $pkgSelection = shift; + my $self = shift; + my $pkgSelection = shift; - if (slxsystem("zypper --non-interactive remove $pkgSelection")) { - die _tr("unable to remove selection (%s)\n", $!); - } + if (slxsystem("zypper --non-interactive remove $pkgSelection")) { + die _tr("unable to remove selection (%s)\n", $!); + } - return 1; + return 1; } sub updateBasicVendorOS { - my $self = shift; + my $self = shift; - if (slxsystem("zypper --non-interactive update")) { - if ($! == 2) { - # file not found => zypper isn't installed - die _tr("unable to update this vendor-os, as it seems to lack an installation of zypper!\n"); - } - die _tr("unable to update this vendor-os (%s)\n", $!); - } + if (slxsystem("zypper --non-interactive update")) { + if ($! == 2) { + # file not found => zypper isn't installed + die _tr("unable to update this vendor-os, as it seems to lack an installation of zypper!\n"); + } + die _tr("unable to update this vendor-os (%s)\n", $!); + } - return 1; + return 1; } 1;
\ No newline at end of file |