Clean up library path fiddling across all scripts
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
|
||||
* Use daterange for IP Subnets (same as IP Inventory)
|
||||
* Run daemons as target binary's owning user (supports run control)
|
||||
* Clean up library path fiddling across all scripts
|
||||
|
||||
[BUG FIXES]
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use FindBin;
|
||||
FindBin::again();
|
||||
use Path::Class 'dir';
|
||||
|
||||
@@ -1,11 +1,29 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
use FindBin;
|
||||
FindBin::again();
|
||||
use Path::Class 'dir';
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
our $home = ($ENV{NETDISCO_HOME} || $ENV{HOME});
|
||||
|
||||
BEGIN {
|
||||
# stuff useful locations into @INC
|
||||
use FindBin;
|
||||
FindBin::again();
|
||||
|
||||
# try to find a localenv if one isn't already in place.
|
||||
if (!exists $ENV{PERL_LOCAL_LIB_ROOT}) {
|
||||
use File::Spec;
|
||||
my $localenv = File::Spec->catfile($FindBin::RealBin, 'localenv');
|
||||
exec($localenv, $0, @ARGV) if -f $localenv;
|
||||
$localenv = File::Spec->catfile($home, 'perl5', 'bin', 'localenv');
|
||||
exec($localenv, $0, @ARGV) if -f $localenv;
|
||||
|
||||
die "Sorry, can't find libs required for App::Netdisco.\n"
|
||||
if !exists $ENV{PERLBREW_PERL};
|
||||
}
|
||||
|
||||
use Path::Class;
|
||||
|
||||
# stuff useful locations into @INC and $PATH
|
||||
unshift @INC,
|
||||
dir($FindBin::RealBin)->parent->subdir('lib')->stringify,
|
||||
dir($FindBin::RealBin, 'lib')->stringify;
|
||||
|
||||
@@ -27,6 +27,9 @@ BEGIN {
|
||||
unshift @INC,
|
||||
dir($FindBin::RealBin)->parent->subdir('lib')->stringify,
|
||||
dir($FindBin::RealBin, 'lib')->stringify;
|
||||
|
||||
use Config;
|
||||
$ENV{PATH} = $FindBin::RealBin . $Config{path_sep} . $ENV{PATH};
|
||||
}
|
||||
|
||||
use Daemon::Control;
|
||||
|
||||
@@ -14,10 +14,9 @@ BEGIN {
|
||||
dir($FindBin::RealBin, 'lib')->stringify;
|
||||
}
|
||||
|
||||
# for netdisco app config
|
||||
use App::Netdisco;
|
||||
use Dancer qw/:moose :script/;
|
||||
info "App::Netdisco version $App::Netdisco::VERSION daemon loaded.";
|
||||
warning sprintf "App::Netdisco %s backend", ($App::Netdisco::VERSION || 'HEAD');
|
||||
|
||||
# callbacks and local job queue management
|
||||
use App::Netdisco::Daemon::Queue ':all';
|
||||
|
||||
@@ -1,14 +1,35 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
use FindBin;
|
||||
FindBin::again();
|
||||
use Path::Class 'dir';
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
our $home = ($ENV{NETDISCO_HOME} || $ENV{HOME});
|
||||
|
||||
BEGIN {
|
||||
# stuff useful locations into @INC
|
||||
use FindBin;
|
||||
FindBin::again();
|
||||
|
||||
# try to find a localenv if one isn't already in place.
|
||||
if (!exists $ENV{PERL_LOCAL_LIB_ROOT}) {
|
||||
use File::Spec;
|
||||
my $localenv = File::Spec->catfile($FindBin::RealBin, 'localenv');
|
||||
exec($localenv, $0, @ARGV) if -f $localenv;
|
||||
$localenv = File::Spec->catfile($home, 'perl5', 'bin', 'localenv');
|
||||
exec($localenv, $0, @ARGV) if -f $localenv;
|
||||
|
||||
die "Sorry, can't find libs required for App::Netdisco.\n"
|
||||
if !exists $ENV{PERLBREW_PERL};
|
||||
}
|
||||
|
||||
use Path::Class;
|
||||
|
||||
# stuff useful locations into @INC and $PATH
|
||||
unshift @INC,
|
||||
dir($FindBin::RealBin)->parent->subdir('lib')->stringify,
|
||||
dir($FindBin::RealBin, 'lib')->stringify;
|
||||
|
||||
use Config;
|
||||
$ENV{PATH} = $FindBin::RealBin . $Config{path_sep} . $ENV{PATH};
|
||||
}
|
||||
|
||||
use App::Netdisco;
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
our $home;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
our $home = ($ENV{NETDISCO_HOME} || $ENV{HOME});
|
||||
|
||||
BEGIN {
|
||||
# try really hard to find a localenv if one isn't already in place.
|
||||
$home = ($ENV{NETDISCO_HOME} || $ENV{HOME});
|
||||
use FindBin;
|
||||
FindBin::again();
|
||||
|
||||
# try to find a localenv if one isn't already in place.
|
||||
if (!exists $ENV{PERL_LOCAL_LIB_ROOT}) {
|
||||
use File::Spec;
|
||||
my $localenv = File::Spec->catfile($FindBin::RealBin, 'localenv');
|
||||
@@ -16,22 +20,16 @@ BEGIN {
|
||||
die "Sorry, can't find libs required for App::Netdisco.\n"
|
||||
if !exists $ENV{PERLBREW_PERL};
|
||||
}
|
||||
}
|
||||
|
||||
use FindBin;
|
||||
FindBin::again();
|
||||
use Path::Class;
|
||||
use Path::Class;
|
||||
|
||||
BEGIN {
|
||||
# stuff useful locations into @INC and $PATH
|
||||
my $location = $FindBin::RealBin;
|
||||
|
||||
unshift @INC,
|
||||
dir($location)->parent->subdir('lib')->stringify,
|
||||
dir($location, 'lib')->stringify;
|
||||
dir($FindBin::RealBin)->parent->subdir('lib')->stringify,
|
||||
dir($FindBin::RealBin, 'lib')->stringify;
|
||||
|
||||
use Config;
|
||||
$ENV{PATH} = $location . $Config{path_sep} . $ENV{PATH};
|
||||
$ENV{PATH} = $FindBin::RealBin . $Config{path_sep} . $ENV{PATH};
|
||||
}
|
||||
|
||||
use App::Netdisco;
|
||||
@@ -39,7 +37,7 @@ use Dancer ':script';
|
||||
use Dancer::Plugin::DBIC 'schema';
|
||||
use Dancer::Plugin::Passphrase;
|
||||
|
||||
info "App::Netdisco version $App::Netdisco::VERSION loaded.";
|
||||
info "App::Netdisco $App::Netdisco::VERSION loaded.";
|
||||
|
||||
use 5.010_000;
|
||||
use Term::UI;
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
our $home;
|
||||
our $home = ($ENV{NETDISCO_HOME} || $ENV{HOME});
|
||||
|
||||
BEGIN {
|
||||
# try to find a localenv if one isn't already in place.
|
||||
$home = ($ENV{NETDISCO_HOME} || $ENV{HOME});
|
||||
use FindBin;
|
||||
FindBin::again();
|
||||
|
||||
# try to find a localenv if one isn't already in place.
|
||||
if (!exists $ENV{PERL_LOCAL_LIB_ROOT}) {
|
||||
use File::Spec;
|
||||
my $localenv = File::Spec->catfile($FindBin::RealBin, 'localenv');
|
||||
@@ -16,14 +17,10 @@ BEGIN {
|
||||
die "Sorry, can't find libs required for App::Netdisco.\n"
|
||||
if !exists $ENV{PERLBREW_PERL};
|
||||
}
|
||||
}
|
||||
|
||||
use FindBin;
|
||||
FindBin::again();
|
||||
use Path::Class 'dir';
|
||||
use Path::Class;
|
||||
|
||||
BEGIN {
|
||||
# stuff useful locations into @INC
|
||||
# stuff useful locations into @INC and $PATH
|
||||
unshift @INC,
|
||||
dir($FindBin::RealBin)->parent->subdir('lib')->stringify,
|
||||
dir($FindBin::RealBin, 'lib')->stringify;
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
our $home;
|
||||
our $home = ($ENV{NETDISCO_HOME} || $ENV{HOME});
|
||||
|
||||
BEGIN {
|
||||
# try really hard to find a localenv if one isn't already in place.
|
||||
$home = ($ENV{NETDISCO_HOME} || $ENV{HOME});
|
||||
use FindBin;
|
||||
FindBin::again();
|
||||
|
||||
# try to find a localenv if one isn't already in place.
|
||||
if (!exists $ENV{PERL_LOCAL_LIB_ROOT}) {
|
||||
use File::Spec;
|
||||
my $localenv = File::Spec->catfile($FindBin::RealBin, 'localenv');
|
||||
@@ -16,22 +17,16 @@ BEGIN {
|
||||
die "Sorry, can't find libs required for App::Netdisco.\n"
|
||||
if !exists $ENV{PERLBREW_PERL};
|
||||
}
|
||||
}
|
||||
|
||||
use FindBin;
|
||||
FindBin::again();
|
||||
use Path::Class;
|
||||
use Path::Class;
|
||||
|
||||
BEGIN {
|
||||
# stuff useful locations into @INC and $PATH
|
||||
my $location = $FindBin::RealBin;
|
||||
|
||||
unshift @INC,
|
||||
dir($location)->parent->subdir('lib')->stringify,
|
||||
dir($location, 'lib')->stringify;
|
||||
dir($FindBin::RealBin)->parent->subdir('lib')->stringify,
|
||||
dir($FindBin::RealBin, 'lib')->stringify;
|
||||
|
||||
use Config;
|
||||
$ENV{PATH} = $location . $Config{path_sep} . $ENV{PATH};
|
||||
$ENV{PATH} = $FindBin::RealBin . $Config{path_sep} . $ENV{PATH};
|
||||
}
|
||||
|
||||
use App::Netdisco;
|
||||
|
||||
@@ -27,6 +27,9 @@ BEGIN {
|
||||
unshift @INC,
|
||||
dir($FindBin::RealBin)->parent->subdir('lib')->stringify,
|
||||
dir($FindBin::RealBin, 'lib')->stringify;
|
||||
|
||||
use Config;
|
||||
$ENV{PATH} = $FindBin::RealBin . $Config{path_sep} . $ENV{PATH};
|
||||
}
|
||||
|
||||
use Daemon::Control;
|
||||
|
||||
@@ -22,7 +22,7 @@ BEGIN {
|
||||
|
||||
use App::Netdisco;
|
||||
use Dancer;
|
||||
debug sprintf "App::Netdisco %s", ($App::Netdisco::VERSION || 'HEAD');
|
||||
warning sprintf "App::Netdisco %s web", ($App::Netdisco::VERSION || 'HEAD');
|
||||
|
||||
my $home = ($ENV{NETDISCO_HOME} || $ENV{HOME});
|
||||
set(session_dir => dir($home, 'netdisco-web-sessions')->stringify);
|
||||
|
||||
Reference in New Issue
Block a user