pf-tools commit: r880 [parmelan-guest] - in /branches/next-gen/sbin: fix_hosts mk_dhcp mk_grubopt mk_interfaces mk_pxelinuxcfg mk_resolvconf mk_sitezone mk_sourceslist update-config

parmelan-guest at users.alioth.debian.org parmelan-guest at users.alioth.debian.org
Tue Sep 7 08:54:54 UTC 2010


Author: parmelan-guest
Date: Tue Sep  7 08:54:53 2010
New Revision: 880

URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=880
Log:
perltidy sbin

Modified:
    branches/next-gen/sbin/fix_hosts   (contents, props changed)
    branches/next-gen/sbin/mk_dhcp   (contents, props changed)
    branches/next-gen/sbin/mk_grubopt   (contents, props changed)
    branches/next-gen/sbin/mk_interfaces   (contents, props changed)
    branches/next-gen/sbin/mk_pxelinuxcfg   (contents, props changed)
    branches/next-gen/sbin/mk_resolvconf   (contents, props changed)
    branches/next-gen/sbin/mk_sitezone
    branches/next-gen/sbin/mk_sourceslist   (contents, props changed)
    branches/next-gen/sbin/update-config   (contents, props changed)

Modified: branches/next-gen/sbin/fix_hosts
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/sbin/fix_hosts?rev=880&op=diff
==============================================================================
--- branches/next-gen/sbin/fix_hosts (original)
+++ branches/next-gen/sbin/fix_hosts Tue Sep  7 08:54:53 2010
@@ -33,19 +33,19 @@
 
 #################################
 # VARS
-my $HELP				= 0;
-my $HOSTNAME			= hostname;
-my $SITE				= '';
-my $GLOBAL_STORE_FILE	= '';
-my $PF_CONFIG_FILE		= '';
-my $PF_CONFIG			= {};
-my $IP_TYPE				= 'ipv4';
-my $INPUT_FILE			= '/etc/hosts';
-my $OUTPUT_FILE			= '/etc/hosts';
-my $GLOBAL_STRUCT		= {};
+my $HELP              = 0;
+my $HOSTNAME          = hostname;
+my $SITE              = '';
+my $GLOBAL_STORE_FILE = '';
+my $PF_CONFIG_FILE    = '';
+my $PF_CONFIG         = {};
+my $IP_TYPE           = 'ipv4';
+my $INPUT_FILE        = '/etc/hosts';
+my $OUTPUT_FILE       = '/etc/hosts';
+my $GLOBAL_STRUCT     = {};
 
 my $program = $0;
-$program =~ s%.*/%%; # cheap basename
+$program =~ s%.*/%%;    # cheap basename
 
 my $version = sprintf( "svn-r%s", q$Revision$ =~ /([\d.]+)/ );
 
@@ -72,62 +72,68 @@
 ##################################
 ### MAIN
 
