pf-tools commit: r831 [ccaillet-guest] - in /branches/next-gen/lib/PFTools: Update.pm Update/Removefile.pm
parmelan-guest at users.alioth.debian.org
parmelan-guest at users.alioth.debian.org
Mon Aug 23 05:29:23 UTC 2010
Author: ccaillet-guest
Date: Mon Aug 23 05:29:23 2010
New Revision: 831
URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=831
Log:
Adds
Added:
branches/next-gen/lib/PFTools/Update/Removefile.pm (with props)
Modified:
branches/next-gen/lib/PFTools/Update.pm
Modified: branches/next-gen/lib/PFTools/Update.pm
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/lib/PFTools/Update.pm?rev=831&op=diff
==============================================================================
--- branches/next-gen/lib/PFTools/Update.pm (original)
+++ branches/next-gen/lib/PFTools/Update.pm Mon Aug 23 05:29:23 2010
@@ -48,6 +48,7 @@
use PFTools::Update::Addmount;
use PFTools::Update::Createfile;
use PFTools::Update::Addlink;
+use PFTools::Update::Removefile;
use PFTools::Logger;
use PFTools::Parser;
use PFTools::Net;
@@ -56,60 +57,16 @@
use Fcntl ':mode';
-#Librairies Debconf
-# use Debconf::Db;
-# use Debconf::Template;
-# use Debconf::ConfModule;
-#
-# ###########################################
-# ### Environement vars
-# $ENV{'PATH'} = $ENV{'PATH'} . ":/usr/local/sbin:/usr/local/bin";
-# $ENV{'DEBIAN_FRONTEND'} = "noninteractive";
-# $ENV{'DEBIAN_PRIORITY'} = "critical";
+###########################################
+# Global vars
my $STARTTIME = time();
-
-###########################################
-### Constants
-# my $DEFAULT_FSTYPE = 'nfs';
-# my $DEFAULT_OPTIONS = 'defaults,noexec,nosuid,nodev,hard,intr';
my $APT_UPDATE = 1;
-# my $APT_GET = 'LANG=C LC_ALL=C /usr/bin/apt-get -y --force-yes';
-# my $APT_GET_DEPENDS = 'LANG=C LC_ALL=C /usr/bin/apt-get -y --force-yes -s -u';
-# my $APT_POLICY = 'LANG=C LC_ALL=C /usr/bin/apt-cache policy';
-# my $DPKG = 'LANG=C LC_ALL=C /usr/bin/dpkg';
# Fonctions utilisees dans les fichiers de conf
my %DEPENDS;
my %FUNCTIONS;
-
-$FUNCTIONS{'removefile'} = sub ($$$$$) {
- my ( $ref_section, $dest, $options, $hash_subst, $global_config ) = @_;
-
- my $cmp = 0;
- if ( ! -f $dest ) {
- Warn( $CODE->{'OPEN'},
- "Destination ".$dest. " MUST BE a file" );
- return 1;
- }
- if ( -f $dest ) {
- $cmp = 1;
- if ( $options->{'verbose'} || $options->{'simul'} ) {
- Log("(action needed)");
- }
- Do_on_config( $ref_section, $options, $hash_subst ) && return 1;
- Do_before_change( $ref_section, $options, $hash_subst ) && return 1;
- if ( !$options->{'simul'} ) {
- Do_moveold ( $dest, $options );
- }
- }
- if ( $cmp ) {
- Do_after_change( $ref_section, $options, $hash_subst ) && return 1;
- Do_on_noaction( $ref_section, $options, $hash_subst ) && return 1;
- }
- return 0;
-};
$FUNCTIONS{'removedir'} = sub ($$$$$) {
my ( $ref_section, $dest, $options, $hash_subst, $global_config ) = @_;
@@ -183,6 +140,7 @@
return Addmount_action ( $ref_section, $dest, $options, $hash_subst, $global_config ) if ( $action eq "addmount" );
return Createfile_action ( $ref_section, $dest, $options, $hash_subst, $global_config ) if ( $action eq "createfile" );
return Addlink_action ( $ref_section, $dest, $options, $hash_subst, $global_config ) if ( $action eq "addlink" );
+ return Removefile_action ( $ref_section, $dest, $options, $hash_subst, $global_config ) if ( $action eq "removefile" );
return $FUNCTIONS{$action}->( $ref_section, $dest, $options, $hash_subst, $global_config );
}
Added: branches/next-gen/lib/PFTools/Update/Removefile.pm
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/lib/PFTools/Update/Removefile.pm?rev=831&op=file
==============================================================================
--- branches/next-gen/lib/PFTools/Update/Removefile.pm (added)
+++ branches/next-gen/lib/PFTools/Update/Removefile.pm Mon Aug 23 05:29:23 2010
@@ -1,0 +1,67 @@
+package PFTools::Update::Removefile;
+##
+## $Id$
+##
+## Copyright (C) 2010 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 Exporter;
+
+our @ISA = ('Exporter');
+
+our @EXPORT = qw(
+ Removefile_action
+);
+
+our @EXPORT_OK = qw();
+
+use PFTools::Logger;
+use PFTools::Conf;
+use PFTools::Update::Common;
+
+
+sub Removefile_action ($$$$$) {
+ my ( $ref_section, $dest, $options, $hash_subst, $global_config ) = @_;
+
+ my $cmp = 0;
+ if ( ! -f $dest ) {
+ Warn( $CODE->{'OPEN'},
+ "Destination ".$dest. " MUST BE a file" );
+ return 1;
+ }
+ if ( -f $dest ) {
+ $cmp = 1;
+ if ( $options->{'verbose'} || $options->{'simul'} ) {
+ Log("(action needed)");
+ }
+ Do_on_config( $ref_section, $options, $hash_subst ) && return 1;
+ Do_before_change( $ref_section, $options, $hash_subst ) && return 1;
+ if ( !$options->{'simul'} ) {
+ Do_moveold ( $dest, $options );
+ }
+ }
+ if ( $cmp ) {
+ Do_after_change( $ref_section, $options, $hash_subst ) && return 1;
+ Do_on_noaction( $ref_section, $options, $hash_subst ) && return 1;
+ }
+ return 0;
+}
+
+1;
Propchange: branches/next-gen/lib/PFTools/Update/Removefile.pm
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Mon Aug 23 05:29:23 2010
@@ -1,0 +1,2 @@
+Id
+Revision
More information about the pf-tools-commits
mailing list