openhab / openhab-linuxpkg

Repo for Linux packages
Eclipse Public License 2.0
18 stars 33 forks source link

openhab2 incorrectly does not depend on java #79

Closed RREE closed 6 years ago

RREE commented 6 years ago

I could install openhab2 on a raspian (Jessie) system without previous installation of any java runtime.

I created /etc/apt/sources.list.d/openhab2.list with the following contents: deb https://dl.bintray.com/openhab/apt-repo2 stable main $ aptitude update $ aptitude install openhab2 worked without any mention of java.

Only when looking into journalctl I saw the following lines: Aug 28 21:15:51 z3 start.sh[524]: /usr/share/openhab2/runtime/bin/setenv: line 176: type: java: not found Aug 28 21:15:51 z3 start.sh[524]: /usr/share/openhab2/runtime/bin/setenv: line 179: die: command not found

This was issue #526, https://github.com/openhab/openhab-distro/issues/526

BClark09 commented 6 years ago

Hi @RREE, did you see my reply to the comment:

Please note that for the later versions of openHAB, apt will now recommend Java.

We cannot depend on it via a package manager as there are many different ways of including it. For example, via manual extraction, or by installing either or multiples of Zulu/Oracle/open JDK.

ThomDietrich commented 6 years ago

@BClark09 the second part of the issue is something worth looking into, right?

BClark09 commented 6 years ago

Ah yes, but this should be resolved for 2.2 and it's current snapshots from https://github.com/openhab/openhab-distro/pull/496

ThomDietrich commented 6 years ago

Hmmm if I'm not mistaken, that is yes for die: command not but no for type: java: not found

https://github.com/openhab/openhab-distro/blob/master/distributions/openhab/src/main/resources/bin/setenv#L182

ThomDietrich commented 6 years ago

The whole block is a bit weird anyhow. How about this:

command -v java >/dev/null 2>&1 || die "java command not found"
JAVA=$(command -v java)

Just tested on a system with and without java, seems to work just fine

BClark09 commented 6 years ago

The function is written from KARAF. But it looks like they also agree with you now ;) The version of KARAF that openHAB is on now, has changed the java search function and this file is included with the latest version of openHAB. (It also slowly getting to being POSIX compatible now!)

I asked @kaikreuzer about it previously here, but thinking about it, we should probably update setenv and remove the duplicated functions that are already set in inc. Since inc is called first, I'm assuming the definitions in setenv are useless. WDYT?

ThomDietrich commented 6 years ago

But it looks like they also agree with you now ;)

Yay 🤗

BClark09 commented 6 years ago

Hi @RREE, the issues you describe should be at least addressed in the snapshots.

Whilst the package does not depend on java installation package, it will still suggest installing it during installation if it does not detect one.

journalctl -u openhab2, ./start.sh or openhab-cli start should also correctly report these problems now.

I'm going to close this issue, but please feel free to reopen it if you feel something else needs to be addressed.