[Fai-commit] r3898 - trunk/lib
fai-commit at lists.alioth.debian.org
fai-commit at lists.alioth.debian.org
Fri Sep 8 12:18:21 UTC 2006
Author: lange
Date: 2006-09-08 12:18:21 +0000 (Fri, 08 Sep 2006)
New Revision: 3898
Removed:
trunk/lib/fai-debconf-pipe
Log:
fai-debconf is now using a read-only tmp file instead of a pipe
Deleted: trunk/lib/fai-debconf-pipe
===================================================================
--- trunk/lib/fai-debconf-pipe 2006-09-08 10:26:01 UTC (rev 3897)
+++ trunk/lib/fai-debconf-pipe 2006-09-08 12:18:21 UTC (rev 3898)
@@ -1,103 +0,0 @@
-#!/usr/bin/perl -w
-
-#*********************************************************************
-# 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.
-#
-# A copy of the GNU General Public License is available as
-# `/usr/share/common-licences/GPL' in the Debian GNU/Linux distribution
-# or on the World Wide Web at http://www.gnu.org/copyleft/gpl.html. You
-# can also obtain it by writing to the Free Software Foundation, Inc.,
-# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#*********************************************************************
-
-
-use strict;
-use IO::Socket;
-
-my $debug = $ENV{"debug"};
-
-# use /tmp if directory is not available
-my $PIPEFILE = "$ENV{'target'}$ENV{'DEBCONF_PIPE'}";
-
-die "No package name given!\n" unless $ARGV[0];
-my $packagename = shift @ARGV;
-
-my %answers;
-
-select STDERR;
-
-open(DH, $ENV{"LOGDIR"}."/debconf.data") or die "Cannot open ".$ENV{"LOGDIR"}."/debconf.data\n" ;
-
-print "Reading from <". $ENV{"LOGDIR"}."/debconf.data ... " if $debug;
-
-while(<DH>) {
- print "read: $_" if $debug;
- chomp;
- next unless /^([^[:space:]]+)[[:space:]]+([^[:space:]]+)[[:space:]]+([^[:space:]]+)[[:space:]]*(.*)$/;
- print "extracted: PN: $1, Q: $2, T: $3, A: $4\n" if $debug;
- next unless ( $1 eq $packagename );
- $answers{ "$2" } = "$4";
-
- print "Got answer for $2: " . $answers{ "$2" } . "\n" if $debug;
-}
-close DH;
-
-print "done.\n" if $debug;
-
-my $thepipe = IO::Socket::UNIX->new(
- Type => SOCK_STREAM,
- Local => $PIPEFILE, Listen => 1 ) || die "Cannot create socket!\n";
-
-
-my $client = $thepipe->accept();
-while(<$client>) {
- chomp;
- print "Read: $_\n" if $debug;
- if( /^CAPB backup$/ ) {
- print $client "0 backup\n";
- print "Sent: 0 backup\n" if $debug;
- }
- elsif( /^STOP$/ ) {
- print $client "0 OK\n";
- print "Sent: 0 OK\n" if $debug;
- last;
- }
- elsif( /^GET ([^[:space:]]*)$/ ) {
- if( defined $answers{ "$1" } ) {
- print $client "0 " . $answers{ "$1" } . "\n";
- print "Sent: 0 " . $answers{ "$1" }. "\n" if $debug;
- }
- else {
- print $client "0 \n";
- print "Sent: 0 \n" if $debug;
- }
- }
- elsif( /^SET ([^[:space:]]*)[[:space:]]+(.*)$/ ) {
- if( defined $answers{ "$1" } ) {
- print $client "0 OK\n";
- print "Sent: 0 OK (known answer)\n" if $debug;
- }
- else {
- $answers{ "$1" } = "$2";
- print $client "0 OK \n";
- print "Sent: 0 OK (unknown answer)\n" if $debug;
- }
- }
- else {
- #elsif( /^(TITLE|SETTITLE|INPUT|CLEAR|GO|BEGINBLOCK|ENDBLOCK|DATA|GO|CAPB|PURGE).*$/ ) {
- print $client "0 OK\n";
- print "Sent: 0 OK\n" if $debug;
- #}
- #warn "No match found for $_\n";
- }
-}
-
-unlink "$PIPEFILE";
More information about the Fai-commit
mailing list