solaris 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. #!/usr/bin/env bash
  2. requirements_solaris_lib_installed()
  3. {
  4. pkg info "$1" > /dev/null 2>&1 || return $?
  5. }
  6. requirements_solaris_lib_available()
  7. {
  8. pkg search "$1" 2>/dev/null | __rvm_grep "^$1-" > /dev/null 2>&1 || return $?
  9. }
  10. requirements_solaris_custom_lib_installed()
  11. {
  12. pkginfo -q "$1" || return $?
  13. }
  14. requirements_solaris_libs_install()
  15. {
  16. __rvm_try_sudo pkg install "$@" ||
  17. {
  18. \typeset ret=$?
  19. case $ret in
  20. (4) return 0 ;; # means the package does not need updates
  21. esac
  22. return $ret
  23. }
  24. }
  25. requirements_solaris_update_system()
  26. {
  27. case "${_system_version}" in
  28. (10)
  29. return 0
  30. ;;
  31. (*)
  32. __rvm_try_sudo pkg refresh ||
  33. {
  34. \typeset ret=$?
  35. case $ret in
  36. (4) return 0 ;; # means nothing to install
  37. esac
  38. return $ret
  39. }
  40. ;;
  41. esac
  42. }
  43. requirements_solaris_check_custom()
  44. {
  45. for lib in "$@"
  46. do
  47. [[ " ${packages_custom[*]} " == *" $lib "* ]] ||
  48. requirements_solaris_custom_lib_installed "$lib" || __rvm_add_once packages_custom "$lib"
  49. done
  50. unset lib
  51. }
  52. requirements_solaris_check_opencsw_enabled()
  53. {
  54. requirements_solaris_custom_lib_installed CSWpkgutil || return $?
  55. }
  56. requirements_solaris_enable_opencsw()
  57. {
  58. __rvm_try_sudo pkgadd -a $rvm_path/config/solaris/noask -d https://get.opencsw.org/now CSWpkgutil > /dev/null 2>&1 || return $?
  59. }
  60. requirements_solaris_install_custom()
  61. {
  62. requirements_solaris_check_opencsw_enabled || requirements_solaris_enable_opencsw
  63. __rvm_try_sudo /opt/csw/bin/pkgutil -iy "$@" -t https://mirror.opencsw.org/opencsw/unstable || return $?
  64. }
  65. requirements_solaris_define()
  66. {
  67. if
  68. is_a_function requirements_solaris_${_system_version}_define
  69. then
  70. requirements_solaris_${_system_version}_define "$@" || return $?
  71. else
  72. rvm_error "Solaris ${_system_version} is not supported"
  73. return 40
  74. fi
  75. }
  76. requirements_solaris_11_update_after()
  77. {
  78. __rvm_try_sudo pkg update "${packages_installed[@]}" ||
  79. {
  80. \typeset ret=$?
  81. case $ret in
  82. (4) return 0 ;; # means nothing to install
  83. esac
  84. return $ret
  85. }
  86. }
  87. requirements_solaris_after()
  88. {
  89. case "${_system_version}" in
  90. (10)
  91. return 0
  92. ;;
  93. (*)
  94. if
  95. [[ -n "${packages_installed[*]}" ]]
  96. then
  97. rvm_requiremnts_fail_or_run_action 3 \
  98. "Updating installed packages: ${packages_installed[*]}" \
  99. requirements_solaris_11_update_after ||
  100. return $?
  101. fi
  102. ;;
  103. esac
  104. }
  105. requirements_solaris_10_define()
  106. {
  107. case "$1" in
  108. (rvm)
  109. requirements_solaris_check_custom CSWbash CSWgit CSWgpatch CSWmd5deep CSWwhich
  110. ;;
  111. (jruby-head*)
  112. requirements_solaris_check_custom git make
  113. ;;
  114. (jruby*)
  115. # JDK is already installed on Solaris 10
  116. # TODO: is ant installed also?
  117. requirements_solaris_check_custom make
  118. if
  119. is_head_or_disable_binary "$1"
  120. then
  121. requirements_solaris_check_custom git
  122. case $( jruby_installation_method "$1" ) in
  123. mvn) requirements_check_custom_after mvn=maven ;;
  124. esac
  125. fi
  126. ;;
  127. (ir*)
  128. # No support
  129. true
  130. ;;
  131. (opal)
  132. # No support
  133. true
  134. ;;
  135. (*-head)
  136. requirements_solaris_check_custom CSWgpatch CSWgcc4core CSWgmake CSWcoreutils CSWpkgconfig CSWautoconf CSWautomake CSWlibtool CSWlibyaml-dev CSWlibreadline-dev CSWlibncurses-dev CSWlibssl-dev CSWcurl CSWgit
  137. __rvm_update_configure_opt_dir "$1" "/opt/csw"
  138. ;;
  139. (*)
  140. requirements_solaris_check_custom CSWgpatch CSWgcc4core CSWgmake CSWcoreutils CSWpkgconfig CSWautoconf CSWautomake CSWlibtool CSWlibyaml-dev CSWlibreadline-dev CSWlibncurses-dev CSWlibssl-dev CSWcurl
  141. __rvm_update_configure_opt_dir "$1" "/opt/csw"
  142. ;;
  143. esac
  144. }
  145. requirements_solaris_11_define()
  146. {
  147. case "$1" in
  148. (rvm)
  149. requirements_check bash curl text/gnu-patch
  150. requirements_check_fallback git scmgit-base
  151. ;;
  152. (jruby*)
  153. # This will fail with the message
  154. ## To indicate that you agree to and accept the terms of the licenses of the packages listed above, use the --accept option.
  155. ## To display all of the related licenses, use the --licenses option.
  156. # Need to handle this somehow
  157. if
  158. is_head_or_disable_binary "$1"
  159. then
  160. requirements_check jdk
  161. requirements_check_fallback git scmgit-base
  162. case $( jruby_installation_method "$1" ) in
  163. ant) requirements_check ant ;;
  164. mvn) requirements_check_custom_after mvn=maven ;;
  165. esac
  166. else
  167. requirements_check jdk
  168. fi
  169. ;;
  170. (ir*)
  171. # No support
  172. true
  173. ;;
  174. (opal)
  175. # No support
  176. true
  177. ;;
  178. (*-head)
  179. requirements_check_fallback git scmgit-base
  180. requirements_check text/gnu-patch developer/gcc-45 system/header developer/build/autoconf developer/build/automake developer/build/libtool system/library/math/header-math file/gnu-coreutils
  181. requirements_solaris_check_custom CSWlibyaml-dev
  182. __rvm_update_configure_opt_dir "$1" "/opt/csw"
  183. ;;
  184. (*)
  185. requirements_check text/gnu-patch developer/gcc-45 system/header developer/build/autoconf developer/build/automake developer/build/libtool system/library/math file/gnu-coreutils
  186. requirements_solaris_check_custom CSWlibyaml-dev
  187. __rvm_update_configure_opt_dir "$1" "/opt/csw"
  188. ;;
  189. esac
  190. }