PKGBUILDs/extra/java7-openjdk/jdk7-openjdk.install

51 lines
1 KiB
Text
Raw Permalink Normal View History

2014-10-12 20:27:25 +00:00
THIS_JDK='java-7-openjdk'
2014-08-17 15:22:03 +00:00
2014-10-12 20:27:25 +00:00
fix_default() {
if [ ! -x /usr/bin/java ]; then
/usr/bin/archlinux-java unset
echo ""
2014-08-17 15:22:03 +00:00
else
2014-10-12 20:27:25 +00:00
/usr/bin/archlinux-java get
2014-08-17 15:22:03 +00:00
fi
2014-10-12 20:27:25 +00:00
}
post_install() {
default=$(fix_default)
case ${default} in
"" | ${THIS_JDK}/jre)
/usr/bin/archlinux-java set ${THIS_JDK}
;;
${THIS_JDK})
# Nothing
;;
*)
echo "Default Java environment is already set to '${default}'"
echo "See 'archlinux-java help' to change it"
;;
esac
2014-08-17 15:22:03 +00:00
if [ ! -f /etc/ssl/certs/java/cacerts ]; then
2014-12-11 14:10:00 +00:00
/usr/bin/update-ca-trust
2014-08-17 15:22:03 +00:00
fi
}
post_upgrade() {
2014-10-12 20:27:25 +00:00
default=$(fix_default)
if [ -z "${default}" -o "x${default}" = "x${THIS_JDK}/jre" ]; then
/usr/bin/archlinux-java set ${THIS_JDK}
2014-08-17 15:22:03 +00:00
fi
if [ ! -f /etc/ssl/certs/java/cacerts ]; then
2014-12-11 14:10:00 +00:00
/usr/bin/update-ca-trust
2014-08-17 15:22:03 +00:00
fi
}
pre_remove() {
2014-10-12 20:27:25 +00:00
if [ "x$(fix_default)" = "x${THIS_JDK}" ]; then
sudo /usr/bin/archlinux-java unset
if [ -x /usr/lib/jvm/${THIS_JDK}/jre/bin/java ]; then
sudo /usr/bin/archlinux-java set ${THIS_JDK}/jre
fi
2014-08-17 15:22:03 +00:00
fi
}