pf-tools commit: r622 [ccaillet-guest] - in /trunk: debian/changelog filters/filter_distrib scripts/ scripts/pf-tools-config.sh templates/sources.list.tpl templates/standard-preseed.tpl

parmelan-guest at users.alioth.debian.org parmelan-guest at users.alioth.debian.org
Mon Aug 4 13:29:54 UTC 2008


Author: ccaillet-guest
Date: Mon Aug  4 13:29:54 2008
New Revision: 622

URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=622
Log:
Importing pf-tools-config script which permits to get the needed config for running update-config after a pf-tools package installation

Added:
    trunk/filters/filter_distrib   (with props)
    trunk/scripts/
    trunk/scripts/pf-tools-config.sh
Modified:
    trunk/debian/changelog
    trunk/templates/sources.list.tpl
    trunk/templates/standard-preseed.tpl

Modified: trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pf-tools/trunk/debian/changelog?rev=622&op=diff
==============================================================================
--- trunk/debian/changelog (original)
+++ trunk/debian/changelog Mon Aug  4 13:29:54 2008
@@ -2,8 +2,10 @@
 
   * Add: mk_sourceslist tool needed for adding custom repositories
   * Add: sources.list.tpl
-
- -- Christophe Caillet <tof at sitadelle.com>  Fri, 01 Aug 2008 15:37:51 +0200
+  * Add: filter_distrib for extracting distribution and origin for
+    configuration file from private-network definitions 
+
+ -- Christophe Caillet <tof at sitadelle.com>  Mon, 04 Aug 2008 14:00:00 +0200
 
 pf-tools (0.33-0+RC2) unstable; urgency=low
 

Added: trunk/filters/filter_distrib
URL: http://svn.debian.org/wsvn/pf-tools/trunk/filters/filter_distrib?rev=622&op=file
==============================================================================
--- trunk/filters/filter_distrib (added)
+++ trunk/filters/filter_distrib Mon Aug  4 13:29:54 2008
@@ -1,0 +1,82 @@
+#!/usr/bin/perl
+##
+##  $Id$
+##
+##  Copyright (C) 2007-2008 Christophe Caillet <quadchris at free.fr>
+##
+##  This program is free software; you can redistribute it and/or
+##  modify it under the terms of the GNU General Public License
+##  as published by the Free Software Foundation; either version 2
+##  of the License, or (at your option) any later version.
+##
+##  This program is distributed in the hope that it will be useful,
+##  but WITHOUT ANY WARRANTY; without even the implied warranty of
+##  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+##  GNU General Public License for more details.
+##
+##  You should have received a copy of the GNU General Public License
+##  along with this program; if not, write to the Free Software
+##  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+##
+
+use strict;
+use warnings;
+
+use PFTools::Net;
+use PFTools::Update;
+
+my $program = $0;
+$program =~ s%.*/%%; # cheap basename
+
+my $version = sprintf("svn-r%s", q$Revision$ =~ /([\d.]+)/);
+
+sub Usage () {
+
+	print <<EOF
+
+$program - version $version
+
+Synopsis : $program <src> <hostname> <dst>
+
+	This filter permits to replace the variables %DISTRIB% and %DISTSRC% according to
+	the values extract from <hostname> definition on private-network
+
+	<src>		Define here the source file on which you want to search and replace
+
+	<hostname>	Specify here the hostname
+
+	<dst>		Define here the destination file which receive the filtered datas
+
+EOF
+
+}
+
+my ( $src, $host, $dst ) = @ARGV;
+unless ( $src and $host and $dst ) {
+	warn "You MUST define <src>, <host> and <destination>\n" ;
+	Usage () ;
+	exit 1 ;
+}
+
+my $PF_NET		= Init_lib_net( Get_source("GLOBAL:private-network") ) ;
+$host			=~ /^(([^\-]{4})-)?([^\d\-]+)(-([\d]+))?$/ ;
+my $host_distrib	= $PF_NET->{'SERVERS'}->{'BY_NAME'}->{$3}->{'SRVLIST'}->{$host}->{'distrib'} ;
+my $host_distsrc	= $PF_NET->{'SERVERS'}->{'BY_NAME'}->{$3}->{'SRVLIST'}->{$host}->{'deploymode'} ;
+$host_distsrc		=~ s/^(debian|ubuntu)-installer$/$1/ ;
+
+open SRC, "<$src" or die "open: $src: $!\n";
+open DST, ">$dst" or die "open: $dst: $!\n";
+
+while (<SRC>) {
+	my $line = $_;
+	my $pos  = length $line;
+
+	$line	=~ s/%DISTSRC%/$host_distsrc/gs ;
+	$line	=~ s/%DISTRIB%/$host_distrib/gs ;
+	
+	print DST $line;
+}
+
+close DST;
+close SRC;
+

