EU:MM and custom installation path

EU:MM and custom installation path

am 26.10.2007 08:57:12 von Matteo Corti

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

Re: EU:MM and custom installation path

am 26.10.2007 21:17:25 von Ben Morrow

Quoth Teo :
>
> 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