forked from OCSInventory-NG/UnixAgent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.PL
executable file
·166 lines (135 loc) · 4.75 KB
/
Makefile.PL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
BEGIN {
# Avoid installation issue introduced by perl 5.24.1 removing '.' path from
# @INC to avoid possible module injection in normal running perl scripts
push @INC, '.' if ( $^V && $^V gt 'v5.24' );
}
use inc::Module::Install;
use English qw(-no_match_vars);
use Config;
require 'lib/Ocsinventory/Agent/Config.pm';
# Hack to be able to run a post install script
sub MY::postamble
{
my $re;
$re = '
install :: all pure_install doc_install
$(NOECHO) $(NOOP)';
$re .= "\n\t[ ! -f run-postinst ] || $^X postinst.pl\n";
return $re;
}
my $version = $Ocsinventory::Agent::Config::VERSION;
name 'Ocsinventory-Unix-Agent';
include 'Module::AutoInstall';
abstract 'OCS Inventory unified Agent for UNIX, Linux and MacOSX';
license 'gpl';
repository 'https://github.com/OCSInventory-NG/UnixAgent/';
version $version;
perl_version '5.006';
authors 'OCS Inventory Team';
# mandatory dependencies
requires 'Digest::MD5' => undef;
requires 'XML::Simple' => undef;
requires 'LWP' => '5.8';
requires 'File::Temp' => undef;
requires 'Net::IP' => undef;
recommends 'IO::Socket::SSL' => undef;
recommends 'Compress::Zlib' => undef;
recommends 'Proc::Daemon' => undef;
recommends 'Proc::PID::File' => undef;
# test dependencies
test_requires 'IO::Socket::SSL' => '0';
test_requires 'Net::SNMP' => '0';
test_requires 'LWP::Protocol::https' => '0';
# deployement or https communication
recommends 'Crypt::SSLeay' => undef;
recommends 'LWP::Protocol::https' => undef;
# inventory
recommends 'Net::CUPS' => undef;
recommends 'Parse::EDID' => undef;
# network
recommends 'Net::SNMP' => undef;
recommends 'Net::Netmask' => undef;
recommends 'Net::Ping' => undef;
recommends 'Nmap::Parser' => undef;
resources
bugtracker => 'https://github.com/OCSinventory-NG/Unixagent/issues',
homepage => 'http://www.ocsinventory-ng.org',
IRC => 'irc://irc.freenode.net/#ocsinventory-ng',
repository => 'https://github.com/OCSinventory-NG/Unixagent';
install_script 'ocsinventory-agent';
# We want a release bundled with the needed dependency to be able to
# prepare a standalone binary with PAR::Packer
if ($ENV{OCS_BUNDLE_RELEASE}) {
foreach my $module (qw/Archive::Zip HTML::Parser LWP URI XML::NamespaceSupport Net::IP Net::Netmask HTML::Tagset Proc::Daemon Module::ScanDeps PAR::Packer AutoLoader PAR PAR::Dist File::Remove YAML::Tiny Getopt::ArgvFile ExtUtils::Install ExtUtils::ParseXS XML::SAX XML::Simple/) {
bundle $module;
requires $module;
}
}
#Ugly hack to include ipdiscover binary compilation and install for Linux systems
if ($^O =~ /^linux$/i && can_cc()) {
my $cc=$Config::Config{cc};
my $ld=$Config::Config{ldflags};
my $cf=$Config::Config{ccflags};
my $op=$Config::Config{optimize};
system("$cc $cf $ld $op resources/ipdiscover/ipdiscover.c -o ipdiscover");
if (-f 'ipdiscover') {
install_script 'ipdiscover';
}
}
if (defined ($ENV{PERL_AUTOINSTALL}) || defined ($ENV{PERL_AUTOINSTALL})) {
unlink 'run-postinst';
} else {
open POSTINST, '>run-postinst' or die $!;
close POSTINST;
}
if (!can_use('Compress::Zlib')) {
print "Please install Compress::Zlib if you use an OCS server prior 1.02.\n";
}
if (!can_use('Net::SSLeay')) {
print "Please install Net::SSLeay if you want to use the software deployment.\n";
}
if (!can_run('ipdiscover') && !can_run('nmap')) {
print "Please install nmap ";
print "or ipdiscover " if $^O =~ /^linux$/i;
print "if you want to use the network ".
"discover feature.\n";
}
if (!can_use('Net::IP')) {
print "Net::IP is strongly recommended since it's required to retrieve "
."network information\n";
}
if (!can_use('Net::Netmask')) {
print "Net::Netmask is strongly recommended since it's required to retrieve "
."snmp information\n";
}
if (!can_use('Proc::Daemon') || !can_use('Proc::PID::File')) {
print "Please install Proc::Daemon and Proc::PID::File if you ".
"want to use the daemon mode.\n";
}
my $archname;
eval { # config_re is not available on Perl 5.6
my @t = Config::config_re('archname');
$archname = $t[0];
};
if ($^O =~ /(linux|bsd)/i && (!$archname ||$archname =~ /(i[3456x]86|x86_64|amd64)/i)) {
foreach (qw/dmidecode lspci/) {
if (!can_run($_)) {
print "\n";
print "[WARNING] $_ is needed if you want a complete inventory on x86 and AMD64/x86_64.\n";
print "\n";
}
}
}
if ($^O =~ /^darwin$/ && !can_use('Mac::SysProfile')) {
print "\n";
print "[WARNING] Mac::SysProfile are needed on MacOS to detect most of the device information.\n";
print "\n";
requires 'Mac::SysProfile' => undef;
}
# memconf is needed by Solaris backend module
if ($^O =~ /^solaris$/i) {
install_script 'memconf';
}
#for i in inc/BUNDLES/* ; do rm -rf `basename $i` ;done`
#auto_install;
WriteAll;