Propchange: trunk/filters/filter_distrib
------------------------------------------------------------------------------
    svn:executable = *

Propchange: trunk/filters/filter_distrib
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Mon Aug  4 13:29:54 2008
@@ -1,0 +1,2 @@
+Id
+Revision

Added: trunk/scripts/pf-tools-config.sh
URL: http://svn.debian.org/wsvn/pf-tools/trunk/scripts/pf-tools-config.sh?rev=622&op=file
==============================================================================
--- trunk/scripts/pf-tools-config.sh (added)
+++ trunk/scripts/pf-tools-config.sh Mon Aug  4 13:29:54 2008
@@ -1,0 +1,12 @@
+#!/bin/bash
+
+CVSGUEST=/var/lib/cvsguest
+DEPLOY=http://deploy00.private
+CVS_KEY=id_rsa
+
+mkdir -p -m 0700 $CVSGUEST/.ssh >/dev/null 2>&1
+chmod 700 $CVSGUEST
+wget $DEPLOY/$CVS_KEY -O $CVSGUEST/.ssh/$CVS_KEY
+chmod 400 $CVSGUEST/.ssh/$CVS_KEY
+
+update-config --noaction

Modified: trunk/templates/sources.list.tpl
URL: http://svn.debian.org/wsvn/pf-tools/trunk/templates/sources.list.tpl?rev=622&op=diff
==============================================================================
--- trunk/templates/sources.list.tpl (original)
+++ trunk/templates/sources.list.tpl Mon Aug  4 13:29:54 2008
@@ -3,6 +3,6 @@
 
 deb http://mirrors.private/%DISTSRC% %DISTRIB% %DEFAULT_SECTIONS%
 
-deb http://mirrors.private/%DISTSRC%-custom %DISTRIB% %CUSTOM_SECTIONS%
+deb http://mirrors.private/%DISTSRC%-custom %DISTRIB%-custom %CUSTOM_SECTIONS%
 
 deb http://mirrors.private/%DISTSRC%-security %SECURITY% %DEFAULT_SECTIONS%

Modified: trunk/templates/standard-preseed.tpl
URL: http://svn.debian.org/wsvn/pf-tools/trunk/templates/standard-preseed.tpl?rev=622&op=diff
==============================================================================
--- trunk/templates/standard-preseed.tpl (original)
+++ trunk/templates/standard-preseed.tpl Mon Aug  4 13:29:54 2008
@@ -22,7 +22,7 @@
 ### Mirror settings
 d-i mirror/protocol string http
 d-i mirror/country string enter information manually
-d-i mirror/http/hostname string deploy.private
+d-i mirror/http/hostname string mirrors.private
 d-i mirror/http/directory string /%DISTSRC%
 d-i mirror/http/proxy string
 
@@ -79,11 +79,11 @@
 d-i apt-setup/non-free boolean true
 d-i apt-setup/contrib boolean true
 d-i apt-setup/services-select string multi-select security
-d-i apt-setup/security_host string deploy.private/%DISTSRC%-security
+d-i apt-setup/security_host string mirrors.private/%DISTSRC%-security
 #d-i apt-setup/volatile_host string volatile.debian.org
 # Additional repositories, local[0-9] available
 d-i apt-setup/local0/repository string \
-       http://deploy.private/%DISTSRC%-custom %DISTRIB% common
+       http://mirrors.private/%DISTSRC%-custom %DISTRIB%-custom common
 #d-i apt-setup/local0/key string http://local.server/key
 # By default the installer requires that repositories be authenticated
 # using a known gpg key. This setting can be used to disable that




More information about the pf-tools-commits mailing list