debian 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. #!/usr/bin/env bash
  2. # AMD64, i386, ARM - this is different from _system_arch as it's not translated.
  3. requirements_debian_arch()
  4. {
  5. __architecture="$(dpkg --print-architecture)"
  6. }
  7. # Queries the dpkg system for packages that are installed only asking about
  8. # the package name and it's arch. This package will fall back to :all for
  9. # cases where we cannot get an arch specific package (such is the case
  10. # for a few packages.)
  11. requirements_debian_lib_installed()
  12. {
  13. dpkg-query -s "${1}:${__architecture}" >/dev/null 2>&1 ||
  14. dpkg-query -s "${1}:all" >/dev/null 2>&1 ||
  15. dpkg-query -s "$1" 2>/dev/null | __rvm_grep "Architecture: ${__architecture}" >/dev/null ||
  16. dpkg-query -s "$1" 2>/dev/null | __rvm_grep "Architecture: all" >/dev/null ||
  17. return $?
  18. }
  19. # Informs us if a package is even available on the distro we are working
  20. # with, this is more of a transitional method kind of like Ubuntu
  21. # has a transitional git-core package right now. This will allow us
  22. # to continue to support older versions of Ubuntu while enforcing newer
  23. # packages on newer Ubuntu.
  24. requirements_debian_lib_available()
  25. {
  26. apt-cache show "$1" >/dev/null 2>&1 || return $?
  27. }
  28. requirements_debian_libs_install()
  29. {
  30. __rvm_try_sudo apt-get --no-install-recommends --yes install "$@" || return $?
  31. }
  32. requirements_debian_libs_remove()
  33. {
  34. __rvm_try_sudo apt-get --yes remove "$@" || return $?
  35. }
  36. requirements_debian_update_system()
  37. {
  38. __rvm_try_sudo apt-get --quiet --yes update ||
  39. {
  40. \typeset __ret=$?
  41. case ${__ret} in
  42. (100)
  43. rvm_error "There has been an error while updating your system using \`apt-get\`.
  44. It seems that there are some 404 Not Found errors for repositories listed in:
  45. /etc/apt/sources.list
  46. /etc/apt/sources.list.d/*.list
  47. Make sure that all repositories are available from your system and verify your setup by running manually:
  48. sudo apt-get update
  49. Make sure that it works correctly before proceeding with RVM.
  50. If you are working from the GUI instead of the terminal, you might want to verify and fix broken
  51. repositories using \"Software & Updates\" application.
  52. "
  53. ;;
  54. esac
  55. return ${__ret}
  56. }
  57. }
  58. requirements_debian_define_libgmp()
  59. {
  60. if [[ "${_system_version}" == 6* ]]
  61. then
  62. requirements_check libgmp3-dev
  63. else
  64. requirements_check libgmp-dev
  65. fi
  66. }
  67. requirements_debian_define_libreadline()
  68. {
  69. if
  70. __rvm_version_compare ${_system_version} -ge 9
  71. then
  72. requirements_check libreadline-dev
  73. else
  74. requirements_check libreadline6-dev
  75. fi
  76. }
  77. requirements_debian_define_libssl()
  78. {
  79. # Legacy libssl-dev required by older version of ruby has been renamed to libssl1.0-dev
  80. # starting from Debian 9 (Stretch)
  81. case "$1" in
  82. (ruby-2.3*|ruby-2.2*|ruby-2.1*|ruby-2.0*|ruby-1.9*)
  83. if
  84. __rvm_version_compare ${_system_version} -ge 9
  85. then
  86. undesired_check libssl-dev
  87. requirements_check libssl1.0-dev
  88. else
  89. requirements_check libssl-dev
  90. fi
  91. ;;
  92. (*)
  93. requirements_check libssl-dev
  94. ;;
  95. esac
  96. }
  97. requirements_debian_define_clang_llvm()
  98. {
  99. requirements_check clang-3.6 llvm-3.6 llvm-3.6-dev
  100. }
  101. requirements_debian_define_base()
  102. {
  103. requirements_check "$@" \
  104. autoconf automake bison ca-certificates curl libc6-dev libffi-dev libgdbm-dev libncurses5-dev \
  105. libsqlite3-dev libtool libyaml-dev make openssl patch pkg-config sqlite3 zlib1g zlib1g-dev
  106. requirements_${_system_name_lowercase}_define_libgmp
  107. requirements_${_system_name_lowercase}_define_libreadline
  108. }
  109. requirements_debian_define_java()
  110. {
  111. update-alternatives --list ${1:-java} >/dev/null 2>&1 ||
  112. requirements_check_fallback \
  113. openjdk-8-jre-headless openjdk-8-jdk oracle-j2sdk1.8 \
  114. openjdk-7-jre-headless openjdk-7-jdk oracle-j2sdk1.7 \
  115. openjdk-6-jre-headless opendjk-6-jdk oracle-j2sdk1.6
  116. }
  117. requirements_debian_define()
  118. {
  119. \typeset __architecture
  120. requirements_debian_arch
  121. if [[ "$1" == *head ]]
  122. then
  123. requirements_check_fallback git git-core
  124. fi
  125. case "$1" in
  126. (rvm)
  127. requirements_check bash curl patch bzip2 ca-certificates gawk
  128. ;;
  129. (jruby*)
  130. requirements_check g++ make
  131. if
  132. is_head_or_disable_binary "$1"
  133. then
  134. requirements_debian_define_java javac
  135. requirements_check_fallback git git-core
  136. case $( jruby_installation_method "$1" ) in
  137. ant) __rvm_which ant >/dev/null || requirements_check ant ;;
  138. mvn) __rvm_which mvn >/dev/null || requirements_check_fallback maven maven2 ;;
  139. esac
  140. else
  141. requirements_debian_define_java java
  142. fi
  143. ;;
  144. (ir*)
  145. requirements_check curl mono-2.0-devel
  146. ;;
  147. (opal)
  148. requirements_check nodejs npm
  149. ;;
  150. (rbx*|rubinius*)
  151. requirements_debian_define_base flex ruby-dev libreadline-dev libedit-dev
  152. requirements_${_system_name_lowercase}_define_libssl "$1"
  153. requirements_${_system_name_lowercase}_define_clang_llvm "$1"
  154. ;;
  155. (truffleruby*)
  156. requirements_debian_define_base
  157. requirements_${_system_name_lowercase}_define_libssl "$1"
  158. requirements_check make gcc libxml2
  159. ;;
  160. (*)
  161. requirements_debian_define_base g++ gcc
  162. requirements_${_system_name_lowercase}_define_libssl "$1"
  163. ;;
  164. esac
  165. }