You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2005/12/17 04:39:41 UTC

svn commit: r357286 - /spamassassin/trunk/sa-update.raw

Author: jm
Date: Fri Dec 16 19:39:39 2005
New Revision: 357286

URL: http://svn.apache.org/viewcvs?rev=357286&view=rev
Log:
get sa-update and Mail::SA to agree on the location of the update dir: /var/lib/spamassassin/3.002000

Modified:
    spamassassin/trunk/sa-update.raw

Modified: spamassassin/trunk/sa-update.raw
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/sa-update.raw?rev=357286&r1=357285&r2=357286&view=diff
==============================================================================
--- spamassassin/trunk/sa-update.raw (original)
+++ spamassassin/trunk/sa-update.raw Fri Dec 16 19:39:39 2005
@@ -22,10 +22,12 @@
 my $PREFIX          = '@@PREFIX@@';             # substituted at 'make' time
 my $DEF_RULES_DIR   = '@@DEF_RULES_DIR@@';      # substituted at 'make' time
 my $LOCAL_RULES_DIR = '@@LOCAL_RULES_DIR@@';    # substituted at 'make' time
+my $LOCAL_STATE_DIR = '@@LOCAL_STATE_DIR@@';    # substituted at 'make' time
 use lib '@@INSTALLSITELIB@@';                   # substituted at 'make' time
 
 # Standard perl modules
 use File::Spec;
+use File::Path;
 use Getopt::Long;
 use Pod::Usage;
 use strict;
@@ -101,7 +103,6 @@
 my %opt = ();
 @{$opt{'gpgkey'}} = ();
 @{$opt{'channel'}} = ();
-my $site_rules_path;
 my $GPG_ENABLED;
 
 Getopt::Long::Configure(
@@ -117,7 +118,7 @@
 
   'gpgkeyfile=s'			=> \$opt{'gpgkeyfile'},
   'channelfile=s'			=> \$opt{'channelfile'},
-  'updatedir=s'				=> \$site_rules_path,
+  'updatedir=s'				=> \$opt{'updatedir'},
   'usegpg'				=> \$GPG_ENABLED,
 ) or print_usage_and_exit();
 
@@ -165,10 +166,12 @@
   LOCAL_RULES_DIR => $LOCAL_RULES_DIR,
   LOCAL_STATE_DIR => $LOCAL_STATE_DIR,
 });
-$site_rules_path ||= $SA->first_existing_path(@Mail::SpamAssassin::site_rules_path);
+
+# $opt{'updatedir'} ||= $SA->first_existing_path(@Mail::SpamAssassin::site_rules_path);
+$opt{'updatedir'} = $SA->sed_path('__local_state_dir__/spamassassin/__version__');
 
 dbg("generic: sa-update version $VERSION");
-dbg("generic: using update directory: $site_rules_path");
+dbg("generic: using update directory: $opt{'updatedir'}");
 
 # doesn't really display useful things for this script, but we do want
 # a module/version listing, etc. sa-update may be used for older versions
@@ -269,7 +272,7 @@
   my $nicechannel = $channel;
   $nicechannel =~ tr/A-Za-z0-9-/_/cs;
 
-  my $UPDDir = "$site_rules_path/$nicechannel";
+  my $UPDDir = "$opt{'updatedir'}/$nicechannel";
   my $CFFile = "$UPDDir.cf";
 
   dbg("channel: update directory $UPDDir");
@@ -336,7 +339,7 @@
 
     unless (-d $UPDDir) {
       dbg("channel: creating $UPDDir");
-      mkdir $UPDDir || die "fatal: can't create $UPDDir: $!\n";
+      mkpath([$UPDDir], 0, 0777) or die "fatal: can't create $UPDDir: $!\n";
     }
 
     unless (open(MIR, ">$UPDDir/MIRRORED.BY")) {
@@ -754,9 +757,11 @@
 
 =item B<updatedir>
 
-Typically sa-update will use whatever the default site rules directory
-SpamAssassin uses.  (usually /etc/mail/spamassassin)  If the updates should be
-stored in another location, specify it here.
+By default, C<sa-update> will use the system-wide rules update directory:
+
+  @@LOCAL_STATE_DIR@@/spamassassin/@@VERSION@@
+
+If the updates should be stored in another location, specify it here.
 
 =item B<channel>