← Back to team overview

mylvmbackup-discuss team mailing list archive

Re: patches for backuptype=none and error handling

 

On Thu, 2010-12-16 at 12:54 +0100, Kjetil Torgrim Homme wrote:
> hi, I'd like to suggest the attached patch for inclusion in mylvmbackup.
> it is relative to 0.13.  it does the following (from top to bottom):
> 
>       * make sure $PATH includes sbin
>       * make sure $HOME is set (not always the case when launched
>         (indirectly) from init, in my case, from Bacula)

this was not sufficient, I've seen instances where $HOME is defined, but
set to "/" rather than "/root".  a better patch would be to add the
following:

$ENV{PATH} .= ":/usr/sbin:/usr/bin:/sbin:/bin";
if (!defined $ENV{HOME} || $ENV{HOME} eq "/") {
  $ENV{HOME} = (getpwuid($<))[7];
}

this will still allow a sysadmin to use a custom $HOME for the process.

> --- mylvmbackup.pl.in	2009-09-05 15:44:09.000000000 +0200
> +++ /srv/nfs/ms/home/kjetilho/svn/puppet/modules/mysql/files/mylvmbackup/mylvmbackup.pl	2010-12-14 17:12:44.979678793 +0100
> @@ -37,6 +37,9 @@
>  my $configfile = "/etc/mylvmbackup.conf";
>  my $configfile2 = "";
>  
> +$ENV{PATH} .= ":/usr/sbin:/usr/bin:/sbin:/bin";
> +$ENV{HOME} ||= (getpwuid($<))[7];
> +
>  my $TMP= ($ENV{TMPDIR} || "/tmp");
>  
>  my $backupdir;

-- 
Kjetil T. Homme
Redpill Linpro - Changing the game





Follow ups

References