source: ocsinventory-agent/trunk/fuentes/Makefile.PL

Last change on this file was 468, checked in by mabarracus, 4 years ago

Copyt trusty code

File size: 3.5 KB
Line 
1
2use inc::Module::Install;
3
4# Hack to be able to run a post install script
5sub MY::postamble
6{
7
8        my $re;
9
10        $re = '
11install :: all pure_install doc_install
12        $(NOECHO) $(NOOP)';
13
14        $re .= "\n\t[ ! -f run-postinst ] || $^X postinst.pl\n";
15
16    return $re;
17}
18
19require 'lib/Ocsinventory/Agent/Config.pm';
20use Config;
21
22my $version = $Ocsinventory::Agent::Config::VERSION; 
23if (-d '.bzr') {
24    chomp( my $bzrRev = `bzr revno`);
25    $version .= "~bzr".$bzrRev;
26}
27
28name 'Ocsinventory-Unix-Agent';
29include 'Module::AutoInstall';
30abstract 'Ocs-Inventory unified Agent for UNIX, Linux and MacOSX';
31license 'gpl';
32version $version;
33perl_version '5.006';
34requires 'Digest::MD5' => undef;
35requires 'XML::Simple' => undef;
36requires 'LWP' => undef;
37requires 'File::Temp' => undef;
38recommends 'Net::IP' => undef;
39recommends 'Compress::Zlib';
40recommends 'Proc::Daemon' => undef;
41recommends 'Proc::PID::File' => undef;
42
43install_script  'ocsinventory-agent';
44
45
46# We want a release bundled with the needed dependency to be able to
47# prepare a standalone binary with PAR::Packer
48if ($ENV{OCS_BUNDLE_RELEASE}) {
49  foreach my $module (qw/Archive::Zip HTML::Parser LWP URI XML::NamespaceSupport Net::IP 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/) {
50    bundle $module;
51    requires $module;
52  }
53}
54
55#Ugly hack to include ipdiscover binary compilation and install fo Linux systems
56if ($^O =~ /^linux$/i && can_cc()) {
57    my $cc=$Config::Config{cc};
58    system("$cc resources/ipdiscover/ipdiscover.c -o ipdiscover");
59    if (-f 'ipdiscover') {
60      install_script 'ipdiscover';
61    }
62}
63
64
65if (defined ($ENV{PERL_AUTOINSTALL}) || defined ($ENV{PERL_AUTOINSTALL})) {
66    unlink 'run-postinst';
67} else {
68    open POSTINST, '>run-postinst' or die $!;
69    close POSTINST;
70}
71
72
73if (!can_use('Compress::Zlib')) {
74    print "Please install Compress::Zlib if you use an OCS server prior 1.02.\n";
75}
76
77if (!can_use('Crypt::SSLeay')) {
78    print "Please install Crypt::SSLeay if you want to use SSL.\n";
79}
80
81if (!can_use('Net::SSLeay')) {
82    print "Please install Net::SSLeay if you want to use the software deployment.\n";
83}
84
85
86if (!can_run('ipdiscover') && !can_run('nmap')) {
87    print "Please install nmap ";
88    print "or ipdiscover " if $^O =~ /^linux$/i;
89    print "if you want to use the network ".
90    "discover feature.\n";
91}
92
93if (!can_use('Net::IP')) {
94    print "Net::IP is strongly recommended since it's required to retrieve "
95    ."network information\n";
96}
97
98if (!can_use('Proc::Daemon') || !can_use('Proc::PID::File')) {
99    print "Please install Proc::Daemon and Proc::PID::File if you ".
100    "want to use the daemon monde.\n";
101}
102
103
104my $archname;
105eval { # config_re is not available on Perl 5.6
106    my @t = Config::config_re('archname');
107    $archname = $t[0];
108};
109if ($^O =~ /(linux|bsd)/i && (!$archname ||$archname =~ /(i[3456x]86|x86_64|amd64)/i)) {
110    foreach (qw/dmidecode lspci/) {
111        if (!can_run($_)) {
112            print "\n";
113            print "[WARNING] $_ is needed if you want a complete inventory on x86 and AMD64/x86_64.\n";
114            print "\n";
115        }
116    }
117}
118
119if ($^O =~ /^darwin$/ && !can_use('Mac::SysProfile')) {
120    print "\n";
121    print "[WARNING] Mac::SysProfile is needed on MacOS to detect most of the device information.\n";
122    print "\n";
123    requires 'Mac::SysProfile' => undef;
124}
125
126# memconf is needed by Solaris backend module
127if ($^O =~ /^solaris$/i) {
128    install_script  'memconf';
129}
130
131#for i in inc/BUNDLES/* ; do rm -rf `basename $i` ;done`
132#auto_install;
133WriteAll;
134
Note: See TracBrowser for help on using the repository browser.