From 1455d67711a5353adabdba8183d3bc603ea7f216 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Mon, 12 Feb 2007 21:44:09 +0000 Subject: * added perl-ified slxos-setup script and the relevant perl-modules, still not done, but nearly there git-svn-id: http://svn.openslx.org/svn/openslx/trunk@698 95ad53e4-c205-0410-b2fa-d234c58c8868 --- installer/slxos-setup | 143 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100755 installer/slxos-setup (limited to 'installer/slxos-setup') diff --git a/installer/slxos-setup b/installer/slxos-setup new file mode 100755 index 00000000..30aa82dd --- /dev/null +++ b/installer/slxos-setup @@ -0,0 +1,143 @@ +#! /usr/bin/perl +# +# slxos-setup - +# +# (c) 2006 - OpenSLX.com +# +# Oliver Tappe +# +use strict; + +my $abstract = q[ +slxos-setup + This script installs an operating system into a folder that can be used as + a stage1 system for OpenSLX. +]; + +use Getopt::Long qw(:config pass_through); +use Pod::Usage; + +# add the folder this script lives in and the lib-folder to perl's +# search path for modules: +use FindBin; +use lib "$FindBin::RealBin"; +use lib "$FindBin::RealBin/../lib"; + +use OpenSLX::Basics; +use OpenSLX::OSSetup::Engine; + +if ($> != 0) { + die _tr("Sorry, this script can only be executed by the superuser!\n"); +} + +my ( + $helpReq, + $manReq, + $listReq, + $setupRepos, + $verbose, + $versionReq, +); + +GetOptions( + 'help|?' => \$helpReq, + 'list' => \$listReq, + 'man' => \$manReq, + 'setup-repos' => \$setupRepos, + 'verbose' => \$verbose, + 'version' => \$versionReq, +) or pod2usage(2); +pod2usage(-msg => $abstract, -verbose => 0, -exitval => 1) if $helpReq; +pod2usage(-verbose => 2) if $manReq; +if ($versionReq) { + system('slxversion'); + exit 1; +} + +my @supportedDistros = ( + 'debian-3.1', + 'debian-4.0', + 'fedora-6', + 'fedora-6-x86_64', + 'mandriva-2007.0', + 'suse-9.3', + 'suse-10.0', + 'suse-10.0-x86_64', + 'suse-10.1', + 'suse-10.1-x86_64', + 'suse-10.2', + 'suse-10.2-x86_64', + 'ubuntu-6.10', +); + +openslxInit(); + +if ($listReq) { + print _tr("List of supported distros:\n\t"); + print join("\n\t", @supportedDistros)."\n"; + exit 1; +} + +if (scalar(@ARGV) != 1) { + print STDERR _tr("You need to specify exactly one distro name!\n"); + pod2usage(2); +} + +my $distroName = $ARGV[0]; +if (!grep { /^$distroName$/ } @supportedDistros) { + print _tr("Sorry, distro '%s' is unsupported.\n", $distroName); + print _tr("List of supported distros:\n\t"); + print join("\n\t", @supportedDistros)."\n"; + exit 1; +} + +# we chdir into the script's folder such that all relative paths have +# a known starting point: +chdir($FindBin::RealBin) + or die _tr("can't chdir to script-path <%> (%s)", $FindBin::RealBin, $!); + +# create ossetup-engine and start it: +my $engine = OpenSLX::OSSetup::Engine->new; +if ($setupRepos) { + $engine->initialize($distroName, 0); + $engine->setupRepositories(); +} else { + $engine->initialize($distroName, 1); + $engine->setupStage1(); +} + +__END__ + +=head1 NAME + +slxos-setup - OpenSLX-script to install an operating system into a folder which +will be used as a stage1 system for OpenSLX. + +=head1 SYNOPSIS + +slxos-setup [options] + + Options: + --help brief help message + --man show full documentation + --version show version + +=head1 OPTIONS + +=over 8 + +=item B<--help> + +Prints a brief help message and exits. + +=item B<--man> + +Prints the manual page and exits. + +=item B<--version> + +Prints the version and exits. + +=back + +=cut \ No newline at end of file -- cgit v1.2.3-55-g7522