pf-tools commit: r618 [ccaillet-guest] - in /trunk: debian/changelog sbin/mk_sourceslist templates/sources.list.tpl
parmelan-guest at users.alioth.debian.org
parmelan-guest at users.alioth.debian.org
Fri Aug 1 12:43:25 UTC 2008
Author: ccaillet-guest
Date: Fri Aug 1 12:43:25 2008
New Revision: 618
URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=618
Log:
Adding mk_sourceslist tool needed for adding custom repositories
Added:
trunk/sbin/mk_sourceslist (with props)
trunk/templates/sources.list.tpl
Modified:
trunk/debian/changelog
Modified: trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pf-tools/trunk/debian/changelog?rev=618&op=diff
==============================================================================
--- trunk/debian/changelog (original)
+++ trunk/debian/changelog Fri Aug 1 12:43:25 2008
@@ -1,3 +1,9 @@
+pf-tools (0.33-0+RC3) unstable; urgency=low
+
+ * Adding mk_sourceslist tool needed for adding custom repositories
+
+ -- Christophe Caillet <quadchris at free.fr> Fri, 01 Aug 2008 14:37:48 +0200
+
pf-tools (0.33-0+RC2) unstable; urgency=low
* Add : filter_systemmap for getting the system map filename
Added: trunk/sbin/mk_sourceslist
URL: http://svn.debian.org/wsvn/pf-tools/trunk/sbin/mk_sourceslist?rev=618&op=file
==============================================================================
--- trunk/sbin/mk_sourceslist (added)
+++ trunk/sbin/mk_sourceslist Fri Aug 1 12:43:25 2008
@@ -1,0 +1,88 @@
+#!/usr/bin/perl
+##
+## $Id$
+##
+## Copyright (C) 2007-2008 Christophe Caillet <quadchris at free.fr>
+## Copyright (C) 2003-2005 Damien Clermonte <damien at sitadelle.com>
+## Copyright (C) 2001-2003 Olivier Molteni <olivier at molteni.net>
+##
+## 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::Conf;
+use PFTools::Update;
+use File::Compare ;
+use File::Copy ;
+use Getopt::Long qw( :config ignore_case_always bundling ) ;
+
+my $SRC = "" ;
+my $DST = "" ;
+my $TPL = "/usr/share/pf-tools/templates/sources.list.tpl" ;
+my $SECTIONS = "common" ;
+my $HOST = chomp ( `/bin/hostname -s 2>>/dev/null` ) ;
+
+sub Mk_sourceslist ($$$$) {
+ my ( $ref_srv, $dst, $tpl, $sections ) = @_ ;
+
+ if ( ! open ( SOURCESTPL, $tpl ) ) {
+ warn "Unable to get sources.list template from file ".$tpl."\n" ;
+ return 1 ;
+ }
+ my $sources_content = join '', <SOURCESTPL> ;
+ close ( SOURCESTPL ) ;
+
+ $sources_content =~ s/%DISTRIB%/$ref_srv->{'distrib'}/gs ;
+ my $dist_src = $ref_srv->{'deploymode'} ;
+ $dist_src =~ s/^(debian|ubuntu)-installer/$1/ ;
+
+ my $security ;
+ ( $dist_src eq 'debian' ) ? $security = $ref_srv->{'distrib'}."/updates" : $security = $ref_srv->{'distrib'}."-security" ;
+
+ $sources_content =~ s/%DISTSRC%/$dist_src/gs ;
+ $sources_content =~ s/%SECURITY%/$security/gs ;
+
+ if ( ! open ( DST, ">".$dst ) ) {
+ warn "Unable to open destination's sources.list ".$dst."\n" ;
+ return 1 ;
+ }
+ print DST $sources_content ;
+ close ( DST ) ;
+ return 0 ;
+}
+
+GetOptions (
+ 'h|host=s' => \$HOST,
+ 's|src=s' => \$SRC,
+ 'd|dst=s' => \$DST,
+ 't|tpl=s' => \$TPL
+) || die "Didn't grok options on CLI\n" ;
+
+if ( $SRC eq "" || $DST eq "" ) {
+ warn "Source or/and destination are not defined : cannot build sources.list file\n" ;
+ Usage () ;
+ exit 1 ;
+}
+
+if ( @ARGV ) { $SECTIONS .= " ".join ( " ", "common", @ARGV ) ; }
+
+my $PF_NET = Init_lib_net ( Get_source ( $SRC ) ) ;
+$HOST =~ /^(([^\-]{4})-)?([^\d\-]+)-([\d]+)$/ ;
+my $SRV = $PF_NET->{$Z->{'SERVERS'}->{'BY_NAME'}->{$3}->{'SRVLIST'}->{$HOST} ;
+
+Mk_sourceslist ( $SRV, $DST, $TPL, $SECTIONS ) ;
Propchange: trunk/sbin/mk_sourceslist
------------------------------------------------------------------------------
svn:executable = *
Propchange: trunk/sbin/mk_sourceslist
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Fri Aug 1 12:43:25 2008
@@ -1,0 +1,2 @@
+Id
+Revision
Added: trunk/templates/sources.list.tpl
URL: http://svn.debian.org/wsvn/pf-tools/trunk/templates/sources.list.tpl?rev=618&op=file
==============================================================================
--- trunk/templates/sources.list.tpl (added)
+++ trunk/templates/sources.list.tpl Fri Aug 1 12:43:25 2008
@@ -1,0 +1,6 @@
+
+deb http://mirrors.private/%DISTSRC% %DISTRIB% main non-free contrib
+
+deb http://mirrors.private/%DISTSRC%-custom %DISTRIB% common
+
+deb http://mirrors.private/%DISTSRC%-security %SECURITY% main contrib non-free
More information about the pf-tools-commits
mailing list