List Info

Thread: sa-update changes to load-sa-rules.pl




sa-update changes to load-sa-rules.pl
country flaguser name
United States
2008-01-18 15:19:57
this will work on my computer, I am sure it will not work on
yours...
these changes to load-sa-rules.pl make it work for me and
grab the sa-update
rules in the correct order.

diff -uw load-sa-rules.pl 2load-sa-rules.pl
--- load-sa-rules.pl    2008-01-14 13:06:02.000000000 -0800
+++ 2load-sa-rules.pl   2008-01-18 13:03:17.000000000 -0800
 -97,6
+97,11 
         "/etc/spamassassin",
     );
 
+    # SpamAssassin sa_update directory ($saupdate_dir)
+    my saupdate_path = (
+       
"/var/db/spamassassin/%%VERSION%%/updates_spamassassin_
org",
+    );
+
     # SpamAssassin user_prefs directory ($user_rules_dir)
     my user_rules_path = (
         "/var/amavisd/.spamassassin",
 -131,6
+136,7 
     GetOptions("local-cf-dir=s" =>
$local_cf_dir,         #
--local-cf-dir=<directory>
                "system-rules-dir=s" =>
$system_rules_dir, #
--system-rules-dir=<directory>
                "user-rules-dir=s" =>
$user_rules_dir,     #
--user-rules-dir=<directory>
+               "saupdate-dir=s" =>
$saupdate_dir,
                "help" => $help,              
            # --help
                "debug" => $debug,            
            # --debug
                "quiet" => $quiet);           
            # --quiet
 -177,6
+183,15 
         fatal("Couldn't find SpamAssassin rules
directory (set
$system_rules_dir in maia.conf)")
             if (!defined($system_rules_dir));
     }
+    if (defined($saupdate_dir)) {
+        $saupdate_dir = expand_macros($sa_version,
$sa_prefix,
$saupdate_dir);
+        fatal(sprintf("Directory %s does not
exist!", $saupdate_dir))
+            if (!-e $saupdate_dir);
+    } else {
+        $saupdate_dir = first_existing_path($sa_version,
$sa_prefix,
saupdate_path);
+        fatal("Couldn't find Saupdate rules directory
(set $saupdate_dir
in maia.conf)")
+            if (!defined($saupdate_dir));
+    }
     if (defined($user_rules_dir)) {
         $user_rules_dir = expand_macros($sa_version,
$sa_prefix,
$user_rules_dir);
         if (!-e $user_rules_dir) {
 -192,6
+207,7 
     if ($debug) {
         output(sprintf("SpamAssassin core rules
directory = %s",
$system_rules_dir));
         output(sprintf("SpamAssassin local.cf
directory = %s",
$local_cf_dir));
+       output(sprintf("SpamAssassin saupdate directory
= %s",
$saupdate_dir));
         output(sprintf("SpamAssassin user_prefs
directory = %s",
             (defined($user_rules_dir) ? $user_rules_dir :
"(not found)")));
     }
 -227,6
+243,9 
     ($added, $skipped) = scan_rules_directory($dbh,
$local_cf_dir, $debug,
0);
     $rules_added += $added;
     $rules_skipped += $skipped;
+    ($added, $skipped) = scan_rules_directory($dbh,
$saupdate_dir, $debug,
0);
+    $rules_added += $added;
+    $rules_skipped += $skipped;
     if (defined($user_rules_dir)) {
         $added = 0;
         $skipped = 0;

Use it or not, either way, enjoy.

Dave Overton, Owner
SYIX.COM

davesyix.com
(530) 755-1751 x101
Fax (530) 751-8871
800-988-SYIX

_______________________________________________
Maia-users mailing list
Maia-usersrenaissoft.com
http://www.renaissoft.com/mailman/listinfo/maia-users

Re: sa-update changes to load-sa-rules.pl
country flaguser name
Canada
2008-01-18 16:16:51
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dave Overton wrote:
> this will work on my computer, I am sure it will not
work on yours...
> these changes to load-sa-rules.pl make it work for me
and grab the sa-update
> rules in the correct order.
> 

[snip]

> +    # SpamAssassin sa_update directory
($saupdate_dir)
> +    my saupdate_path = (
> +       
"/var/db/spamassassin/%%VERSION%%/updates_spamassassin_
org",
> +    );
> +

There was no need to go to all that trouble.  All you needed
to do was
add your path to the default_rules_path() list, i.e. turn
this:

  # SpamAssassin core rules directory ($system_rules_dir)
  my default_rules_path = (
      "/var/lib/spamassassin/%%VERSION%%",
      "/usr/share/spamassassin",
      "%%PREFIX%%/share/spamassassin",
      "/usr/local/share/spamassassin",
  );

into this:

  # SpamAssassin core rules directory ($system_rules_dir)
  my default_rules_path = (
      "/var/db/spamassassin/%%VERSION%%",
      "/var/lib/spamassassin/%%VERSION%%",
      "/usr/share/spamassassin",
      "%%PREFIX%%/share/spamassassin",
      "/usr/local/share/spamassassin",
  );

This is because the sa-update directory effectively replaces
the system
rules directory if it's found.  There is also no need to
specify all the
way down to the "updates_spamassassin_org" level,
since the script will
automatically recurse through all subdirectories below the
specified
level.  This becomes important once you start subscribing to
additional
sa-update channels (e.g. SaneSecurity, etc.).

This change will work fine for everyone--it's harmless if
the path
doesn't exist; things just fall through to the next path in
the list.

- --
Robert LeBlanc <rjlrenaissoft.com>
Renaissoft, Inc.
Maia Mailguard <http://www.maiamail
guard.com/>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


iD8DBQFHkSVTGmqOER2NHewRAvZwAKCLBVm1CsSFmO/FLnSbSh5X47v0UACe
Ln5a
HZ2qWHWXYfJ2s+403HICViQ=
=E2UF
-----END PGP SIGNATURE-----
_______________________________________________
Maia-users mailing list
Maia-usersrenaissoft.com
http://www.renaissoft.com/mailman/listinfo/maia-users

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )