← Back to team overview

mylvmbackup-discuss team mailing list archive

Password from environment patch



I just wanted to throw in my patch for mylvmbackup. I didn't want to put
my MySQL root password on the command line and I didn't want to start
using a configuration file for this single option either. I rather like
the way duplicity does it, reading passwords from an environment
variable if set. So I took the mylvmbackup source code and hacken in a
single line - this is probably the first line ever that I'm speaking
Perl. I didn't take the hassle to create a patch, just add the following
line right after the GetOptions() call in the load_args function. For me
(0.13 on Ubuntu) this is line 395.

   $password = $ENV{"PASSWORD"} if ($password eq "");

If no password is set after parsing the command line arguments, it will
be read from the environment. I didn't test what happens when no
password is set on the command line *and* in the environment though as
it makes no sense to me.

Call it like so:

   PASSWORD=123 mylvmbackup --options ...

I'd be happy if this patch is helpful to anybody. Maybe it gets
integrated in the main version so I don't have to modify mine.

Yves Goergen - mail & jabber im: yves@xxxxxxxxxxxxxxx
http://unclassified.de - Web-Labor, HD-Fotogalerie, Webhosting
Diese Nachricht ist standardkonform mit OpenPGP digital signiert.

Attachment: signature.asc
Description: OpenPGP digital signature

Follow ups