| 1 |
# |
|---|
| 2 |
# Example usage: |
|---|
| 3 |
# perlinstall { "TermReadKey": |
|---|
| 4 |
# dest => "/usr/src" |
|---|
| 5 |
# } |
|---|
| 6 |
define perlinstall ($dest = "/usr/src", $ploverride = "") { |
|---|
| 7 |
|
|---|
| 8 |
file { "src-$name": |
|---|
| 9 |
path => "$dest/$name.tar.gz", |
|---|
| 10 |
ensure => file |
|---|
| 11 |
} |
|---|
| 12 |
|
|---|
| 13 |
exec { "untar-$name": |
|---|
| 14 |
command => "tar xzf $name.tar.gz", |
|---|
| 15 |
path => "/usr/bin:/bin", |
|---|
| 16 |
cwd => $dest, |
|---|
| 17 |
require => file[ "src-$name" ] |
|---|
| 18 |
} |
|---|
| 19 |
|
|---|
| 20 |
case $ploverride { |
|---|
| 21 |
"": { } |
|---|
| 22 |
default: |
|---|
| 23 |
{ |
|---|
| 24 |
remotefile { "$dest/Makefile.PL": |
|---|
| 25 |
mode => 644, |
|---|
| 26 |
source => "config/$ploverride/Makefile.PL", |
|---|
| 27 |
} |
|---|
| 28 |
|
|---|
| 29 |
exec { "cp-Makefile": |
|---|
| 30 |
command => "mv $dest/Makefile.PL $( ls -A -d $name*/ )", |
|---|
| 31 |
path => "/usr/bin:/bin", |
|---|
| 32 |
cwd => $dest, |
|---|
| 33 |
require => remotefile[ "$dest/Makefile.PL" ], |
|---|
| 34 |
before => exec[ "makefile-$name" ] |
|---|
| 35 |
} |
|---|
| 36 |
} |
|---|
| 37 |
} |
|---|
| 38 |
|
|---|
| 39 |
exec { "makefile-$name": |
|---|
| 40 |
command => "cd $( ls -A -d $name*/ ) && perl Makefile.PL", |
|---|
| 41 |
path => "/usr/bin:/bin", |
|---|
| 42 |
cwd => $dest, |
|---|
| 43 |
require => [ package[ "perl" ], exec[ "untar-$name" ] ] |
|---|
| 44 |
} |
|---|
| 45 |
|
|---|
| 46 |
exec { "make-$name": |
|---|
| 47 |
command => "cd $( ls -A -d $name*/ ) && make", |
|---|
| 48 |
path => "/usr/bin:/bin", |
|---|
| 49 |
cwd => $dest, |
|---|
| 50 |
require => [ package[ "make" ], package[ "gcc" ], exec[ "makefile-$name" ] ] |
|---|
| 51 |
} |
|---|
| 52 |
|
|---|
| 53 |
exec { "makeinstall-$name": |
|---|
| 54 |
command => "cd $( ls -A -d $name*/ ) && make install UNINST=1", |
|---|
| 55 |
path => "/usr/bin:/bin", |
|---|
| 56 |
cwd => $dest, |
|---|
| 57 |
require => [ package[ "make" ], exec[ "make-$name" ] ] |
|---|
| 58 |
} |
|---|
| 59 |
|
|---|
| 60 |
} |
|---|