| 1 |
#!/usr/bin/perl -w
|
| 2 |
|
| 3 |
#*********************************************************************
|
| 4 |
# This program is free software; you can redistribute it and/or modify
|
| 5 |
# it under the terms of the GNU General Public License as published by
|
| 6 |
# the Free Software Foundation; either version 2 of the License, or
|
| 7 |
# (at your option) any later version.
|
| 8 |
#
|
| 9 |
# This program is distributed in the hope that it will be useful, but
|
| 10 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 12 |
# General Public License for more details.
|
| 13 |
#
|
| 14 |
# A copy of the GNU General Public License is available as
|
| 15 |
# `/usr/share/common-licences/GPL' in the Debian GNU/Linux distribution
|
| 16 |
# or on the World Wide Web at http://www.gnu.org/copyleft/gpl.html. You
|
| 17 |
# can also obtain it by writing to the Free Software Foundation, Inc.,
|
| 18 |
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
| 19 |
#*********************************************************************
|
| 20 |
|
| 21 |
use strict;
|
| 22 |
|
| 23 |
################################################################################
|
| 24 |
#
|
| 25 |
# @file shdd2
|
| 26 |
#
|
| 27 |
# @brief The main function of setup harddisks 2 - the tool to configure the
|
| 28 |
# partitioning from within FAI.
|
| 29 |
#
|
| 30 |
# This is an implementation from scratch to properly support LVM and RAID. The
|
| 31 |
# input format is documented in @ref shdd2-parser
|
| 32 |
#
|
| 33 |
# $Id$
|
| 34 |
#
|
| 35 |
# @author Christian Kern, Michael Tautschnig
|
| 36 |
# @date Sun Jul 23 16:09:36 CEST 2006
|
| 37 |
#
|
| 38 |
################################################################################
|
| 39 |
|
| 40 |
package FAI;
|
| 41 |
|
| 42 |
# include all subparts
|
| 43 |
require "shdd2-init";
|
| 44 |
require "shdd2-lib";
|
| 45 |
require "shdd2-parser";
|
| 46 |
require "shdd2-sizes";
|
| 47 |
require "shdd2-commands";
|
| 48 |
require "shdd2-fstab";
|
| 49 |
require "shdd2-exec";
|
| 50 |
|
| 51 |
# start the parsing - thereby $FAI::configs is filled
|
| 52 |
&FAI::run_parser;
|
| 53 |
|
| 54 |
# read the sizes and partition tables of all disks listed in $FAI::disks
|
| 55 |
&FAI::get_current_disks;
|
| 56 |
|
| 57 |
# compute the new partition sizes
|
| 58 |
&FAI::compute_sizes;
|
| 59 |
|
| 60 |
# TODO - debugging only: print the current contents of $FAI::configs
|
| 61 |
&FAI::print_hash( \%FAI::configs );
|
| 62 |
|
| 63 |
# generate the command script
|
| 64 |
&FAI::build_commands;
|
| 65 |
|
| 66 |
# TODO - debugging only: print the command script
|
| 67 |
foreach my $cmd (@FAI::commands)
|
| 68 |
{
|
| 69 |
print $cmd . "\n";
|
| 70 |
|
| 71 |
# &FAI::execute_command($cmd);
|
| 72 |
}
|
| 73 |
|
| 74 |
# generate the proposed fstab contents
|
| 75 |
my @fstab = &FAI::generate_fstab( \%FAI::configs );
|
| 76 |
|
| 77 |
# TODO - debugging only; print fstab
|
| 78 |
foreach my $line (@fstab)
|
| 79 |
{
|
| 80 |
printf "$line\n";
|
| 81 |
}
|
| 82 |
|