-GetOptions (
-	'help'			=> \$HELP,
-	'host|h=s'		=> \$HOSTNAME,
-	'site|s=s'		=> \$SITE,
-	'config|c=s'	=> \$PF_CONFIG_FILE,
-	'store=s'		=> \$GLOBAL_STORE_FILE,
-	'type|t=s'		=> \$IP_TYPE,
-	'input|i=s'		=> \$INPUT_FILE,
-	'output|o=s'	=> \$OUTPUT_FILE
+GetOptions(
+    'help'       => \$HELP,
+    'host|h=s'   => \$HOSTNAME,
+    'site|s=s'   => \$SITE,
+    'config|c=s' => \$PF_CONFIG_FILE,
+    'store=s'    => \$GLOBAL_STORE_FILE,
+    'type|t=s'   => \$IP_TYPE,
+    'input|i=s'  => \$INPUT_FILE,
+    'output|o=s' => \$OUTPUT_FILE
 ) or die "Didn't grok options (see --help).\n";
 
-if ( $HELP ) {
-	Do_help ();
-	exit 0;
+if ($HELP) {
+    Do_help();
+    exit 0;
 }
 
-( $PF_CONFIG, $GLOBAL_STRUCT ) = Init_TOOLS ( $HOSTNAME, $PF_CONFIG_FILE, $GLOBAL_STORE_FILE );
+( $PF_CONFIG, $GLOBAL_STRUCT )
+    = Init_TOOLS( $HOSTNAME, $PF_CONFIG_FILE, $GLOBAL_STORE_FILE );
 
-if ( ! $PF_CONFIG->{'features'}->{$IP_TYPE} ) {
-	print Dumper $PF_CONFIG;
-	Abort ( $CODE->{'UNDEF_KEY'},
-		"Aborting because ".$IP_TYPE." is not activated inot PF-Tools" );
+if ( !$PF_CONFIG->{'features'}->{$IP_TYPE} ) {
+    print Dumper $PF_CONFIG;
+    Abort( $CODE->{'UNDEF_KEY'},
+        "Aborting because " . $IP_TYPE . " is not activated inot PF-Tools" );
 }
 
 if ( $SITE eq '' ) {
-	if ( ! defined $PF_CONFIG->{'location'}->{'site'} ) {
-		my $site_list = Get_site_from_hostname ( $HOSTNAME, $GLOBAL_STRUCT );
-		if ( ! defined $site_list ) {
-			Abort ( $CODE->{'UNDEF_KEY'},
-				"Unable to retrieve site for hostname ".$HOSTNAME." : hostname not defined" );
-		}
-		elsif ( scalar @{$site_list} > 1 ) {
-			Abort ( $CODE->{'DUPLICATE_VALUE'},
-				"Unable to retrieve site for hostname ".$HOSTNAME." : hostname appeared in multiple sites : "
-				.join ( ",", @{$site_list} ).".\n"
-				."Please relaunch this command with the right site" );
-		}
-		else {
-			( $SITE ) = @{$site_list};
-		}
-	}
-	else {
-		$SITE = $PF_CONFIG->{'location'}->{'site'}
-	}
+    if ( !defined $PF_CONFIG->{'location'}->{'site'} ) {
+        my $site_list = Get_site_from_hostname( $HOSTNAME, $GLOBAL_STRUCT );
+        if ( !defined $site_list ) {
+            Abort( $CODE->{'UNDEF_KEY'},
+                      "Unable to retrieve site for hostname "
+                    . $HOSTNAME
+                    . " : hostname not defined" );
+        }
+        elsif ( scalar @{$site_list} > 1 ) {
+            Abort( $CODE->{'DUPLICATE_VALUE'},
+                      "Unable to retrieve site for hostname "
+                    . $HOSTNAME
+                    . " : hostname appeared in multiple sites : "
+                    . join( ",", @{$site_list} ) . ".\n"
+                    . "Please relaunch this command with the right site" );
+        }
+        else {
+            ($SITE) = @{$site_list};
+        }
+    }
+    else {
+        $SITE = $PF_CONFIG->{'location'}->{'site'};
+    }
 }
 
-my $fixed_input = Fix_hosts ( $HOSTNAME, $INPUT_FILE, $SITE, $IP_TYPE, $GLOBAL_STRUCT, $PF_CONFIG );
-if ( ! defined $fixed_input ) {
-	Abort ( $CODE->{'EXEC'},
-		"An error occured during fixing file ".$OUTPUT_FILE );
+my $fixed_input
+    = Fix_hosts( $HOSTNAME, $INPUT_FILE, $SITE, $IP_TYPE, $GLOBAL_STRUCT,
+    $PF_CONFIG );
+if ( !defined $fixed_input ) {
+    Abort( $CODE->{'EXEC'},
+        "An error occured during fixing file " . $OUTPUT_FILE );
 }
-unless ( open ( FIXED, ">".$OUTPUT_FILE ) ) {
-	Abort ( $CODE->{'OPEN'},
-		"Unable to open output file ".$OUTPUT_FILE );
+unless ( open( FIXED, ">" . $OUTPUT_FILE ) ) {
+    Abort( $CODE->{'OPEN'}, "Unable to open output file " . $OUTPUT_FILE );
 }
-print FIXED join ( "", @{$fixed_input} );
-close ( FIXED );
+print FIXED join( "", @{$fixed_input} );
+close(FIXED);
 
 exit 0;

Modified: branches/next-gen/sbin/mk_dhcp
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/sbin/mk_dhcp?rev=880&op=diff
==============================================================================
--- branches/next-gen/sbin/mk_dhcp (original)
+++ branches/next-gen/sbin/mk_dhcp Tue Sep  7 08:54:53 2010
@@ -30,17 +30,17 @@
 
 #####################################
 # Vars
-my $HELP				= 0;
-my $HEADER				= '';
-my $SITE				= '';
-my $GLOBAL_STORE_FILE	= '';
-my $PF_CONFIG_FILE		= '';
-my $PF_CONFIG			= {};
-my $OUTPUT_FILE			= '';
-my $GLOBAL_STRUCT		= {};
+my $HELP              = 0;
+my $HEADER            = '';
+my $SITE              = '';
+my $GLOBAL_STORE_FILE = '';
+my $PF_CONFIG_FILE    = '';
+my $PF_CONFIG         = {};
+my $OUTPUT_FILE       = '';
+my $GLOBAL_STRUCT     = {};
 
 my $program = $0;
-$program =~ s%.*/%%; # cheap basename
+$program =~ s%.*/%%;    # cheap basename
 
 my $version = sprintf( "svn-r%s", q$Revision$ =~ /([\d.]+)/ );
 
@@ -65,43 +65,43 @@
 ############################################
 ### MAIN
 
-GetOptions (
-	'help'			=> \$HELP,
-	'H|header=s'	=> \$HEADER,
-	'site|s=s'		=> \$SITE,
-	'config|c=s'	=> \$PF_CONFIG_FILE,
-	'store=s'		=> \$GLOBAL_STORE_FILE,
-	'output|o=s'	=> \$OUTPUT_FILE
+GetOptions(
+    'help'       => \$HELP,
+    'H|header=s' => \$HEADER,
+    'site|s=s'   => \$SITE,
+    'config|c=s' => \$PF_CONFIG_FILE,
+    'store=s'    => \$GLOBAL_STORE_FILE,
+    'output|o=s' => \$OUTPUT_FILE
 ) or die "Didn't grok options (see --help).\n";
 
-if ( $HELP ) {
-	Do_help ();
-	exit 0;
+if ($HELP) {
+    Do_help();
+    exit 0;
 }
 
-( $PF_CONFIG, $GLOBAL_STRUCT ) = Init_TOOLS ( "", $PF_CONFIG_FILE, $GLOBAL_STORE_FILE );
+( $PF_CONFIG, $GLOBAL_STRUCT )
+    = Init_TOOLS( "", $PF_CONFIG_FILE, $GLOBAL_STORE_FILE );
 
 if ( $SITE eq '' ) {
-	if ( ! defined $PF_CONFIG->{'location'}->{'site'} ) {
-		Abort ( $CODE->{'UNDEF_KEY'},
-			"A site MUST BE defined for building DNS zone forward" );
-	}
-	else {
-		$SITE = $PF_CONFIG->{'location'}->{'site'};
-	}
+    if ( !defined $PF_CONFIG->{'location'}->{'site'} ) {
+        Abort( $CODE->{'UNDEF_KEY'},
+            "A site MUST BE defined for building DNS zone forward" );
+    }
+    else {
+        $SITE = $PF_CONFIG->{'location'}->{'site'};
+    }
 }
 
-if ( ! defined $GLOBAL_STRUCT->{'DHCP'}->{'BY_SITE'}->{$SITE} ) {
-	Abort ( $CODE->{'UNDEF_KEY'},
-		"Site ".$SITE." is not defined into global configuration" );
+if ( !defined $GLOBAL_STRUCT->{'DHCP'}->{'BY_SITE'}->{$SITE} ) {
+    Abort( $CODE->{'UNDEF_KEY'},
+        "Site " . $SITE . " is not defined into global configuration" );
 }
 
-my $DHCP = Mk_dhcp ( $HEADER, $GLOBAL_STRUCT->{'DHCP'}->{'BY_SITE'}->{$SITE} );
-unless ( open ( DHCP, ">".$OUTPUT_FILE ) ) {
-	Abort ( $CODE->{'OPEN'},
-		"Unable to open zone file ".$OUTPUT_FILE );
+my $DHCP = Mk_dhcp( $HEADER, $GLOBAL_STRUCT->{'DHCP'}->{'BY_SITE'}->{$SITE} );
+unless ( open( DHCP, ">" . $OUTPUT_FILE ) ) {
+    Abort( $CODE->{'OPEN'}, "Unable to open zone file " . $OUTPUT_FILE );
 }
-print DHCP join ( "\n", @{$DHCP} );
-close ( DHCP );
+print DHCP join( "\n", @{$DHCP} );
+close(DHCP);
 
 exit 0;

Modified: branches/next-gen/sbin/mk_grubopt
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/sbin/mk_grubopt?rev=880&op=diff
==============================================================================
--- branches/next-gen/sbin/mk_grubopt (original)
+++ branches/next-gen/sbin/mk_grubopt Tue Sep  7 08:54:53 2010
@@ -24,7 +24,7 @@
 use strict;
 use warnings;
 
-use Sys::Hostname ;
+use Sys::Hostname;
 use PFTools::Logger;
 use PFTools::Utils;
 use PFTools::Structqueries;
@@ -33,19 +33,19 @@
 ####################################################
 # Vars
 
-my $GRUB_VERSION		= 2;
-my $MENU_GRUB			= "";
-my $HOSTNAME			= "";
-my $SITE				= "";
-my $OUTPUT				= "";
-my $HELP				= 0 ;
-my $GLOBAL_STORE_FILE	= '';
-my $PF_CONFIG_FILE		= '';
-my $PF_CONFIG			= {};
-my $GLOBAL_STRUCT		= {};
+my $GRUB_VERSION      = 2;
+my $MENU_GRUB         = "";
+my $HOSTNAME          = "";
+my $SITE              = "";
+my $OUTPUT            = "";
+my $HELP              = 0;
+my $GLOBAL_STORE_FILE = '';
+my $PF_CONFIG_FILE    = '';
+my $PF_CONFIG         = {};
+my $GLOBAL_STRUCT     = {};
 
 my $program = $0;
-$program =~ s%.*/%%; # cheap basename
+$program =~ s%.*/%%;    # cheap basename
 
 my $version = sprintf( "svn-r%s", q$Revision$ =~ /([\d.]+)/ );
 
@@ -53,7 +53,7 @@
 # Functions
 
 sub Do_help () {
-print STDERR << "# ENDHELP";
+    print STDERR << "# ENDHELP";
     $program - version $version
 
 Usage:	$0 [options]
@@ -71,64 +71,75 @@
 #######################################################""
 ### MAIN
 
-GetOptions (
-	'help'			=> \$HELP,
-	'h|host=s'		=> \$HOSTNAME,
-	'site|s=s'		=> \$SITE,
-	'src=s'			=> \$MENU_GRUB,
-	'grub=s'		=> \$GRUB_VERSION,
-	'o|output=s'	=> \$OUTPUT,
-	'config|c=s'	=> \$PF_CONFIG_FILE,
-	'store=s'		=> \$GLOBAL_STORE_FILE,
+GetOptions(
+    'help'       => \$HELP,
+    'h|host=s'   => \$HOSTNAME,
+    'site|s=s'   => \$SITE,
+    'src=s'      => \$MENU_GRUB,
+    'grub=s'     => \$GRUB_VERSION,
+    'o|output=s' => \$OUTPUT,
+    'config|c=s' => \$PF_CONFIG_FILE,
+    'store=s'    => \$GLOBAL_STORE_FILE,
 ) or die "Didn't grok options (see --help).\n";
 
-if ( $HELP ) {
-	Do_help ();
-	exit 0;
+if ($HELP) {
+    Do_help();
+    exit 0;
 }
 
-( $PF_CONFIG, $GLOBAL_STRUCT ) = Init_TOOLS ( $HOSTNAME, $PF_CONFIG_FILE, $GLOBAL_STORE_FILE );
+( $PF_CONFIG, $GLOBAL_STRUCT )
+    = Init_TOOLS( $HOSTNAME, $PF_CONFIG_FILE, $GLOBAL_STORE_FILE );
 
 if ( $OUTPUT eq "" ) {
-	Abort ( $CODE->{'UNDEF_KEY'},
-		"You MUST define a valid output for this command use '-' if you want to use STDOUT" );
+    Abort( $CODE->{'UNDEF_KEY'},
+        "You MUST define a valid output for this command use '-' if you want to use STDOUT"
+    );
 }
 
 if ( $HOSTNAME eq "" ) {
-	Abort ( $CODE->{'UNDEF_KEY'},
-		"Unable to modify grub options for an undefined hostname" );
+    Abort( $CODE->{'UNDEF_KEY'},
+        "Unable to modify grub options for an undefined hostname" );
 }
 
 if ( $SITE eq '' ) {
-	if ( ! defined $PF_CONFIG->{'location'}->{'site'} ) {
-		my $site_list = Get_site_from_hostname ( $HOSTNAME, $GLOBAL_STRUCT );
-		if ( ! defined $site_list ) {
-			Abort ( $CODE->{'UNDEF_KEY'},
-				"Unable to retrieve site for hostname ".$HOSTNAME." : hostname not defined" );
-		}
-		elsif ( scalar @{$site_list} > 1 ) {
-			Abort ( $CODE->{'DUPLICATE_VALUE'},
-				"Unable to retrieve site for hostname ".$HOSTNAME." : hostname appeared in multiple sites : "
-				.join ( ",", @{$site_list} ).".\n"
-				."Please relaunch this command with the right site" );
-		}
-		else {
-			( $SITE ) = @{$site_list};
-		}
-	}
-	else {
-		$SITE = $PF_CONFIG->{'location'}->{'site'}
-	}
+    if ( !defined $PF_CONFIG->{'location'}->{'site'} ) {
+        my $site_list = Get_site_from_hostname( $HOSTNAME, $GLOBAL_STRUCT );
+        if ( !defined $site_list ) {
+            Abort( $CODE->{'UNDEF_KEY'},
+                      "Unable to retrieve site for hostname "
+                    . $HOSTNAME
+                    . " : hostname not defined" );
+        }
+        elsif ( scalar @{$site_list} > 1 ) {
+            Abort( $CODE->{'DUPLICATE_VALUE'},
+                      "Unable to retrieve site for hostname "
+                    . $HOSTNAME
+                    . " : hostname appeared in multiple sites : "
+                    . join( ",", @{$site_list} ) . ".\n"
+                    . "Please relaunch this command with the right site" );
+        }
+        else {
+            ($SITE) = @{$site_list};
+        }
+    }
+    else {
+        $SITE = $PF_CONFIG->{'location'}->{'site'};
+    }
 }
 
-if ( ! defined $GLOBAL_STRUCT->{'DHCP'}->{'BY_SITE'}->{$SITE} ) {
-	Abort ( $CODE->{'UNDEF_KEY'},
-		"Site ".$SITE." is not defined into global configuration" );
+if ( !defined $GLOBAL_STRUCT->{'DHCP'}->{'BY_SITE'}->{$SITE} ) {
+    Abort( $CODE->{'UNDEF_KEY'},
+        "Site " . $SITE . " is not defined into global configuration" );
 }
 
-if ( ! Change_kopt_for_hostname ( $HOSTNAME, $SITE, $MENU_GRUB, $OUTPUT, $GRUB_VERSION, $GLOBAL_STRUCT, $PF_CONFIG ) ) {
-	Abort ( $CODE->{'EXEC'},
-		"Unable to change kernel options(s) into file ".$MENU_GRUB );
+if (!Change_kopt_for_hostname(
+        $HOSTNAME,     $SITE,          $MENU_GRUB, $OUTPUT,
+        $GRUB_VERSION, $GLOBAL_STRUCT, $PF_CONFIG
+    )
+    )
+{
+    Abort( $CODE->{'EXEC'},
+        "Unable to change kernel options(s) into file " . $MENU_GRUB );
 }
 
 exit 0;

Modified: branches/next-gen/sbin/mk_interfaces
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/sbin/mk_interfaces?rev=880&op=diff
==============================================================================
--- branches/next-gen/sbin/mk_interfaces (original)
+++ branches/next-gen/sbin/mk_interfaces Tue Sep  7 08:54:53 2010
@@ -31,17 +31,17 @@
 
 #################################
 # VARS
-my $HELP				= 0;
-my $HOSTNAME			= hostname;
-my $SITE				= '';
-my $GLOBAL_STORE_FILE	= '';
-my $PF_CONFIG_FILE		= '';
-my $PF_CONFIG			= {};
-my $OUTPUT_FILE			= '/etc/network/interfaces';
-my $GLOBAL_STRUCT		= {};
+my $HELP              = 0;
+my $HOSTNAME          = hostname;
+my $SITE              = '';
+my $GLOBAL_STORE_FILE = '';
+my $PF_CONFIG_FILE    = '';
+my $PF_CONFIG         = {};
+my $OUTPUT_FILE       = '/etc/network/interfaces';
+my $GLOBAL_STRUCT     = {};
 
 my $program = $0;
-$program =~ s%.*/%%; # cheap basename
+$program =~ s%.*/%%;    # cheap basename
 
 my $version = sprintf( "svn-r%s", q$Revision$ =~ /([\d.]+)/ );
 
@@ -66,59 +66,64 @@
 ##################################
 ### MAIN
 
-GetOptions (
-	'help'			=> \$HELP,
-	'host|h=s'		=> \$HOSTNAME,
-	'site|s=s'		=> \$SITE,
-	'config|c=s'	=> \$PF_CONFIG_FILE,
-	'store=s'		=> \$GLOBAL_STORE_FILE,
-	'output|o=s'	=> \$OUTPUT_FILE
+GetOptions(
+    'help'       => \$HELP,
+    'host|h=s'   => \$HOSTNAME,
+    'site|s=s'   => \$SITE,
+    'config|c=s' => \$PF_CONFIG_FILE,
+    'store=s'    => \$GLOBAL_STORE_FILE,
+    'output|o=s' => \$OUTPUT_FILE
 ) or die "Didn't grok options (see --help).\n";
 
-if ( $HELP ) {
-	Do_help ();
-	exit 0;
+if ($HELP) {
+    Do_help();
+    exit 0;
 }
 
-( $PF_CONFIG, $GLOBAL_STRUCT ) = Init_TOOLS ( $HOSTNAME, $PF_CONFIG_FILE, $GLOBAL_STORE_FILE );
+( $PF_CONFIG, $GLOBAL_STRUCT )
+    = Init_TOOLS( $HOSTNAME, $PF_CONFIG_FILE, $GLOBAL_STORE_FILE );
 
 if ( $SITE eq '' ) {
-	if ( ! defined $PF_CONFIG->{'location'}->{'site'} ) {
-		my $site_list = Get_site_from_hostname ( $HOSTNAME, $GLOBAL_STRUCT );
-		if ( ! defined $site_list ) {
-			Abort ( $CODE->{'UNDEF_KEY'},
-				"Unable to retrieve site for hostname ".$HOSTNAME." : hostname not defined" );
-		}
-		elsif ( scalar @{$site_list} > 1 ) {
-			Abort ( $CODE->{'DUPLICATE_VALUE'},
-				"Unable to retrieve site for hostname ".$HOSTNAME." : hostname appeared in multiple sites : "
-				.join ( ",", @{$site_list} ).".\n"
-				."Please relaunch this command with the right site" );
-		}
-		else {
-			( $SITE ) = @{$site_list};
-		}
-	}
-	else {
-		$SITE = $PF_CONFIG->{'location'}->{'site'}
-	}
+    if ( !defined $PF_CONFIG->{'location'}->{'site'} ) {
+        my $site_list = Get_site_from_hostname( $HOSTNAME, $GLOBAL_STRUCT );
+        if ( !defined $site_list ) {
+            Abort( $CODE->{'UNDEF_KEY'},
+                      "Unable to retrieve site for hostname "
+                    . $HOSTNAME
+                    . " : hostname not defined" );
+        }
+        elsif ( scalar @{$site_list} > 1 ) {
+            Abort( $CODE->{'DUPLICATE_VALUE'},
+                      "Unable to retrieve site for hostname "
+                    . $HOSTNAME
+                    . " : hostname appeared in multiple sites : "
+                    . join( ",", @{$site_list} ) . ".\n"
+                    . "Please relaunch this command with the right site" );
+        }
+        else {
+            ($SITE) = @{$site_list};
+        }
+    }
+    else {
+        $SITE = $PF_CONFIG->{'location'}->{'site'};
+    }
 }
 
-my $iface = Mk_interfaces ( $HOSTNAME, $GLOBAL_STRUCT, $PF_CONFIG, $SITE );
-if ( ! defined $iface ) {
-	Abort ( $CODE->{'EXEC'},
-		"An error occured during building interfaces file ".$OUTPUT_FILE );
+my $iface = Mk_interfaces( $HOSTNAME, $GLOBAL_STRUCT, $PF_CONFIG, $SITE );
+if ( !defined $iface ) {
+    Abort( $CODE->{'EXEC'},
+        "An error occured during building interfaces file " . $OUTPUT_FILE );
 }
-unless ( open ( IFACE, ">".$OUTPUT_FILE ) ) {
-	die "Unable to open interface file ".$OUTPUT_FILE."\n";
+unless ( open( IFACE, ">" . $OUTPUT_FILE ) ) {
+    die "Unable to open interface file " . $OUTPUT_FILE . "\n";
 }
 print IFACE "#################################################\n";
 print IFACE "# File was auto-generated with mk_interfaces tool\n";
 print IFACE "#\n\n";
-foreach my $if ( @{$iface->{'__order'}} ) {
-	print IFACE join ( "\n", @{$iface->{$if}} );
-	print IFACE "\n\n";
+foreach my $if ( @{ $iface->{'__order'} } ) {
+    print IFACE join( "\n", @{ $iface->{$if} } );
+    print IFACE "\n\n";
 }
-close ( IFACE );
+close(IFACE);
 
 exit 0;

Modified: branches/next-gen/sbin/mk_pxelinuxcfg
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/sbin/mk_pxelinuxcfg?rev=880&op=diff
==============================================================================
--- branches/next-gen/sbin/mk_pxelinuxcfg (original)
+++ branches/next-gen/sbin/mk_pxelinuxcfg Tue Sep  7 08:54:53 2010
@@ -29,24 +29,23 @@
 use PFTools::Logger;
 use Data::Dumper;
 
-
 ############################################
 # Vars
 
-my $DEPLOY_DOCROOT		= "/var/www";
-my $HELP				= 0;
-my $PF_SCRIPT			= 'pf-tools-config.sh';
-my $PXE_TPL				= '';
-my $PRESEED_TPL			= '';
-my $SITE				= '';
-my $GLOBAL_STORE_FILE	= '';
-my $PF_CONFIG_FILE		= '';
-my $PF_CONFIG			= {};
-my $GLOBAL_STRUCT		= {};
-my $DEFAULT_PRESEED		= '';
+my $DEPLOY_DOCROOT    = "/var/www";
+my $HELP              = 0;
+my $PF_SCRIPT         = 'pf-tools-config.sh';
+my $PXE_TPL           = '';
+my $PRESEED_TPL       = '';
+my $SITE              = '';
+my $GLOBAL_STORE_FILE = '';
+my $PF_CONFIG_FILE    = '';
+my $PF_CONFIG         = {};
+my $GLOBAL_STRUCT     = {};
+my $DEFAULT_PRESEED   = '';
 
 my $program = $0;
-$program =~ s%.*/%%; # cheap basename
+$program =~ s%.*/%%;    # cheap basename
 
 my $version = sprintf( "svn-r%s", q$Revision$ =~ /([\d.]+)/ );
 
@@ -70,54 +69,62 @@
 ############################################
 ### MAIN
 
-GetOptions (
-	'help'			=> \$HELP,
-	'script=s'		=> \$PF_SCRIPT,
-	'site|s=s'		=> \$SITE,
-	'config|c=s'	=> \$PF_CONFIG_FILE,
-	'store=s'		=> \$GLOBAL_STORE_FILE,
+GetOptions(
+    'help'       => \$HELP,
+    'script=s'   => \$PF_SCRIPT,
+    'site|s=s'   => \$SITE,
+    'config|c=s' => \$PF_CONFIG_FILE,
+    'store=s'    => \$GLOBAL_STORE_FILE,
 ) or die "Didn't grok options (see --help).\n";
 
-if ( $HELP ) {
-	Do_help ();
-	exit 0;
+if ($HELP) {
+    Do_help();
+    exit 0;
 }
 
-( $PF_CONFIG, $GLOBAL_STRUCT ) = Init_TOOLS ( "", $PF_CONFIG_FILE, $GLOBAL_STORE_FILE );
+( $PF_CONFIG, $GLOBAL_STRUCT )
+    = Init_TOOLS( "", $PF_CONFIG_FILE, $GLOBAL_STORE_FILE );
 
-if ( ! -e $PF_CONFIG->{'path'}->{'preseed_dir'} ) {
-	mkdir $PF_CONFIG->{'path'}->{'preseed_dir'} ;
-	my ($login,$pass,$uid,$gid) = getpwnam ( 'www-data' ) ;
-	chown $uid, $gid, $PF_CONFIG->{'path'}->{'preseed_dir'} ;
-	my $mode = '2750' ;
-	chmod ( oct ( $mode ), $PF_CONFIG->{'path'}->{'preseed_dir'} ) ;
+if ( !-e $PF_CONFIG->{'path'}->{'preseed_dir'} ) {
+    mkdir $PF_CONFIG->{'path'}->{'preseed_dir'};
+    my ( $login, $pass, $uid, $gid ) = getpwnam('www-data');
+    chown $uid, $gid, $PF_CONFIG->{'path'}->{'preseed_dir'};
+    my $mode = '2750';
+    chmod( oct($mode), $PF_CONFIG->{'path'}->{'preseed_dir'} );
 }
-$DEFAULT_PRESEED	= $PF_CONFIG->{'path'}->{'preseed_dir'}."/default_preseed.txt" ;
+$DEFAULT_PRESEED
+    = $PF_CONFIG->{'path'}->{'preseed_dir'} . "/default_preseed.txt";
 if ( $SITE eq '' ) {
-	if ( ! defined $PF_CONFIG->{'location'}->{'site'} ) {
-		Abort ( $CODE->{'UNDEF_KEY'},
-			"A site MUST BE defined for building DNS zone forward" );
-	}
-	else {
-		$SITE = $PF_CONFIG->{'location'}->{'site'};
-	}
+    if ( !defined $PF_CONFIG->{'location'}->{'site'} ) {
+        Abort( $CODE->{'UNDEF_KEY'},
+            "A site MUST BE defined for building DNS zone forward" );
+    }
+    else {
+        $SITE = $PF_CONFIG->{'location'}->{'site'};
+    }
 }
 
-if ( ! defined $GLOBAL_STRUCT->{'DHCP'}->{'BY_SITE'}->{$SITE} ) {
-	Abort ( $CODE->{'UNDEF_KEY'},
-		"Site ".$SITE." is not defined into global configuration" );
+if ( !defined $GLOBAL_STRUCT->{'DHCP'}->{'BY_SITE'}->{$SITE} ) {
+    Abort( $CODE->{'UNDEF_KEY'},
+        "Site " . $SITE . " is not defined into global configuration" );
 }
 
-my $site_part	= $GLOBAL_STRUCT->{'SITE'}->{'BY_NAME'}->{$SITE};
-my $host_part	= $site_part->{'HOST'}->{'BY_NAME'};
-foreach my $hostclass ( @{$site_part->{'HOST'}->{'__hostclass_pxe'}} ) {
-	foreach my $host ( keys %{$host_part->{$hostclass}} ) {
-		next if ( ref $host_part->{$hostclass}->{$host} ne 'HASH' );
-		my $mode			= $host_part->{$hostclass}->{$host}->{'deployment'}->{'mode'};
-		my $pxe_template	= $PF_CONFIG->{'path'}->{'templates_dir'}.'/'.$PF_CONFIG->{$mode}->{'pxe'};
-		my $preseed_tpl		= $PF_CONFIG->{'path'}->{'templates_dir'}.'/'.$PF_CONFIG->{$mode}->{'preseed'};
-		my $pxe_file		= Mk_PXE_bootfile ( $host, $host_part->{$hostclass}->{$host}, $pxe_template, $preseed_tpl, $DEFAULT_PRESEED, $PF_SCRIPT, $PF_CONFIG );
-	}
+my $site_part = $GLOBAL_STRUCT->{'SITE'}->{'BY_NAME'}->{$SITE};
+my $host_part = $site_part->{'HOST'}->{'BY_NAME'};
+foreach my $hostclass ( @{ $site_part->{'HOST'}->{'__hostclass_pxe'} } ) {
+    foreach my $host ( keys %{ $host_part->{$hostclass} } ) {
+        next if ( ref $host_part->{$hostclass}->{$host} ne 'HASH' );
+        my $mode
+            = $host_part->{$hostclass}->{$host}->{'deployment'}->{'mode'};
+        my $pxe_template = $PF_CONFIG->{'path'}->{'templates_dir'} . '/'
+            . $PF_CONFIG->{$mode}->{'pxe'};
+        my $preseed_tpl = $PF_CONFIG->{'path'}->{'templates_dir'} . '/'
+            . $PF_CONFIG->{$mode}->{'preseed'};
+        my $pxe_file
+            = Mk_PXE_bootfile( $host, $host_part->{$hostclass}->{$host},
+            $pxe_template, $preseed_tpl, $DEFAULT_PRESEED, $PF_SCRIPT,
+            $PF_CONFIG );
+    }
 }
 
 exit 0;

Modified: branches/next-gen/sbin/mk_resolvconf
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/sbin/mk_resolvconf?rev=880&op=diff
==============================================================================
--- branches/next-gen/sbin/mk_resolvconf (original)
+++ branches/next-gen/sbin/mk_resolvconf Tue Sep  7 08:54:53 2010
@@ -31,17 +31,17 @@
 
 #################################
 # VARS
-my $HELP				= 0;
-my $HOSTNAME			= hostname;
-my $SITE				= '';
-my $GLOBAL_STORE_FILE	= '';
-my $PF_CONFIG_FILE		= '';
-my $PF_CONFIG			= {};
-my $OUTPUT_FILE			= '/etc/resolv.conf';
-my $GLOBAL_STRUCT		= {};
+my $HELP              = 0;
+my $HOSTNAME          = hostname;
+my $SITE              = '';
+my $GLOBAL_STORE_FILE = '';
+my $PF_CONFIG_FILE    = '';
+my $PF_CONFIG         = {};
+my $OUTPUT_FILE       = '/etc/resolv.conf';
+my $GLOBAL_STRUCT     = {};
 
 my $program = $0;
-$program =~ s%.*/%%; # cheap basename
+$program =~ s%.*/%%;    # cheap basename
 
 my $version = sprintf( "svn-r%s", q$Revision$ =~ /([\d.]+)/ );
 
@@ -66,47 +66,52 @@
 ##################################
 ### MAIN
 
-GetOptions (
-	'help'			=> \$HELP,
-	'host|h=s'		=> \$HOSTNAME,
-	'site|s=s'		=> \$SITE,
-	'config|c=s'	=> \$PF_CONFIG_FILE,
-	'store=s'		=> \$GLOBAL_STORE_FILE,
-	'output|o=s'	=> \$OUTPUT_FILE
+GetOptions(
+    'help'       => \$HELP,
+    'host|h=s'   => \$HOSTNAME,
+    'site|s=s'   => \$SITE,
+    'config|c=s' => \$PF_CONFIG_FILE,
+    'store=s'    => \$GLOBAL_STORE_FILE,
+    'output|o=s' => \$OUTPUT_FILE
 ) or die "Didn't grok options (see --help).\n";
 
-if ( $HELP ) {
-	Do_help ();
-	exit 0;
+if ($HELP) {
+    Do_help();
+    exit 0;
 }
 
-( $PF_CONFIG, $GLOBAL_STRUCT ) = Init_TOOLS ( $HOSTNAME, $PF_CONFIG_FILE, $GLOBAL_STORE_FILE );
+( $PF_CONFIG, $GLOBAL_STRUCT )
+    = Init_TOOLS( $HOSTNAME, $PF_CONFIG_FILE, $GLOBAL_STORE_FILE );
 
 if ( $SITE eq '' ) {
-	if ( ! defined $PF_CONFIG->{'location'}->{'site'} ) {
-		my $site_list = Get_site_from_hostname ( $HOSTNAME, $GLOBAL_STRUCT );
-		if ( ! defined $site_list ) {
-			Abort ( $CODE->{'UNDEF_KEY'},
-				"Unable to retrieve site for hostname ".$HOSTNAME." : hostname not defined" );
-		}
-		elsif ( scalar @{$site_list} > 1 ) {
-			Abort ( $CODE->{'DUPLICATE_VALUE'},
-				"Unable to retrieve site for hostname ".$HOSTNAME." : hostname appeared in multiple sites : "
-				.join ( ",", @{$site_list} ).".\n"
-				."Please relaunch this command with the right site" );
-		}
-		else {
-			( $SITE ) = @{$site_list};
-		}
-	}
-	else {
-		$SITE = $PF_CONFIG->{'location'}->{'site'}
-	}
+    if ( !defined $PF_CONFIG->{'location'}->{'site'} ) {
+        my $site_list = Get_site_from_hostname( $HOSTNAME, $GLOBAL_STRUCT );
+        if ( !defined $site_list ) {
+            Abort( $CODE->{'UNDEF_KEY'},
+                      "Unable to retrieve site for hostname "
+                    . $HOSTNAME
+                    . " : hostname not defined" );
+        }
+        elsif ( scalar @{$site_list} > 1 ) {
+            Abort( $CODE->{'DUPLICATE_VALUE'},
+                      "Unable to retrieve site for hostname "
+                    . $HOSTNAME
+                    . " : hostname appeared in multiple sites : "
+                    . join( ",", @{$site_list} ) . ".\n"
+                    . "Please relaunch this command with the right site" );
+        }
+        else {
+            ($SITE) = @{$site_list};
+        }
+    }
+    else {
+        $SITE = $PF_CONFIG->{'location'}->{'site'};
+    }
 }
 
-if ( ! Mk_resolvconf ( $HOSTNAME, $GLOBAL_STRUCT, $SITE, $OUTPUT_FILE ) ) {
-	Abort ( $CODE->{'EXEC'},
-		"An error occured during build of file ".$OUTPUT_FILE );
+if ( !Mk_resolvconf( $HOSTNAME, $GLOBAL_STRUCT, $SITE, $OUTPUT_FILE ) ) {
+    Abort( $CODE->{'EXEC'},
+        "An error occured during build of file " . $OUTPUT_FILE );
 }
 
 exit 0;

Modified: branches/next-gen/sbin/mk_sitezone
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/sbin/mk_sitezone?rev=880&op=diff
==============================================================================
--- branches/next-gen/sbin/mk_sitezone (original)
+++ branches/next-gen/sbin/mk_sitezone Tue Sep  7 08:54:53 2010
@@ -31,16 +31,16 @@
 
 #################################
 # VARS
-my $HELP				= 0;
-my $SITE				= '';
-my $GLOBAL_STORE_FILE	= '';
-my $PF_CONFIG_FILE		= '';
-my $PF_CONFIG			= {};
-my $OUTPUT_FILE			= '';
-my $GLOBAL_STRUCT		= {};
+my $HELP              = 0;
+my $SITE              = '';
+my $GLOBAL_STORE_FILE = '';
+my $PF_CONFIG_FILE    = '';
+my $PF_CONFIG         = {};
+my $OUTPUT_FILE       = '';
+my $GLOBAL_STRUCT     = {};
 
 my $program = $0;
-$program =~ s%.*/%%; # cheap basename
+$program =~ s%.*/%%;    # cheap basename
 
 my $version = sprintf( "svn-r%s", q$Revision$ =~ /([\d.]+)/ );
 
@@ -64,42 +64,45 @@
 ##########################################################""
 ### MAIN
 
-GetOptions (
-	'help'			=> \$HELP,
-	'site|s=s'		=> \$SITE,
-	'config|c=s'	=> \$PF_CONFIG_FILE,
-	'store=s'		=> \$GLOBAL_STORE_FILE,
-	'output|o=s'	=> \$OUTPUT_FILE
+GetOptions(
+    'help'       => \$HELP,
+    'site|s=s'   => \$SITE,
+    'config|c=s' => \$PF_CONFIG_FILE,
+    'store=s'    => \$GLOBAL_STORE_FILE,
+    'output|o=s' => \$OUTPUT_FILE
 ) or die "Didn't grok options (see --help).\n";
 
-if ( $HELP ) {
-	Do_help ();
-	exit 0;
+if ($HELP) {
+    Do_help();
+    exit 0;
 }
 
-( $PF_CONFIG, $GLOBAL_STRUCT ) = Init_TOOLS ( "", $PF_CONFIG_FILE, $GLOBAL_STORE_FILE );
+( $PF_CONFIG, $GLOBAL_STRUCT )
+    = Init_TOOLS( "", $PF_CONFIG_FILE, $GLOBAL_STORE_FILE );
 
 if ( $SITE eq '' ) {
-	if ( ! defined $PF_CONFIG->{'location'}->{'site'} ) {
-		Abort ( $CODE->{'UNDEF_KEY'},
-			"A site MUST BE defined for building DNS zone forward" );
-	}
-	else {
-		$SITE = $PF_CONFIG->{'location'}->{'site'};
-	}
+    if ( !defined $PF_CONFIG->{'location'}->{'site'} ) {
+        Abort( $CODE->{'UNDEF_KEY'},
+            "A site MUST BE defined for building DNS zone forward" );
+    }
+    else {
+        $SITE = $PF_CONFIG->{'location'}->{'site'};
+    }
 }
 
-if ( ! defined $GLOBAL_STRUCT->{'DHCP'}->{'BY_SITE'}->{$SITE} ) {
-	Abort ( $CODE->{'UNDEF_KEY'},
-		"Site ".$SITE." is not defined into global configuration" );
+if ( !defined $GLOBAL_STRUCT->{'DHCP'}->{'BY_SITE'}->{$SITE} ) {
+    Abort( $CODE->{'UNDEF_KEY'},
+        "Site " . $SITE . " is not defined into global configuration" );
 }
 
-my $zone = Mk_zone_for_site ( $GLOBAL_STRUCT->{'SITE'}->{'BY_NAME'}->{$SITE}->{'zone'}, $SITE, $GLOBAL_STRUCT );
-unless ( open ( ZONE, ">".$OUTPUT_FILE ) ) {
-	Abort ( $CODE->{'OPEN'},
-		"Unable to open zone file ".$OUTPUT_FILE );
+my $zone
+    = Mk_zone_for_site(
+    $GLOBAL_STRUCT->{'SITE'}->{'BY_NAME'}->{$SITE}->{'zone'},
+    $SITE, $GLOBAL_STRUCT );
+unless ( open( ZONE, ">" . $OUTPUT_FILE ) ) {
+    Abort( $CODE->{'OPEN'}, "Unable to open zone file " . $OUTPUT_FILE );
 }
-print ZONE join ( "\n", @{$zone} );
-close ( ZONE );
+print ZONE join( "\n", @{$zone} );
+close(ZONE);
 
 exit 0;

Modified: branches/next-gen/sbin/mk_sourceslist
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/sbin/mk_sourceslist?rev=880&op=diff
==============================================================================
--- branches/next-gen/sbin/mk_sourceslist (original)
+++ branches/next-gen/sbin/mk_sourceslist Tue Sep  7 08:54:53 2010
@@ -33,30 +33,30 @@
 ############################################
 # Vars
 
-my $HELP				= 0;
-my $HOSTNAME			= hostname;
-my $OUTPUT_FILE			= "";
-my $TEMPLATE			= "";
-my $SITE				= "";
-my $SECTIONS			= "common" ;
-my $TO_ADD				= "";
-my $BACKPORTS			= 0;
-my $GLOBAL_STORE_FILE	= '';
-my $PF_CONFIG_FILE		= '';
-my $PF_CONFIG			= {};
-my $GLOBAL_STRUCT		= {};
+my $HELP              = 0;
+my $HOSTNAME          = hostname;
+my $OUTPUT_FILE       = "";
+my $TEMPLATE          = "";
+my $SITE              = "";
+my $SECTIONS          = "common";
+my $TO_ADD            = "";
+my $BACKPORTS         = 0;
+my $GLOBAL_STORE_FILE = '';
+my $PF_CONFIG_FILE    = '';
+my $PF_CONFIG         = {};
+my $GLOBAL_STRUCT     = {};
 
 my $program = $0;
-$program =~ s%.*/%%; # cheap basename
+$program =~ s%.*/%%;    # cheap basename
 
-my $version = sprintf("svn-r%s", q$Revision$ =~ /([\d.]+)/);
+my $version = sprintf( "svn-r%s", q$Revision$ =~ /([\d.]+)/ );
 
 ############################################
 # Functions
 
 sub Do_help () {
 
-print <<EOF
+    print <<EOF
 
 $program - version $version
 
@@ -103,54 +103,60 @@
 #############################################################
 ### MAIN
 
-GetOptions (
-	'help'			=> \$HELP,
-	'host|h=s'		=> \$HOSTNAME,
-	'site|s=s'		=> \$SITE,
-	'tpl|t=s'		=> \$TEMPLATE,
-	'a|add=s'		=> \$TO_ADD,
-	'config|c=s'	=> \$PF_CONFIG_FILE,
-	'store=s'		=> \$GLOBAL_STORE_FILE,
-	'backport|b'	=> \$BACKPORTS,
-	'output|o=s'	=> \$OUTPUT_FILE
+GetOptions(
+    'help'       => \$HELP,
+    'host|h=s'   => \$HOSTNAME,
+    'site|s=s'   => \$SITE,
+    'tpl|t=s'    => \$TEMPLATE,
+    'a|add=s'    => \$TO_ADD,
+    'config|c=s' => \$PF_CONFIG_FILE,
+    'store=s'    => \$GLOBAL_STORE_FILE,
+    'backport|b' => \$BACKPORTS,
+    'output|o=s' => \$OUTPUT_FILE
 ) or die "Didn't grok options (see --help).\n";
 
-if ( $HELP ) {
-	Do_help ();
-	exit 0;
+if ($HELP) {
+    Do_help();
+    exit 0;
 }
 
 if ( $HOSTNAME eq "" ) {
-	Abort ( $CODE->{'UNDEF_KEY'},
-		"Unable to build sources.list for an undefined hostname" );
+    Abort( $CODE->{'UNDEF_KEY'},
+        "Unable to build sources.list for an undefined hostname" );
 }
 
-( $PF_CONFIG, $GLOBAL_STRUCT ) = Init_TOOLS ( $HOSTNAME, $PF_CONFIG_FILE, $GLOBAL_STORE_FILE );
+( $PF_CONFIG, $GLOBAL_STRUCT )
+    = Init_TOOLS( $HOSTNAME, $PF_CONFIG_FILE, $GLOBAL_STORE_FILE );
 
 if ( $SITE eq '' ) {
-	if ( ! defined $PF_CONFIG->{'location'}->{'site'} ) {
-		my $site_list = Get_site_from_hostname ( $HOSTNAME, $GLOBAL_STRUCT );
-		if ( ! defined $site_list ) {
-			Abort ( $CODE->{'UNDEF_KEY'},
-				"Unable to retrieve site for hostname ".$HOSTNAME." : hostname not defined" );
-		}
-		elsif ( scalar @{$site_list} > 1 ) {
-			Abort ( $CODE->{'DUPLICATE_VALUE'},
-				"Unable to retrieve site for hostname ".$HOSTNAME." : hostname appeared in multiple sites : "
-				.join ( ",", @{$site_list} ).".\n"
-				."Please relaunch this command with the right site" );
-		}
-		else {
-			( $SITE ) = @{$site_list};
-		}
-	}
-	else {
-		$SITE = $PF_CONFIG->{'location'}->{'site'}
-	}
+    if ( !defined $PF_CONFIG->{'location'}->{'site'} ) {
+        my $site_list = Get_site_from_hostname( $HOSTNAME, $GLOBAL_STRUCT );
+        if ( !defined $site_list ) {
+            Abort( $CODE->{'UNDEF_KEY'},
+                      "Unable to retrieve site for hostname "
+                    . $HOSTNAME
+                    . " : hostname not defined" );
+        }
+        elsif ( scalar @{$site_list} > 1 ) {
+            Abort( $CODE->{'DUPLICATE_VALUE'},
+                      "Unable to retrieve site for hostname "
+                    . $HOSTNAME
+                    . " : hostname appeared in multiple sites : "
+                    . join( ",", @{$site_list} ) . ".\n"
+                    . "Please relaunch this command with the right site" );
+        }
+        else {
+            ($SITE) = @{$site_list};
+        }
+    }
+    else {
+        $SITE = $PF_CONFIG->{'location'}->{'site'};
+    }
 }
 
-$TO_ADD		=~ s/,/ /g;
-$SECTIONS	.= " ".$TO_ADD;
-Mk_sourceslist ( $HOSTNAME, $SITE, $OUTPUT_FILE, $SECTIONS, $TEMPLATE, $BACKPORTS, $GLOBAL_STRUCT, $PF_CONFIG ) ;
+$TO_ADD =~ s/,/ /g;
+$SECTIONS .= " " . $TO_ADD;
+Mk_sourceslist( $HOSTNAME, $SITE, $OUTPUT_FILE, $SECTIONS, $TEMPLATE,
+    $BACKPORTS, $GLOBAL_STRUCT, $PF_CONFIG );
 
 exit 0;

Modified: branches/next-gen/sbin/update-config
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/sbin/update-config?rev=880&op=diff
==============================================================================
--- branches/next-gen/sbin/update-config (original)
+++ branches/next-gen/sbin/update-config Tue Sep  7 08:54:53 2010
@@ -35,11 +35,11 @@
 
 #################################
 # VARS
-my $PF_CONFIG			= {};
-my $GLOBAL_STRUCT		= {};
+my $PF_CONFIG     = {};
+my $GLOBAL_STRUCT = {};
 
 my $program = $0;
-$program =~ s%.*/%%; # cheap basename
+$program =~ s%.*/%%;    # cheap basename
 
 my $version = sprintf( "svn-r%s", q$Revision$ =~ /([\d.]+)/ );
 
@@ -75,86 +75,82 @@
 my $options = {};
 
 GetOptions(
-    $options,
-    'branch=s',
-    'debug|d',
-    'diff|u',
-    'force-reload|f',
-    'help',
-    'install|i',
-    'noaction',
-    'noupdate',
-    'quiet|q',
-    'simul|s',
-	'pkg_type|p=s',
-    'verbose|v',
-    'config|c=s',
-    'store=s',
-    'host|h=s',
+    $options,         'branch=s',   'debug|d',   'diff|u',
+    'force-reload|f', 'help',       'install|i', 'noaction',
+    'noupdate',       'quiet|q',    'simul|s',   'pkg_type|p=s',
+    'verbose|v',      'config|c=s', 'store=s',   'host|h=s',
     'site=s'
 ) or die "GetOptions error, try --help: $!\n";
 
 if ( $options->{'help'} ) {
-	Do_help ();
-	exit 0;
+    Do_help();
+    exit 0;
 }
-$options->{'store'} = "" if ( ! defined $options->{'store'} );
-my $HOSTNAME	= $options->{'host'} || hostname; 
-my $SITE		= $options->{'site'} || "";
+$options->{'store'} = "" if ( !defined $options->{'store'} );
+my $HOSTNAME = $options->{'host'} || hostname;
+my $SITE     = $options->{'site'} || "";
 
-( $PF_CONFIG, $GLOBAL_STRUCT ) = Init_TOOLS ( $HOSTNAME, $options->{'config'}, $options->{'store'}, $options->{'force-reload'} );
+( $PF_CONFIG, $GLOBAL_STRUCT )
+    = Init_TOOLS( $HOSTNAME, $options->{'config'}, $options->{'store'},
+    $options->{'force-reload'} );
 
 #### VERIFYING UPDATE FEATURE IN PF-TOOLS CONFIG ABORTING IF DEACTIVATED !!!
-if ( ! $PF_CONFIG->{'features'}->{'update'} ) {
-	Abort ( $CODE->{'OK'},
-		"update-config command has been deactivated in features section in pf-tools.conf" );
+if ( !$PF_CONFIG->{'features'}->{'update'} ) {
+    Abort( $CODE->{'OK'},
+        "update-config command has been deactivated in features section in pf-tools.conf"
+    );
 }
 
 if ( $SITE eq '' ) {
-	if ( ! defined $PF_CONFIG->{'location'}->{'site'} ) {
-		my $site_list = Get_site_from_hostname ( $HOSTNAME, $GLOBAL_STRUCT );
-		if ( ! defined $site_list ) {
-			Abort ( $CODE->{'UNDEF_KEY'},
-				"Unable to retrieve site for hostname ".$HOSTNAME." : hostname not defined" );
-		}
-		elsif ( scalar @{$site_list} > 1 ) {
-			Abort ( $CODE->{'DUPLICATE_VALUE'},
-				"Unable to retrieve site for hostname ".$HOSTNAME." : hostname appeared in multiple sites : "
-				.join ( ",", @{$site_list} ).".\n"
-				."Please relaunch this command with the right site" );
-		}
-		else {
-			( $SITE ) = @{$site_list};
-		}
-	}
-	else {
-		$SITE = $PF_CONFIG->{'location'}->{'site'}
-	}
+    if ( !defined $PF_CONFIG->{'location'}->{'site'} ) {
+        my $site_list = Get_site_from_hostname( $HOSTNAME, $GLOBAL_STRUCT );
+        if ( !defined $site_list ) {
+            Abort( $CODE->{'UNDEF_KEY'},
+                      "Unable to retrieve site for hostname "
+                    . $HOSTNAME
+                    . " : hostname not defined" );
+        }
+        elsif ( scalar @{$site_list} > 1 ) {
+            Abort( $CODE->{'DUPLICATE_VALUE'},
+                      "Unable to retrieve site for hostname "
+                    . $HOSTNAME
+                    . " : hostname appeared in multiple sites : "
+                    . join( ",", @{$site_list} ) . ".\n"
+                    . "Please relaunch this command with the right site" );
+        }
+        else {
+            ($SITE) = @{$site_list};
+        }
+    }
+    else {
+        $SITE = $PF_CONFIG->{'location'}->{'site'};
+    }
 }
 
 if ( $options->{'help'} ) {
-	Do_help();
-	exit;
+    Do_help();
+    exit;
 }
 
 if ( $options->{'quiet'} ) {
-	Log("update-config started in quiet mode...");
-	Set_deferredlog ();
+    Log("update-config started in quiet mode...");
+    Set_deferredlog();
 }
 
 $options->{'simul'} = 1 if ( $options->{'diff'} );
 
 if ( defined( $ARGV[0] ) && $ARGV[0] eq ':NO-ACTION:' ) {
-	Warn( $CODE->{'OPEN'}, ":NO-ACTION: depreciated, please use --noaction" );
-	$options->{'noaction'} = 1;
+    Warn( $CODE->{'OPEN'}, ":NO-ACTION: depreciated, please use --noaction" );
+    $options->{'noaction'} = 1;
 }
 if ( defined( $ARGV[0] ) && $ARGV[0] eq ':NO-UPDATE:' ) {
-	Warn( $CODE->{'OPEN'}, ":NO-UPDATE: depreciated, please use --noupdate" );
-	$options->{'noupdate'} = 1;
+    Warn( $CODE->{'OPEN'}, ":NO-UPDATE: depreciated, please use --noupdate" );
+    $options->{'noupdate'} = 1;
 }
 
-Do_update_from_GLOBAL ( $HOSTNAME, $SITE, $options, $GLOBAL_STRUCT, $PF_CONFIG );
+Do_update_from_GLOBAL( $HOSTNAME, $SITE, $options, $GLOBAL_STRUCT,
+    $PF_CONFIG );
 
-Unset_deferredlog () if ( $options->{'quiet'} );
+Unset_deferredlog() if ( $options->{'quiet'} );
 
 exit 0;




More information about the pf-tools-commits mailing list