You are not logged in.

#1 2019-02-12 15:09:21

deathangle908
Member
From: Ukraine
Registered: 2013-10-16
Posts: 35
Website

makepkg specify version of java

I want to create a new package and upload it to AUR.
Here's PKGBUILD

pkgname=cloud-explorer
pkgver=1
pkgrel=1
pkgdesc="S3 cloudExplorer"
arch=('any')
url='https://github.com/rusher81572/cloudExplorer'
depends=('java-environment')
source=('https://cloudexplorer.s3.amazonaws.com/11/cloudExplorer-11.zip')
md5sums=(SKIP)

package() {
        cd $srcdir
        mkdir -p $pkgdir/opt/cloud-explorer
        cp -r lib $pkgdir/opt/cloud-explorer
        cp -r CloudExplorer.jar $pkgdir/opt/cloud-explorer
}

I have 2 issues:
- The package requires java at least version 10. How to I specify those
- I want to create /usr/bin/cloud-explorer bin file with content :

/usr/lib/jvm/java-11-openjdk/bin/java -jar /opt/cloud-explorer/CloudExplorer.jar

How do I get rid of hardcoded path to java? User can use different java version, and java 11 couldn't be installed, but java 10 could be. If I just specify `java -jar ...` it would fail if first java in PATH in versioned below 10.

Last edited by deathangle908 (2019-02-12 15:12:05)

Offline

#2 2019-02-12 19:11:10

eschwartz
Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 2,799

Re: makepkg specify version of java

You can depend on 'java-environment>=10' to guarantee that at least one version of java that is new enough is installed. You can also add to your wrapper script, a check for "archlinux-java get" and provide an appropriate error message if the result does not match e.g. java-11-openjdk. I'm not sure what the convention for oracle java is, but the official repos only have java-10-openjdk and java-11-openjdk that match your requirement, so you could match on:

case $(archlinux-java get) in
    java-1*-openjdk)    ;;
    *) echo "please set the default java to at least java 10"; exit 1;;
esac

Last edited by eschwartz (2019-02-12 19:12:39)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#3 2019-02-14 09:19:31

deathangle908
Member
From: Ukraine
Registered: 2013-10-16
Posts: 35
Website

Re: makepkg specify version of java

eschwartz wrote:

You can depend on 'java-environment>=10' to guarantee that at least one version of java that is new enough is installed. You can also add to your wrapper script, a check for "archlinux-java get" and provide an appropriate error message if the result does not match e.g. java-11-openjdk. I'm not sure what the convention for oracle java is, but the official repos only have java-10-openjdk and java-11-openjdk that match your requirement, so you could match on:

case $(archlinux-java get) in
    java-1*-openjdk)    ;;
    *) echo "please set the default java to at least java 10"; exit 1;;
esac

Is it possible to get path of java bin of specific version without forsing user to set it as default.

: archlinux-java --help
archlinux-java <COMMAND>

COMMAND:
        status          List installed Java environments and enabled one
        get             Return the short name of the Java environment set as default
        set <JAVA_ENV>  Force <JAVA_ENV> as default
        unset           Unset current default Java environment
        fix             Fix an invalid/broken default Java environment configuration

I would want something like:

javaExecutable=$($(pacman -Ql $((archlinux-java status |grep java-1) |awk 'NR==1 {print; exit}'))  |grep java$)

But unfortunately I don't know how to get java executable from archlinux-java, or at least  package name.

Last edited by deathangle908 (2019-02-14 09:22:44)

Offline

Board footer

Powered by FluxBB