CHEBRIAN
2011-Jul-12 10:14 UTC
[Puppet Users] how to write classes to install package from source
Hi, I want to write the class to install the packages from source . Please suggest me how to achieve the following things . 1. download the source file and extract it . 2. to the make && make install and verify the installation Regards CHEBRIAN -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Al @ Lab42
2011-Jul-12 10:19 UTC
[Puppet Users] Re: how to write classes to install package from source
You might find this define useful ( https://github.com/example42/puppet-modules/blob/master/common/manifests/defines/netinstall.pp ): define netinstall ( $url, $extracted_dir, $destination_dir, $owner = "root", $group = "root", $work_dir = "/var/tmp", $extract_command = "tar -zxvf", $preextract_command = "", $postextract_command = "" # $postextract_command = "./configure ; make ; make install" ) { $source_filename = urlfilename($url) if $preextract_command { exec { "PreExtract $source_filename": command => $preextract_command, before => Exec["Extract $source_filename"], refreshonly => true, } } exec { "Retrieve $url": cwd => "$work_dir", command => "wget $url", creates => "$work_dir/$source_filename", timeout => 3600, } exec { "Extract $source_filename": command => "mkdir -p $destination_dir ; cd $destination_dir ; $extract_command $work_dir/$source_filename", unless => "find $destination_dir | grep $extracted_dir", require => Exec["Retrieve $url"], } if $postextract_command { exec { "PostExtract $source_filename": command => $postextract_command, cwd => "$destination_dir/$extracted_dir", subscribe => Exec["Extract $source_filename"], refreshonly => true, timeout => 3600, require => Exec["Retrieve $url"], } } } -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/cWUfes0R9OkJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Peter Meier
2011-Jul-13 06:30 UTC
Re: [Puppet Users] Re: how to write classes to install package from source
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 07/12/2011 12:19 PM, Al @ Lab42 wrote:> You might find this define useful ( > https://github.com/example42/puppet-modules/blob/master/common/manifests/defines/netinstall.pp > ): >or as a general best practice you might want to build your own packages. They''re much easier to handle! ~pete -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk4dO2kACgkQbwltcAfKi3+5WQCfa35P0lZKGS8xYyitmfLt7Kiy wUwAn0pnp4xscGeMNl3VA1Lo1xSygYh9 =ZGSf -----END PGP SIGNATURE----- -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
vagn scott
2011-Jul-13 06:53 UTC
Re: [Puppet Users] Re: how to write classes to install package from source
On 07/12/2011 06:19 AM, Al @ Lab42 wrote:> command => "mkdir -p $destination_dir ; cd > $destination_dir ; $extract_command $work_dir/$source_filename",Nice. But I would suggest changing '';'' to ''&&''. That way, if the mkdir or cd fail you don''t end up trying to extract the archive in the wrong directory. command => "mkdir -p $destination_dir && cd $destination_dir && $extract_command $work_dir/$source_filename", Also consider unless => "test -d ${destination_dir }/${extracted_dir}", or even better creates => "${destination_dir }/${extracted_dir}", for the repetition guard. -- vagn -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Al @ Lab42
2011-Jul-14 14:03 UTC
Re: [Puppet Users] Re: how to write classes to install package from source
Thanks for the suggestions, they are going to be merged. That''s a define I did various years ago that actually has been useful in various cases (I do agree that it''s better to use packages, but sometimes this is the quickest and saner approach). Al On Wednesday, July 13, 2011 8:53:33 AM UTC+2, vagn wrote:> > On 07/12/2011 06:19 AM, Al @ Lab42 wrote: > > command => "mkdir -p $destination_dir ; cd > > $destination_dir ; $extract_command $work_dir/$source_filename", > Nice. But I would suggest changing '';'' to ''&&''. That way, if the > mkdir or cd fail you don''t end up > trying to extract the archive in the wrong directory. > > command => "mkdir -p $destination_dir && cd $destination_dir && > $extract_command $work_dir/$source_filename", > > Also consider > > unless => "test -d ${destination_dir }/${extracted_dir}", > > or even better > > creates => "${destination_dir }/${extracted_dir}", > > for the repetition guard. > > -- > vagn > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/EjT5lFqc31MJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
KarthiKeyan. Kesavan
2011-Jul-14 17:08 UTC
Re: [Puppet Users] Re: how to write classes to install package from source
Hi guys, Thanks a lot for the suggestions . Regards K.Karthikeyan On Thu, Jul 14, 2011 at 7:33 PM, Al @ Lab42 <lab42.it@gmail.com> wrote:> Thanks for the suggestions, they are going to be merged. > That''s a define I did various years ago that actually has been useful in > various cases (I do agree that it''s better to use packages, but sometimes > this is the quickest and saner approach). > > Al > > > On Wednesday, July 13, 2011 8:53:33 AM UTC+2, vagn wrote: >> >> On 07/12/2011 06:19 AM, Al @ Lab42 wrote: >> > command => "mkdir -p $destination_dir ; cd >> > $destination_dir ; $extract_command $work_dir/$source_filename", >> Nice. But I would suggest changing '';'' to ''&&''. That way, if the >> mkdir or cd fail you don''t end up >> trying to extract the archive in the wrong directory. >> >> command => "mkdir -p $destination_dir && cd $destination_dir && >> $extract_command $work_dir/$source_filename", >> >> Also consider >> >> unless => "test -d ${destination_dir }/${extracted_dir}", >> >> or even better >> >> creates => "${destination_dir }/${extracted_dir}", >> >> for the repetition guard. >> >> -- >> vagn >> >> -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/puppet-users/-/EjT5lFqc31MJ. > > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Scott Smith
2011-Jul-14 20:04 UTC
Re: [Puppet Users] Re: how to write classes to install package from source
Use fpm http://github.com/jordansissel/fpm On Jul 14, 2011 10:08 AM, "KarthiKeyan. Kesavan" <ksd.che@gmail.com> wrote:> Hi guys, > > Thanks a lot for the suggestions . > > Regards > > K.Karthikeyan > > On Thu, Jul 14, 2011 at 7:33 PM, Al @ Lab42 <lab42.it@gmail.com> wrote: > >> Thanks for the suggestions, they are going to be merged. >> That''s a define I did various years ago that actually has been useful in >> various cases (I do agree that it''s better to use packages, but sometimes >> this is the quickest and saner approach). >> >> Al >> >> >> On Wednesday, July 13, 2011 8:53:33 AM UTC+2, vagn wrote: >>> >>> On 07/12/2011 06:19 AM, Al @ Lab42 wrote: >>> > command => "mkdir -p $destination_dir ; cd >>> > $destination_dir ; $extract_command $work_dir/$source_filename", >>> Nice. But I would suggest changing '';'' to ''&&''. That way, if the >>> mkdir or cd fail you don''t end up >>> trying to extract the archive in the wrong directory. >>> >>> command => "mkdir -p $destination_dir && cd $destination_dir && >>> $extract_command $work_dir/$source_filename", >>> >>> Also consider >>> >>> unless => "test -d ${destination_dir }/${extracted_dir}", >>> >>> or even better >>> >>> creates => "${destination_dir }/${extracted_dir}", >>> >>> for the repetition guard. >>> >>> -- >>> vagn >>> >>> -- >> You received this message because you are subscribed to the Google Groups >> "Puppet Users" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/puppet-users/-/EjT5lFqc31MJ. >> >> To post to this group, send email to puppet-users@googlegroups.com. >> To unsubscribe from this group, send email to >> puppet-users+unsubscribe@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/puppet-users?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups"Puppet Users" group.> To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email topuppet-users+unsubscribe@googlegroups.com.> For more options, visit this group athttp://groups.google.com/group/puppet-users?hl=en.>-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.