fmw_extract.pp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #
  2. # fmw_inst::internal::fmw_extract
  3. #
  4. # Copyright 2015 Oracle. All Rights Reserved
  5. #
  6. define fmw_inst::internal::fmw_extract(
  7. $source_file = undef,
  8. $source_2_file = undef,
  9. $source_3_file = undef,
  10. $create_file_check = undef,
  11. $create_2_file_check = undef,
  12. $create_3_file_check = undef,
  13. $os_user = undef,
  14. $os_group = undef,
  15. $tmp_dir = undef,
  16. )
  17. {
  18. $path = '/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin'
  19. if !defined(Package['unzip']) {
  20. package{ 'unzip':
  21. ensure => present,
  22. }
  23. }
  24. exec{ "extract ${title} file 1":
  25. command => "unzip -o ${source_file} -d ${tmp_dir}/${title}",
  26. creates => $create_file_check,
  27. user => $os_user,
  28. group => $os_group,
  29. cwd => $tmp_dir,
  30. path => $path,
  31. timeout => 0,
  32. require => Package['unzip'],
  33. }
  34. if ( $source_2_file != undef ) {
  35. exec{ "extract ${title} file 2":
  36. command => "unzip -o ${source_2_file} -d ${tmp_dir}/${title}",
  37. creates => $create_2_file_check,
  38. user => $os_user,
  39. group => $os_group,
  40. cwd => $tmp_dir,
  41. path => $path,
  42. timeout => 0,
  43. require => Exec["extract ${title} file 1"],
  44. }
  45. }
  46. if ( $source_3_file != undef ) {
  47. exec{ "extract ${title} file 3":
  48. command => "unzip -o ${source_3_file} -d ${tmp_dir}/${title}",
  49. creates => $create_3_file_check,
  50. user => $os_user,
  51. group => $os_group,
  52. cwd => $tmp_dir,
  53. path => $path,
  54. timeout => 0,
  55. require => Exec["extract ${title} file 2"],
  56. }
  57. }
  58. }