my $NAME = 'upload-ftp-v1.1.pl';
my $VERSION = '1.1'; # This is the protocol version
-my $DATE = '2007/04/06 15:56:44';
+my $DATE = '2007/11/13 14:25:44';
my $AUTHOR = "the Free Software Foundation <sysadmin\@gnu.org>";
-my $COPYRIGHT = "2003-2006";
+my $COPYRIGHT = "2003-2007";
my $LICENSE = "GPL - http://www.fsf.org/licenses/gpl.txt";
my $URL = "http://www.gnu.org/prep/maintain/html_node/Automated-FTP-Uploads.html";
# have any directory.
chdir ($incoming_dir) || ftp_die("FATAL: chdir($incoming_dir) failed: $!");
my @incoming = &scan_incoming ();
+
# we've moved the files to work on to a new directory.
chdir ($incoming_tmp) || ftp_die("FATAL: chdir($incoming_tmp) failed: $!");
unlink("$destdir/$1") || &fatal("removal of symlink $1 failed: $!",1);
ftp_syslog('info', "($log_style) removed symlink $destdir/$1");
} elsif ($key =~ /^archive-(.*)/) {
+ # We now also allow archiving entire directories
+ archive($destdir, $originfo{directory}, "$1.sig") if (! -d "$destdir/$1");
archive($destdir, $originfo{directory}, $1);
- archive($destdir, $originfo{directory}, "$1.sig")
}
}
sub mail {
my ($msg) = shift;
my ($send_to_user) = shift;
- my ($subject) = shift;
- $subject ||= '';
+ my ($subject) = shift;
+ $subject ||= '';
my @email_list = ($email_always);
- # Some messages should be sent to the user, some should not
+ # Some messages should be sent to the user, some should not
push (@email_list, @{$info{email}}) if (defined $info{email} && $send_to_user);
# print STDERR "final emails: @email_list\n";
# return @_;
-
+
my $smtp = Net::SMTP->new ("127.0.0.1");
ftp_die("FATAL: SMTP connection failed") unless $smtp;
$smtp->mail ("ftp-upload-script\@gnu.org");
$smtp->recipient (@email_list, { SkipBad => 1});
+ ftp_syslog('warning', "Sending email to @email_list");
+ ftp_syslog('warning', "Subject is $subject");
+ ftp_syslog('warning', "message: $msg");
+
$smtp->data ();
$smtp->datasend ("To: " . join (", ", @email_list) . "\n");
$smtp->datasend ("From: ftp-upload-script\@gnu.org\n");