summarylogtreecommitdiffstats
path: root/jdk10.install
diff options
context:
space:
mode:
Diffstat (limited to 'jdk10.install')
-rw-r--r--jdk10.install74
1 files changed, 74 insertions, 0 deletions
diff --git a/jdk10.install b/jdk10.install
new file mode 100644
index 000000000000..abec489109fc
--- /dev/null
+++ b/jdk10.install
@@ -0,0 +1,74 @@
+VERSION='<version>'
+THIS_JAVA="java-${VERSION}-jdk"
+NAME="JDK ${VERSION}"
+
+all_off="$(tput sgr0)"
+bold="${all_off}$(tput bold)"
+blue="${bold}$(tput setaf 4)"
+yellow="${bold}$(tput setaf 3)"
+
+note() {
+ printf "${blue}::${yellow} archlinux-java:${bold} $1${all_off}\n"
+}
+
+note2() {
+ printf "${blue}==>${yellow} NOTE:${bold} $1${all_off}\n"
+}
+
+post_install() {
+ default=$(archlinux-java get)
+ case ${default} in
+ "")
+ archlinux-java set ${THIS_JAVA}
+ note "${NAME} ('${THIS_JAVA}') set as default Java environment."
+ ;;
+ ${THIS_JAVA})
+ note "${NAME} ('${THIS_JAVA}') set as default Java environment."
+ ;;
+ *)
+ note "Default Java environment already set to '${default}'.
+ To use ${NAME} ('${THIS_JAVA}'), run:
+ # archlinux-java set ${THIS_JAVA}
+ For status, use:
+ $ archlinux-java status"
+ ;;
+ esac
+
+ if [[ ! -f /etc/ssl/certs/java/cacerts ]]; then
+ update-ca-trust
+ fi
+
+ note2 "Since Oracle Java 9, some Qt 5 applications (such as the reader apps Zeal and
+ GoldenDict) will crash due to the existance of the Java NPAPI plugin symlink
+ (/usr/lib/mozilla/plugins/libnpjp2-jdk${VERSION}.so).
+
+ See:
+ - https://github.com/zealdocs/zeal/issues/802
+ - https://bbs.archlinux.org/viewtopic.php?id=231222"
+}
+
+post_upgrade() {
+ post_install
+}
+
+pre_remove() {
+ default=$(archlinux-java get)
+ if [[ ${default} = ${THIS_JAVA} ]]; then
+ archlinux-java unset
+ fi
+}
+
+post_remove() {
+ default=$(archlinux-java get) # reassign
+ if [[ ${default} ]]; then
+ note "Default Java environment is '${default}'."
+ else
+ archlinux-java fix
+ default=$(archlinux-java get) # re-reassign
+ if [[ ${default} ]]; then
+ note "Default Java environment left as '${default}'."
+ else
+ note "Java environment unset."
+ fi
+ fi
+}