OH, well. I still don't know if there's an easier or better way to do
this, but I have a solution. I'll post it for anyone else with the
same issue. Corrections and simplifications are very welcome.
My local files permissions are set 644, and they remain set 644 when I
upload them using the put command. I don't think using mirror -R would
be practical for uploading single files. There doesn't appear to be
any setting for controlling permissions of files uploaded.
Solution/Hack:
1. Write a script that assembles a series of put & chmod commands.
2. Make an alias that runs that script every time you put a file.
Because my script's functionality is still pretty limited, i've made
an alias "myput", so the "put" command will still work the same as
ever. Otherwise I'd be without a -O option, for example.
So now I can do:
myput thisfile.html thatfile.html
and those two files will be put in the current dir and chmod'd to be
writable by group.
My alias, so you know what you have to do:
alias myput source -e ! php ./Users/my_user/Documents/lftp_put_mod1.php
Add that to your .lftprc file so it's always available.
My rudimentary script, in PHP for no good reason:
#! /usr/bin/php
<?php
// This script assumes you're already in the directory
// and you're putting a list of files into the _one_ directory!
$sep = " ";
// Remove the script name, the first argument, from argv
$argv = array_slice($argv,1);
foreach ($argv as $local_path) {
// Put the filename in $my_file[1] for use on Web server
preg_match("@([^/]+)$@",$local_path,$my_file);
// Append to the file list
$local_file_list .= $local_path . $sep;
$remote_file_list .= $my_file[1] . $sep;
$my_command = "put $local_file_list; chmod g+w $remote_file_list";
}
echo $my_command . "\n";
/* In lftp, you should run this script as:
source -e ! php thiscript.php
The ! will run this script
The "source -e" will use the output as commands to lftp
*/
?>