EU:MM and custom installation path

T

Teo

Hi,

am using ExtUtils::MakeMaker for the distribution of a Perl script.
The Perl script (not a module a standalone script) is a plugin for a
software tool (Nagios) and has to be installed in a particular
location (e.g., /usr/lib/nagios/plugins/contrib) instead of the
canonical /usr/local/bin on a Unix platform.

This is how one of my many test Makefile.PL looks like:

# Load the Module::Install bundled in ./inc/
use inc::Module::Install;

##############################################################################
# Define metadata (we read it from the binary)
name 'check_dir';
all_from 'check_dir';

##############################################################################
# Specific dependencies
requires 'Carp' => 0;
requires 'English' => 0;
requires 'File::stat' => 0;
requires 'Getopt::Long' => 0;
requires 'Nagios::plugin' => 0;
requires 'Nagios::plugin::Threshold' => 0;
requires 'Pod::Usage' => 0;
requires 'version' => 0;

install_script 'check_dir';

WriteMakefile(
INSTALLDIRS => 'site',
INSTALLSITEBIN => '/usr/lib/nagios/plugins/contrib',
INSTALLSCRIPT => '/usr/lib/nagios/plugins/contrib',
);

I tried many combinations of INSTALLDIR values and INSTALL* variables
but I was never able to install the script in a place different from /
usr/local/bin.

Any hint?

Many thanks,

Matteo
 
B

Ben Morrow

Quoth Teo said:
am using ExtUtils::MakeMaker for the distribution of a Perl script.

No, you're using Module::Install. The distinction is important.
The Perl script (not a module a standalone script) is a plugin for a
software tool (Nagios) and has to be installed in a particular
location (e.g., /usr/lib/nagios/plugins/contrib) instead of the
canonical /usr/local/bin on a Unix platform.

This is how one of my many test Makefile.PL looks like:

# Load the Module::Install bundled in ./inc/
use inc::Module::Install;

##############################################################################
# Define metadata (we read it from the binary)
name 'check_dir';
all_from 'check_dir';

##############################################################################
# Specific dependencies
requires 'Carp' => 0;
requires 'English' => 0;
requires 'File::stat' => 0;
requires 'Getopt::Long' => 0;
requires 'Nagios::plugin' => 0;
requires 'Nagios::plugin::Threshold' => 0;
requires 'Pod::Usage' => 0;
requires 'version' => 0;

install_script 'check_dir';

WriteMakefile(
INSTALLDIRS => 'site',
INSTALLSITEBIN => '/usr/lib/nagios/plugins/contrib',
INSTALLSCRIPT => '/usr/lib/nagios/plugins/contrib',
);

I tried many combinations of INSTALLDIR values and INSTALL* variables
but I was never able to install the script in a place different from /
usr/local/bin.

Any hint?

The following works for me (in that it installs the script in the
correct place).

use inc::Module::Install;

name 'check_dir';
all_from 'check_dir';

install_script 'check_dir';

WriteMakefile(
INSTALLDIRS => 'site',
INSTALLSITESCRIPT => '/home/mauzo/foo',
);

auto_install;

Note that both 'auto_install' is required, or you don't get any
dependancies.

Ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top