source: ocsinventory-agent/trunk/fuentes/tools/standalone.sh @ 469

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

Copyt trusty code

  • Property svn:executable set to *
File size: 2.0 KB
Line 
1#!/bin/sh
2
3echo "WARNINGS: Very experimental tool"
4
5[ -f standalone.sh ] && cd ..
6if [ ! -f tools/standalone.sh ]; then
7    echo "Can't find tools/standalone.sh"
8    exit 1
9fi
10
11if [ ! -f MANIFEST ]; then
12    echo "Can't find the MANIFEST, please run:"
13    echo " perl Makefile.PL"
14    echo " make manifest"
15    exit 1
16fi
17
18if [ ! -x "`which pp 2>/dev/null`" ]; then
19    echo "Can't find the pp command. Please install PAR::Packer:"
20    echo " -CPAN: 'cpan PAR::Packer'"
21    echo " -source: sownload the archive from"
22    echo "  http://search.cpan.org/dist/PAR-Packer/"
23    echo " -Debian/Ubuntu: 'aptitude install libpar-packer-perl' OR 'aptitude install libpar-perl'"
24    exit 1
25fi
26
27BACKENDMODULE=`cat MANIFEST | perl -pe 's/.*// unless (/Ocsinventory\/Agent\/Backend\// && !/^inc/ && /pm$/); s/lib\/(.*)\.pm/ $1/; s/\//::/g; chomp'`
28
29cat > lib/Ocsinventory/Agent/Backend/ModuleToLoad.pm <<EOF
30# This is a workaround for PAR::Packer. Since it resets @INC
31# I can't find the backend modules to load dynamically. So
32# I prepare a list and include it.
33package Ocsinventory::Agent::Backend::ModuleToLoad;
34
35our @list = qw/ $BACKENDMODULE /;
36
371;
38EOF
39
40MODULES="`cat MANIFEST | perl -pe 's/.*// unless (!/^inc/ && /pm$/ && !/^contrib/); s/lib\/(.*)\.pm/ -M $1/; s/\//::/g; chomp'` -M XML::SAX::PurePerl -M XML::SAX::Expat -M PerlIO -M Getopt::Long -M Digest::MD5 -M Net::IP -M Ocsinventory::Agent::Backend::ModuleToLoad"
41
42for i in `echo $MODULES| perl -nle 's/\-M//g;print'`; do  perl -I "lib" -M$i -e "1" || MISSING="$MISSING $i" ;done
43
44if [ ! -z "$MISSING" ]; then
45  echo "Some modules are missing in your installation or failed to build, please install them first."
46  echo "->$MISSING"
47  exit 1
48fi
49
50#pp --lib lib $MODULES -o ocsinventory-agent.bin ocsinventory-agent
51pp --lib lib $MODULES -B -p ocsinventory-agent -vvv -o ocsinventory-agent.par
52pp -o ocsinventory-agent.bin ocsinventory-agent.par
53
54if [ -f ocsinventory-agent.bin ]; then
55    echo "ocsinventory-agent.bin generated!"
56else
57    echo "Failed to generate ocsinventory-agent.bin!"
58fi
Note: See TracBrowser for help on using the repository browser.