From 9b0c512de8ff652fd5d14530487045455edafcce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A9ri=20Le=20Bouder?= Date: Mon, 31 May 2010 10:30:22 +0200 Subject: [PATCH] add --disable-perllib-envvar This varaible allow the user to ignore PERLLIB and PERL5LIB envvar --- Changes | 3 ++- fusioninventory-agent | 14 ++++++++++++++ lib/FusionInventory/Agent/Config.pm | 5 +++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Changes b/Changes index 92c7ddaa97..1d0e22e1dc 100644 --- a/Changes +++ b/Changes @@ -61,7 +61,8 @@ Revision history for FusionInventory::Agent * HP-UX: HP Management Processor (MP) (Management Interface of HP Integrity servers) (Amir PAKDEL) * Collect Batteries information - + * Add --disable-perllib-envvar to be able to ignore PERLLIB and + PERL5LIB envvar 2.0.6 * Fix DRIVES/CREATEDATE for ext* filesystem diff --git a/fusioninventory-agent b/fusioninventory-agent index 2224463cd4..12ec6d0bff 100755 --- a/fusioninventory-agent +++ b/fusioninventory-agent @@ -27,6 +27,9 @@ foreach (@ARGV) { if (/^--devlib$/) { print "[info] --devlib are found, Developer mode enabled\n"; eval "use lib 'lib';"; + } elsif (/^--disable-perllib-envvar$/) { + $ENV{PERL5LIB}=undef; + $ENV{PERLLIB}=undef; } } @@ -172,6 +175,9 @@ on the system. Instead it will scan the ./lib directory. It may also be useful if you don't want to install the agent on your system. +This option can only be used as command line argument. It will be +ignored if you set it in a config file or in Windows registry. + =item B<--delaytime=SECONDS_TO_WAIT> This option defaults to waiting a random() time between 0 and 3600 before @@ -181,6 +187,14 @@ it's random setting. Useful for pre-setting a deployed agent's initial start time (so you don't jam the server all at once, but don't have to wait an hour to make sure the deployment worked). +=item B<--disable-perllib-envvar> + +Do not use PERL5LIB and PERLLIB environment variable to find Perl library +path. + +This option can only be used as command line argument. It will be +ignored if you set it in a config file or in Windows registry. + =item B<-f>, B<--force> The agent ask first the server if it should send an inventoroy of the diff --git a/lib/FusionInventory/Agent/Config.pm b/lib/FusionInventory/Agent/Config.pm index 3f40f2c17a..f1836e1a1e 100644 --- a/lib/FusionInventory/Agent/Config.pm +++ b/lib/FusionInventory/Agent/Config.pm @@ -17,6 +17,7 @@ my $default = { 'daemon-no-fork' => 0, 'debug' => 0, 'devlib' => 0, + 'disable-perllib-envvar' => 0, 'force' => 0, 'help' => 0, 'html-dir' => '', @@ -158,6 +159,7 @@ sub loadUserParams { "D|daemon-no-fork"=> \$config->{'daemon-no-fork'}, "debug" => \$config->{debug}, "devlib" => \$config->{devlib}, + "disable-perllib-envvar" => \$config->{'disable-perllib-envvar'}, "f|force" => \$config->{force}, "h|help" => \$config->{help}, "html-dir=s" => \$config->{'html-dir'}, @@ -231,6 +233,9 @@ sub help { print STDERR "\t --delaytime set a max delay time (in second) if". " no PROLOG_FREQ is set (".$config->{delaytime}.")\n"; print STDERR "\t --devlib search for Backend mod in ./lib only (".$config->{devlib}.")\n"; + print STDERR "\t --disable-perllib-envvar do not load Perl lib ". + "from PERL5LIB and PERLIB environment variable ". + " (".$config->{'disable-perllib-envvar'}.")\n"; print STDERR "\t-f --force always send data to server (Don't ask before) (".$config->{force}.")\n"; print STDERR "\t --html-dir alternative directory where the ". "static HTML are stored\n";