From 07ac33c000c046df51de1b1249c74ef5fbe307a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Fabian=20Silva=20Delgado?= Date: Mon, 13 Oct 2014 04:37:24 -0200 Subject: java7-openjdk-7.u65_2.5.2-3.parabola1: use new java-*-common scripts. rewrite install scripts --- libre/java7-openjdk/jre7-openjdk.install | 60 +++++++++++++++++++------------- 1 file changed, 35 insertions(+), 25 deletions(-) (limited to 'libre/java7-openjdk/jre7-openjdk.install') diff --git a/libre/java7-openjdk/jre7-openjdk.install b/libre/java7-openjdk/jre7-openjdk.install index dd1458385..45835da4d 100644 --- a/libre/java7-openjdk/jre7-openjdk.install +++ b/libre/java7-openjdk/jre7-openjdk.install @@ -1,35 +1,50 @@ -this_java='java-7-openjdk/jre' +THIS_JRE='java-7-openjdk/jre' + +fix_default() { + if [ ! -x /usr/bin/java ]; then + /usr/bin/parabola-java unset + echo "" + else + /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 + xdg-icon-resource forceupdate --theme hicolor 2> /dev/null - echo "when you use a non-reparenting window manager" - echo "set _JAVA_AWT_WM_NONREPARENTING=1 in" - echo "/etc/profile.d/jre.sh" + echo "when you use a non-reparenting window manager," + echo "set _JAVA_AWT_WM_NONREPARENTING=1 in /etc/profile.d/jre.sh" # update-desktop-database -q - - 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 } post_upgrade() { + if [ -z $(fix_default) ]; then + /usr/bin/parabola-java set ${THIS_JRE} + fi + xdg-icon-resource forceupdate --theme hicolor 2> /dev/null # update-desktop-database -q +} - 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 +pre_remove() { + if [ "x$(fix_default)" = "x${THIS_JRE/\/jre}" ]; then + /usr/bin/parabola-java unset + echo "No Java environment is set as default anymore" fi } @@ -37,9 +52,4 @@ post_remove() { xdg-icon-resource forceupdate --theme hicolor 2> /dev/null # update-desktop-database -q - - default=$(/usr/bin/parabola-java get) - if [ "${default/\/jre}" = "${this_java/\/jre}" ]; then - /usr/bin/parabola-java fix - fi } -- cgit v1.2.3-2-g168b