summaryrefslogtreecommitdiff
path: root/libre/java7-openjdk/jre7-openjdk-headless.install
diff options
context:
space:
mode:
Diffstat (limited to 'libre/java7-openjdk/jre7-openjdk-headless.install')
-rw-r--r--libre/java7-openjdk/jre7-openjdk-headless.install51
1 files changed, 29 insertions, 22 deletions
diff --git a/libre/java7-openjdk/jre7-openjdk-headless.install b/libre/java7-openjdk/jre7-openjdk-headless.install
index dae6648f0..e21f8a30d 100644
--- a/libre/java7-openjdk/jre7-openjdk-headless.install
+++ b/libre/java7-openjdk/jre7-openjdk-headless.install
@@ -1,41 +1,48 @@
-this_java='java-7-openjdk/jre'
+THIS_JRE='java-7-openjdk/jre'
-post_install() {
- default=$(/usr/bin/parabola-java get)
- if [ -z "${default}" ]; then
- /usr/bin/parabola-java set ${this_java}
- elif [ "${default/\/jre}" = "${this_java/\/jre}" ]; then
- /usr/bin/parabola-java fix
+fix_default() {
+ if [ ! -x /usr/bin/java ]; then
+ /usr/bin/parabola-java unset
+ echo ""
else
- echo "Default Java environment is already set to '${default}'"
- echo "To set '${this_java}' as default, consider using:"
- echo " parabola-java set '${this_java}'"
+ /usr/bin/parabola-java get
fi
+}
+
+post_install() {
+ default=$(fix_default)
+ case ${default} in
+ "")
+ /usr/bin/parabola-java set ${THIS_JRE}
+ ;;
+ ${THIS_JRE} | ${THIS_JRE/\/jre})
+ # Nothing
+ ;;
+ *)
+ echo "Default Java environment is already set to '${default}'"
+ echo "See 'parabola-java help' to change it"
+ ;;
+ esac
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/${this_java} /usr/bin/init-jks-keystore
+ /usr/bin/init-jks-keystore
fi
}
post_upgrade() {
- default=$(/usr/bin/parabola-java get)
- if [ -z "${default}" ]; then
- /usr/bin/parabola-java set ${this_java}
- elif [ "${default/\/jre}" = "${this_java/\/jre}" ]; then
- /usr/bin/parabola-java fix
+ if [ -z $(fix_default) ]; then
+ /usr/bin/parabola-java set ${THIS_JRE}
fi
if [ ! -f /etc/ssl/certs/java/cacerts ]; then
- JAVA_HOME=/usr/lib/jvm/${this_java} /usr/bin/init-jks-keystore
+ /usr/bin/init-jks-keystore
fi
}
pre_remove() {
- default=$(/usr/bin/parabola-java get)
- if [ "x${default/\/jre}" = "x${this_java/\/jre}" ]; then
+ default=$(fix_default)
+ if [ "x${default/\/jre}" = "x${THIS_JRE/\/jre}" ]; then
/usr/bin/parabola-java unset
- echo 'No Java environment is set anymore'
+ echo "No Java environment is set as default anymore"
fi
}