diff options
author | Florian Schmaus <flow@gentoo.org> | 2024-02-24 18:14:37 +0100 |
---|---|---|
committer | Florian Schmaus <flow@gentoo.org> | 2024-02-24 18:16:30 +0100 |
commit | c58904de2aa6ac418ead3f67f73a5dfe4c00ec31 (patch) | |
tree | 611e1988b64e86ceeb17bff5d0f8156733f8f465 /app-misc/openhab-bin/openhab-bin-4.1.1.ebuild | |
parent | acct-user/openhab: new package, add 0 (diff) | |
download | gentoo-c58904de2aa6ac418ead3f67f73a5dfe4c00ec31.tar.gz gentoo-c58904de2aa6ac418ead3f67f73a5dfe4c00ec31.tar.bz2 gentoo-c58904de2aa6ac418ead3f67f73a5dfe4c00ec31.zip |
app-misc/openhab-bin: new package, add 4.1.1
Signed-off-by: Florian Schmaus <flow@gentoo.org>
Diffstat (limited to 'app-misc/openhab-bin/openhab-bin-4.1.1.ebuild')
-rw-r--r-- | app-misc/openhab-bin/openhab-bin-4.1.1.ebuild | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/app-misc/openhab-bin/openhab-bin-4.1.1.ebuild b/app-misc/openhab-bin/openhab-bin-4.1.1.ebuild new file mode 100644 index 000000000000..9329ab0ccca3 --- /dev/null +++ b/app-misc/openhab-bin/openhab-bin-4.1.1.ebuild @@ -0,0 +1,103 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit systemd tmpfiles + +MY_PN=${PN%-bin} +MY_P=${MY_PN}-${PV} + +DESCRIPTION="An open-source automation software for your home" +HOMEPAGE="https://www.openhab.org/" +SRC_URI=" + https://github.com/openhab/openhab-distro/releases/download/${PV}/${MY_P}.zip + https://raw.githubusercontent.com/openhab/openhab-linuxpkg/10061acd36524afb12a033fea6dcf142b399bf56/resources/usr/bin/openhab-cli + -> openhab-cli-2024-01-14 +" +KEYWORDS="~amd64 ~arm64" + +LICENSE="EPL-2.0" +SLOT="0" + +MY_JAVA_DEPEND=">=virtual/jre-17" + +# app-arch/zip: openhab-cli backup +RDEPEND=" + ${MY_JAVA_DEPEND} + acct-user/openhab + app-arch/zip + dev-java/java-config +" + +BDEPEND="app-arch/unzip" + +S="${WORKDIR}" + +src_compile() { + : +} + +src_install() { + # We use move here to preserve the executable bit on the files under + # openhab/runtime/bin. + domove() { + local source="${1}" + local target="${2}" + + local dest="${ED}/${target}" + + mkdir -p "${dest}" || die "Failed to create ${dest}" + mv "${source}"/* "${dest}" || die "Failed to move" + } + + domove runtime /usr/share/openhab/runtime + domove conf /etc/openhab + + domove userdata /var/lib/openhab + fowners -R openhab:openhab /var/lib/openhab + + local dirs=( + /usr/share/openhab/addons + /var/log/openhab + ) + local d + for d in "${dirs[@]}"; do + keepdir "${d}" + fowners openhab:openhab "${d}" + done + + newenvd "${FILESDIR}"/openhab.env 50openhab + + systemd_dounit "${FILESDIR}"/openhab.service + newtmpfiles "${FILESDIR}"/openhab.tmpfiles openhab.conf + + newbin - openhab <<EOF +#!/usr/bin/env bash +set -eu + +if [[ -v JAVA_HOME_OVERRIDE ]]; then + JAVA_HOME="\${JAVA_HOME_OVERRIDE}" +else + if ! GENTOO_JAVA_VM="\$(depend-java-query --get-vm '${MY_JAVA_DEPEND}')"; then + >&2 echo "Could not find Java VM for ${MY_JAVA_DEPEND}" + exit 1 + fi + + if ! JAVA_HOME_ASSIGNMENT=\$(java-config -P \${GENTOO_JAVA_VM} | grep JAVA_HOME); then + >&2 echo "Could not retrieve JAVA_HOME of \${GENTOO_JAVA_VM}" + exit 1 + fi + + eval \${JAVA_HOME_ASSIGNMENT} +fi + +export JAVA_HOME +exec /usr/share/openhab/runtime/bin/karaf "\$@" +EOF + newbin "${DISTDIR}"/openhab-cli-2024-01-14 openhab-cli +} + +pkg_postinst() { + tmpfiles_process openhab.conf +} |