From d57bb5f6dc5b4fad213ccdcfa4bfd321d9a84caf Mon Sep 17 00:00:00 2001 From: André Fabian Silva Delgado Date: Mon, 13 Oct 2014 04:38:47 -0200 Subject: java8-openjdk-8.u20-4.parabola1: use new java-*-common scripts. rewrite install scripts --- libre/java8-openjdk/PKGBUILD | 10 ++-- libre/java8-openjdk/install_jdk8-openjdk.sh | 52 +++++++++++-------- .../java8-openjdk/install_jre8-openjdk-headless.sh | 51 ++++++++++-------- libre/java8-openjdk/install_jre8-openjdk.sh | 60 +++++++++++++--------- 4 files changed, 99 insertions(+), 74 deletions(-) diff --git a/libre/java8-openjdk/PKGBUILD b/libre/java8-openjdk/PKGBUILD index 7ec5d8f3d..dd66e66da 100644 --- a/libre/java8-openjdk/PKGBUILD +++ b/libre/java8-openjdk/PKGBUILD @@ -15,7 +15,7 @@ _jdk_update=20 _jdk_build=23 pkgver=${_java_ver}.u${_jdk_update} _repo_ver=jdk${_java_ver}u${_jdk_update}-b${_jdk_build} -pkgrel=3.parabola1 +pkgrel=4.parabola1 arch=('i686' 'x86_64') url='http://openjdk.java.net/' license=('custom') @@ -31,7 +31,6 @@ source=(jdk8u-${_repo_ver}.tar.gz::${_url_src}/archive/${_repo_ver}.tar.gz langtools-${_repo_ver}.tar.gz::${_url_src}/langtools/archive/${_repo_ver}.tar.gz nashorn-${_repo_ver}.tar.gz::${_url_src}/nashorn/archive/${_repo_ver}.tar.gz 001_adjust-mflags-for-gmake-4.patch - 002_gcc.make-4.9.patch 003_nonreparenting-wm.patch) sha256sums=('ec0b86c0a5883f769cb951a96a0b61734aa7e3c2b62e3b448f7bf6866a36c237' @@ -43,7 +42,6 @@ sha256sums=('ec0b86c0a5883f769cb951a96a0b61734aa7e3c2b62e3b448f7bf6866a36c237' '05177c5ba5ec95d041d46e871358692ff1e62f8568c8c9580688b39e5165d580' '2499b19562e320eb304be8797c2a895f1fe2ab2d16fd7da68aeaed180b3f1899' '682104f7723c5c543c47b53f51cc5577e273a12343bd04bebd1bcd70dd72ded9' - '5b1ed72ffd14a18e36aba2129e0781696b8c9cccd060bf4dbe1c4b9a44100b69' '7d3d7ce8661d0f33ff9ad8247f8cfef528c4dff74615e64fa0ac87f4beb78db4') case "${CARCH}" in @@ -71,8 +69,6 @@ prepare() { cd "${srcdir}/jdk8u-${_repo_ver}/hotspot" # https://bugs.openjdk.java.net/browse/JDK-8028407 patch -p1 < "${srcdir}/001_adjust-mflags-for-gmake-4.patch" - # https://bugs.openjdk.java.net/browse/JDK-8041658 - patch -p1 < "${srcdir}/002_gcc.make-4.9.patch" cd "${srcdir}/jdk8u-${_repo_ver}/jdk" # https://bugs.archlinux.org/task/41846 @@ -131,7 +127,7 @@ build() { package_jre8-openjdk-headless() { pkgdesc='OpenJDK Java 8 headless runtime environment (Parabola rebranded)' - depends=('java-common' 'ca-certificates-java' 'nss') + depends=('java-runtime-common' 'ca-certificates-java' 'nss') optdepends=('java-rhino: for some JavaScript support') provides=('java-runtime-headless=8' 'java-runtime-headless-openjdk=8') # Upstream config files that should go to etc and get backup @@ -240,7 +236,7 @@ package_jre8-openjdk() { package_jdk8-openjdk() { pkgdesc='OpenJDK Java 8 development kit (Parabola rebranded)' - depends=("jre8-openjdk=${pkgver}-${pkgrel}") + depends=('java-environment-common' "jre8-openjdk=${pkgver}-${pkgrel}") provides=('java-environment=8' 'java-environment-openjdk=8') replaces=('jdk8-openjdk-wm') install=install_jdk8-openjdk.sh diff --git a/libre/java8-openjdk/install_jdk8-openjdk.sh b/libre/java8-openjdk/install_jdk8-openjdk.sh index 5aa420d24..9181a7769 100644 --- a/libre/java8-openjdk/install_jdk8-openjdk.sh +++ b/libre/java8-openjdk/install_jdk8-openjdk.sh @@ -1,38 +1,50 @@ -this_java='java-8-openjdk' +THIS_JDK='java-8-openjdk' -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 + "" | ${THIS_JDK}/jre) + /usr/bin/parabola-java set ${THIS_JDK} + ;; + ${THIS_JDK}) + # 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 - 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 + default=$(fix_default) + if [ -z "${default}" -o "x${default}" = "x${THIS_JDK}/jre" ]; then + /usr/bin/parabola-java set ${THIS_JDK} 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 [ "${default/\/jre}" = "${this_java/\/jre}" ]; then - /usr/bin/parabola-java set ${this_java}/jre + if [ "x$(fix_default)" = "x${THIS_JDK}" ]; then + sudo /usr/bin/parabola-java unset + if [ -x /usr/lib/jvm/${THIS_JDK}/jre/bin/java ]; then + sudo /usr/bin/parabola-java set ${THIS_JDK}/jre + fi fi } diff --git a/libre/java8-openjdk/install_jre8-openjdk-headless.sh b/libre/java8-openjdk/install_jre8-openjdk-headless.sh index c2fec654e..0f7157963 100644 --- a/libre/java8-openjdk/install_jre8-openjdk-headless.sh +++ b/libre/java8-openjdk/install_jre8-openjdk-headless.sh @@ -1,41 +1,48 @@ -this_java='java-8-openjdk/jre' +THIS_JRE='java-8-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-8-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 } diff --git a/libre/java8-openjdk/install_jre8-openjdk.sh b/libre/java8-openjdk/install_jre8-openjdk.sh index ab17eebcb..a5faaf0af 100644 --- a/libre/java8-openjdk/install_jre8-openjdk.sh +++ b/libre/java8-openjdk/install_jre8-openjdk.sh @@ -1,35 +1,50 @@ -this_java='java-8-openjdk/jre' +THIS_JRE='java-8-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