PKGBUILDs/extra/java7-openjdk/jre7-openjdk-headless.install
2014-08-17 15:10:45 +00:00

41 lines
1.3 KiB
Text

this_java='java-7-openjdk/jre'
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
# Overwrite JAVA_HOME because if it still points at java-7-openjdk AND user just removed jdk,
# Then /usr/bin/java will in the end, refer to /usr/lib/jvm/java-7-openjdk/java which doesn't exist
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 [ "x${default/\/jre}" = "x${this_java/\/jre}" ]; then
/usr/bin/archlinux-java unset
echo 'No Java environment is set anymore'
fi
}