形式
Plain text
投稿日時
2020-06-03 17:45
公開期間
無期限
  1. set -e
  2. #so what happened, one installs with puppet openjdk 11, it doesn't work
  3. #and one simply uncomment the puppet code, without reverting
  4. #the installation, so the alternatives, that provide the link to the proper
  5. #java executables, are all messy. Those need to be fixed.
  6. LIST_OF_JAVA_ALTERNATIVES=(
  7. #not including the man pages and excluding those already done manually.
  8. #javac
  9. #javadoc
  10. #javap
  11. #jcmd
  12. #jconsole
  13. #jdb
  14. #jdeprscan
  15. #jdeps
  16. jexec
  17. jexec-binfmt
  18. jfr
  19. jhsdb
  20. jimage
  21. jinfo
  22. jjs
  23. jlink
  24. jmap
  25. jmod
  26. jps
  27. jrunscript
  28. jshell
  29. jstack
  30. jstat
  31. jstatd
  32. keytool
  33. pack200
  34. rmic
  35. rmid
  36. rmiregistry
  37. serialver
  38. unpack200
  39. )
  40. for JAVA_ALT_CMD in ${LIST_OF_JAVA_ALTERNATIVES[@]}; do
  41. #find if the program has the same name in the working java installation
  42. JAVA_CMD_PATH=$( find /opt/java/bin/ /opt/java/lib/ -iname "${JAVA_ALT_CMD}" | head -1 )
  43. #the two paths where things can be, given that the jre is also there but unwanted.
  44. #if the program is only once there add it as alternative (otherwise remove the alternative)
  45. #and the path is not too short (compared to the command name itself)
  46. if [[ ${#JAVA_CMD_PATH} -gt ${#JAVA_ALT_CMD} ]] && \
  47. [[ $( echo "${JAVA_CMD_PATH}" | wc -l ) -eq 1 ]]; then
  48. update-alternatives --install /usr/bin/$JAVA_ALT_CMD $JAVA_ALT_CMD $JAVA_CMD_PATH 2000000
  49. fi
  50. #remove the previous wrong installation
  51. # the installation was in one of those two locations
  52. # /usr/lib/jvm/java-11-openjdk-amd64/bin/cmdname
  53. # /usr/lib/jvm/java-11-openjdk-amd64/lib/cmdname
  54. update-alternatives --remove $JAVA_ALT_CMD /usr/lib/jvm/java-11-openjdk-amd64/bin/$JAVA_ALT_CMD
  55. update-alternatives --remove $JAVA_ALT_CMD /usr/lib/jvm/java-11-openjdk-amd64/lib/$JAVA_ALT_CMD
  56. echo "all fine? press enter to continue"
  57. read answer
  58. done
ダウンロード 印刷用表示

このコピペの URL

JavaScript での埋め込み

iframe での埋め込み

元のテキスト