install.pp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #
  2. # fmw_jdk::install
  3. #
  4. # Copyright 2015 Oracle. All Rights Reserved
  5. #
  6. class fmw_jdk::install(
  7. $java_home_dir = undef,
  8. $source_file = undef,
  9. $source_x64_file = undef,
  10. ) {
  11. unless $::kernel in ['windows', 'Linux', 'SunOS'] {
  12. fail('Not supported Operation System, please use it on windows, linux or solaris host')
  13. }
  14. if ( $java_home_dir == undef or is_string($java_home_dir) == false ) {
  15. fail('java_home_dir parameter cannot be empty')
  16. }
  17. if ( $source_file == undef or is_string($source_file) == false ) {
  18. fail('source_file parameter cannot be empty')
  19. }
  20. if ( $source_x64_file != undef and $::kernel != 'SunOS' ) {
  21. fail('source_x64_file is only used in solaris for installing JDK x64 extension')
  22. }
  23. if $::kernel == 'Linux' {
  24. if 'rpm' in $source_file {
  25. unless $::osfamily in ['RedHat'] {
  26. fail('please use the rpm source_file on rhel linux family OS')
  27. }
  28. fmw_jdk_linux_rpm{ $java_home_dir:
  29. ensure => 'present',
  30. java_home_dir => $java_home_dir,
  31. source_file => $source_file,
  32. }
  33. } elsif 'tar.gz' in $source_file {
  34. class{'fmw_jdk::internal::jdk_linux':
  35. java_home_dir => $java_home_dir,
  36. source_file => $source_file,
  37. }
  38. contain fmw_jdk::internal::jdk_linux
  39. } else {
  40. fail('Unknown source_file extension for linux, please use a rpm or tar.gz file')
  41. }
  42. } elsif $::kernel == 'SunOS' {
  43. if 'tar.Z' in $source_file {
  44. class{'fmw_jdk::internal::jdk_solaris_z':
  45. java_home_dir => $java_home_dir,
  46. source_file => $source_file,
  47. source_x64_file => $source_x64_file,
  48. }
  49. contain fmw_jdk::internal::jdk_solaris_z
  50. } elsif 'tar.gz' in $source_file {
  51. class{'fmw_jdk::internal::jdk_solaris':
  52. java_home_dir => $java_home_dir,
  53. source_file => $source_file,
  54. source_x64_file => $source_x64_file,
  55. }
  56. contain fmw_jdk::internal::jdk_solaris
  57. } else {
  58. fail('Unknown source_file extension for solaris, please use a tar.gz or tar.Z SVR4 file')
  59. }
  60. } elsif $::kernel == 'windows' {
  61. if 'exe' in $source_file {
  62. class{'fmw_jdk::internal::jdk_windows':
  63. java_home_dir => $java_home_dir,
  64. source_file => $source_file,
  65. }
  66. contain fmw_jdk::internal::jdk_windows
  67. } else {
  68. fail('Unknown source_file extension for windows, please use a exe file')
  69. }
  70. }
  71. }