From 157a8450bc957c7035273e6a2c3ad0ce928bb9c5 Mon Sep 17 00:00:00 2001 From: Kevin Mihelich Date: Sun, 17 Aug 2014 15:22:03 +0000 Subject: [PATCH] extra/java7-openjdk fix --- extra/java7-openjdk/jdk7-openjdk.install | 38 ++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 extra/java7-openjdk/jdk7-openjdk.install diff --git a/extra/java7-openjdk/jdk7-openjdk.install b/extra/java7-openjdk/jdk7-openjdk.install new file mode 100644 index 000000000..01ad34c81 --- /dev/null +++ b/extra/java7-openjdk/jdk7-openjdk.install @@ -0,0 +1,38 @@ +this_java='java-7-openjdk' + +post_install() { + default=$(/usr/bin/archlinux-java get) + if [ -z "${default}" ]; then + /usr/bin/archlinux-java set ${this_java} + elif [ "${default/\/jre}" = "${this_java/\/jre}" ]; then + /usr/bin/archlinux-java fix + else + echo "Default Java environment is already set to '${default}'" + echo "To set '${this_java}' as default, consider using:" + echo " archlinux-java set '${this_java}'" + fi + + if [ ! -f /etc/ssl/certs/java/cacerts ]; then + JAVA_HOME=/usr/lib/jvm/java-default-runtime /usr/bin/init-jks-keystore + fi +} + +post_upgrade() { + default=$(/usr/bin/archlinux-java get) + if [ -z "${default}" ]; then + /usr/bin/archlinux-java set ${this_java} + elif [ "${default/\/jre}" = "${this_java/\/jre}" ]; then + /usr/bin/archlinux-java fix + fi + + if [ ! -f /etc/ssl/certs/java/cacerts ]; then + JAVA_HOME=/usr/lib/jvm/java-default-runtime /usr/bin/init-jks-keystore + fi +} + +pre_remove() { + default=$(/usr/bin/archlinux-java get) + if [ "${default/\/jre}" = "${this_java/\/jre}" ]; then + /usr/bin/archlinux-java set ${this_java}/jre + fi +}