Advertisement
Guest User

jdk8-oracle

a guest
Apr 16th, 2019
530
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.48 KB | None | 0 0
  1. # Maintainer: Chris Severance aur.severach AatT spamgourmet.com
  2. # Contributor: Det <nimetonmaili g-mail> | nunc @ github
  3.  
  4. set -u
  5. _pkgname='jdk'
  6. _major='8'
  7. pkgname="${_pkgname}${_major}"
  8. _minor='202'; _build='';
  9. pkgver="${_major}u${_minor}"
  10. pkgrel='1'
  11. pkgdesc="Oracle Java ${_major} Development Kit"
  12. arch=('x86_64')
  13. url='http://www.oracle.com/technetwork/java/javase/downloads/index.html'
  14. license=('custom:Oracle')
  15. depends=('ca-certificates-java' 'hicolor-icon-theme' 'java-runtime-common' 'nss' 'xdg-utils')
  16. depends+=('java-environment-common')
  17. optdepends=('alsa-lib: for basic sound support'
  18. 'eclipse-java: to use "Oracle Java Mission Control" plugins in Eclipse'
  19. 'gtk2: for Gtk+ look and feel (desktop)')
  20. provides=("java-runtime=${_major}" "java-runtime-headless=${_major}" "java-web-start=${_major}"
  21. "java-runtime-jre=${_major}" "java-runtime-headless-jre=${_major}" "java-web-start-jre=${_major}"
  22. "java-openjfx=${_major}")
  23. provides+=("java-environment-jdk=${_major}" "java-environment=${_major}")
  24.  
  25. # Variables
  26. DLAGENTS=("${DLAGENTS[@]//curl -/curl -b 'oraclelicense=a' -}")
  27. _jname="${_pkgname}${_major}"
  28. _jvmdir="/usr/lib/jvm/java-${_major}-${_pkgname}"
  29.  
  30. backup=("etc/java-${_jname}/amd64/jvm.cfg"
  31. "etc/java-${_jname}/images/cursors/cursors.properties"
  32. "etc/java-${_jname}/management/jmxremote.access"
  33. "etc/java-${_jname}/management/management.properties"
  34. "etc/java-${_jname}/security/java.policy"
  35. "etc/java-${_jname}/security/java.security"
  36. "etc/java-${_jname}/security/javaws.policy"
  37. "etc/java-${_jname}/content-types.properties"
  38. "etc/java-${_jname}/flavormap.properties"
  39. "etc/java-${_jname}/fontconfig.properties.src"
  40. "etc/java-${_jname}/logging.properties"
  41. "etc/java-${_jname}/net.properties"
  42. "etc/java-${_jname}/psfont.properties.ja"
  43. "etc/java-${_jname}/psfontj2d.properties"
  44. "etc/java-${_jname}/sound.properties")
  45. options=('!strip') # JDK debug-symbols
  46. install="${pkgname}.install"
  47. source=(
  48. "http://enos.itcollege.ee/~jpoial/allalaadimised/jdk8/jce_policy-8.zip"
  49. "http://enos.itcollege.ee/~jpoial/allalaadimised/jdk8/jdk-8u202-linux-x64.tar.gz"
  50. "jconsole-${_jname}.desktop"
  51. "jmc-${_jname}.desktop"
  52. "jvisualvm-${_jname}.desktop"
  53. "policytool-${_jname}.desktop"
  54. )
  55. md5sums=('b3c7031bc65c28c2340302065e7d00d3'
  56. '0029351f7a946f6c05b582100c7d45b7'
  57. '8a66f50efdc867ffd6a27168bc93b210'
  58. '1cbde70639abd98db4bace284dbf2bc4'
  59. 'f0b39865361437f3778ecbe6ffbc0a06'
  60. '89704501aff8efe859c31968d8d168e6')
  61. sha256sums=('f3020a3922efd6626c2fff45695d527f34a8020e938a49292561f18ad1320b59'
  62. '9a5c32411a6a06e22b69c495b7975034409fa1652d03aeb8eb5b6f59fd4594e0'
  63. '65282603bd0804d162f3f7da47bc7f3c91373e87504297d6a6fd6f2f8a1ec4ee'
  64. '8f865b52946a9ab98556c56306c7e70ae7aa432b4d005c70df0bba9d2c3111b1'
  65. '144e6651fcea08d95f3148d3a8ad17deb93fec4dd9236d37d27d7c648230b870'
  66. '635433e9c78ff58af65c316232ac9907d289a324428923788ea0f82ae7f8083b')
  67.  
  68. ## Alternative mirror, if your local one is throttled:
  69. source[0]=("http://enos.itcollege.ee/~jpoial/allalaadimised/jdk8/jdk-8u202-linux-x64.tar.gz")
  70.  
  71. package() {
  72. set -u
  73. cd "${_pkgname}1.${_major}.0_${_minor}"
  74.  
  75. set +u; msg2 'Creating directory structure...'; set -u
  76. install -d "${pkgdir}/etc/.java/.systemPrefs"
  77. install -d "${pkgdir}/usr/lib/jvm/java-${_major}-${_pkgname}/bin"
  78. install -d "${pkgdir}/usr/lib/mozilla/plugins"
  79. install -d "${pkgdir}/usr/share/licenses/java${_major}-${_pkgname}"
  80.  
  81. set +u; msg2 'Removing redundancies...'; set -u
  82. pushd 'jre' > /dev/null
  83. rm -r 'lib/desktop/icons/HighContrast/'
  84. rm -r 'lib/desktop/icons/HighContrastInverse/'
  85. rm -r 'lib/desktop/icons/LowContrast/'
  86. rm lib/fontconfig.*.bfc
  87. rm lib/fontconfig.*.properties.src
  88. rm *.txt
  89. rm 'COPYRIGHT'
  90. rm 'LICENSE'
  91. rm 'README'
  92. rm -r 'plugin/'
  93. popd > /dev/null
  94. rm 'man/ja'
  95.  
  96. set +u; msg2 'Moving contents...'; set -u
  97. mv * "${pkgdir}/${_jvmdir}"
  98.  
  99. # Cd to the new playground
  100. cd "${pkgdir}/${_jvmdir}"
  101.  
  102. set +u; msg2 'Fixing directory structure...'; set -u
  103. # Replace duplicate binaries in bin/ with links to jre/bin/
  104. local _i
  105. for _i in jre/bin/*; do
  106. ln -sf "${_jvmdir}/jre/bin/${_i##*/}" "bin/${_i##*/}"
  107. done
  108.  
  109. # Suffix .desktops + icons (sun-java.png -> sun-java-${_jname}.png)
  110. local _i
  111. for _i in $(find 'jre/lib/desktop/' -type 'f'); do
  112. rename -- '.' "-${_jname}." "${_i}"
  113. done
  114.  
  115. # Fix .desktop paths
  116. sed -e "s|Exec=|Exec=${_jvmdir}/jre/bin/|" \
  117. -e "s|.png|-${_jname}.png|" \
  118. -i 'jre/lib/desktop/applications'/*
  119.  
  120. # Move .desktops + icons to /usr/share
  121. mv 'jre/lib/desktop'/* "${pkgdir}/usr/share/"
  122. install -m644 "${srcdir}"/*.desktop "${pkgdir}/usr/share/applications/"
  123.  
  124. # Move confs to /etc and link back to /usr: /usr/lib/jvm/java-${_jname}/jre/lib -> /etc
  125. local _new_etc_path
  126. for _new_etc_path in "${backup[@]}"; do
  127. # Old location
  128. local _old_usr_path="jre/lib/${_new_etc_path#*${_jname}/}"
  129.  
  130. # Move
  131. install -Dm644 "${_old_usr_path}" "${pkgdir}/${_new_etc_path}"
  132. ln -sf "/${_new_etc_path}" "${_old_usr_path}"
  133. done
  134.  
  135. # Link NPAPI plugin
  136. ln -s "${_jvmdir}/jre/lib/amd64/libnpjp2.so" "${pkgdir}/usr/lib/mozilla/plugins/libnpjp2-${_jname}.so"
  137.  
  138. # Replace JKS keystore with 'ca-certificates-java'
  139. ln -sf '/etc/ssl/certs/java/cacerts' 'jre/lib/security/cacerts'
  140.  
  141. # Suffix man pages
  142. for _i in $(find 'man/' -type 'f'); do
  143. rename -- '.1' "-${_jname}.1" "${_i}"
  144. done
  145.  
  146. # Move man pages
  147. mv 'man/ja_JP.UTF-8/' 'man/ja'
  148. mv 'man/' "${pkgdir}/usr/share"
  149.  
  150. # Move/link licenses
  151. mv 'COPYRIGHT' 'LICENSE' *.txt "${pkgdir}/usr/share/licenses/java${_major}-${_pkgname}/"
  152. ln -s "/usr/share/licenses/java${_major}-${_pkgname}/" "${pkgdir}/usr/share/licenses/${pkgname}"
  153.  
  154. set +u; msg2 'Installing Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files...'; set -u
  155. # Replace default "strong", but limited, cryptography to get an "unlimited strength" one for
  156. # things like 256-bit AES. Enabled by default in OpenJDK:
  157. # - http://suhothayan.blogspot.com/2012/05/how-to-install-java-cryptography.html
  158. # - http://www.eyrie.org/~eagle/notes/debian/jce-policy.html
  159. install -m644 "${srcdir}/UnlimitedJCEPolicyJDK${_major}"/*.jar 'jre/lib/security/'
  160. install -Dm644 "${srcdir}/UnlimitedJCEPolicyJDK${_major}/README.txt" \
  161. "${pkgdir}/usr/share/doc/${_pkgname}/README_-_Java_JCE_Unlimited_Strength.txt"
  162.  
  163. set +u; msg2 'Enabling copy+paste in unsigned applets...'; set -u
  164. # Copy/paste from system clipboard to unsigned Java applets has been disabled since 6u24:
  165. # - https://blogs.oracle.com/kyle/entry/copy_and_paste_in_java
  166. # - http://slightlyrandombrokenthoughts.blogspot.com/2011/03/oracle-java-applet-clipboard-injection.html
  167. local _text='\
  168. // (AUR) Allow unsigned applets to read system clipboard, see:
  169. // - https://blogs.oracle.com/kyle/entry/copy_and_paste_in_java
  170. // - http://slightlyrandombrokenthoughts.blogspot.com/2011/03/oracle-java-applet-clipboard-injection.html
  171. permission java.awt.AWTPermission "accessClipboard";'
  172. local _lf=$'\n'
  173. _text="${_text//${_lf}/\\n}"
  174. local _line
  175. _line="$(awk '/permission/{a=NR}; END{print a}' "${pkgdir}/etc/java-${_jname}/security/java.policy")"
  176. sed -e "${_line} a ${_text}" -i "${pkgdir}/etc/java-${_jname}/security/java.policy"
  177. set +u
  178. }
  179. set +u
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement