summaryrefslogtreecommitdiff
path: root/libre/java7-openjdk/jre7-openjdk-headless.install
blob: 48b79e8b0c3588e35cd60818bf9186e9d6dd9d10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
this_java='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
  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}'"
  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/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
  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/parabola-java get)
  if [ "x${default/\/jre}" = "x${this_java/\/jre}" ]; then
    /usr/bin/parabola-java unset
    echo 'No Java environment is set anymore'
  fi
}