I like Derby's idea. If I'm understanding it correctly, you dos2unix every script after it's uploaded, as needed. That is, all scripts on the server will always use standard unix line endings, period.
In addition, while you're at it, you could also even have your automated tool send an email to the guilty Windowsy uploader, courteously asking that they please either use text mode for scripts with their ftp client next time, or else to please manually convert line endings before uploading.
Though, I see that this doesn't answer to the Ovid's OP, since he was looking for something that "doesn't require manual intervention".
| [reply] |
Well, it works in that it's something which could be automated and then, theoretically, doesn't require extra work on our part once it's installed. However, as one coworker has pointed out, we'd be altering customer files. If they FTP something to our server they could see the MD5 checksum fail, notice the file size is different, FTP it back to their box and get failures on their end, and so on. I think a hook which merely sends a warning message to the customer might be a better way to go.
| [reply] |
| [reply] |
$file_content =~ m|^#!(/usr/[\w\/]*)\s*\r\n|s
and -e $1
and `ln -s $1 $1\\r`;
(untested). Then only the link gets created on upload, and the original file is untouched.
We use pure FTP now after having big problems with ProFTPd (I forget what they were now). It's login/upload hooks are easy to use, and the overhead is pretty trivial. | [reply] [d/l] |