public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: app-misc/openhab-bin/, app-misc/openhab-bin/files/
@ 2024-02-24 17:16 Florian Schmaus
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Schmaus @ 2024-02-24 17:16 UTC (permalink / raw
  To: gentoo-commits

commit:     c58904de2aa6ac418ead3f67f73a5dfe4c00ec31
Author:     Florian Schmaus <flow <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 24 17:14:37 2024 +0000
Commit:     Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Sat Feb 24 17:16:30 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c58904de

app-misc/openhab-bin: new package, add 4.1.1

Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>

 app-misc/openhab-bin/Manifest                 |   2 +
 app-misc/openhab-bin/files/openhab.env        |   5 ++
 app-misc/openhab-bin/files/openhab.service    |  26 +++++++
 app-misc/openhab-bin/files/openhab.tmpfiles   |   8 ++
 app-misc/openhab-bin/metadata.xml             |  11 +++
 app-misc/openhab-bin/openhab-bin-4.1.1.ebuild | 103 ++++++++++++++++++++++++++
 6 files changed, 155 insertions(+)

diff --git a/app-misc/openhab-bin/Manifest b/app-misc/openhab-bin/Manifest
new file mode 100644
index 000000000000..a1e936b40038
--- /dev/null
+++ b/app-misc/openhab-bin/Manifest
@@ -0,0 +1,2 @@
+DIST openhab-4.1.1.zip 110909555 BLAKE2B df89e2391e8abe926635fc1e0fbb5c7b1f6a03a87ba643d68a3c8bf1ef52f8b6ca862d8655112a225e1ec2f2d9cc90e0906c40a5dc00f52b53fcb4bac8059378 SHA512 50125e025e4ed8f3ea93359a777e0944150cf157b853bc3f6e777c04956c59346d77d4f3680756241d3d71b8c57014f777601cb5ca836b8e80046ce5a5aac770
+DIST openhab-cli-2024-01-14 8633 BLAKE2B 0b0999abcb884b779087b92f9f3e08fee3662753692392fbb30d218d0fc25fd1fca613c32b8193a3365764c55ac3525f8369aeea4edbf61223cd0219209c4cbf SHA512 bf24ae776d4362e8a60a0c71cb025834e5f645a24377a87484477f544026f2fdd996a1781f1082e62197fce33a9dadb5972df22ce3e4cd9f73d3088ec5bc0a98

diff --git a/app-misc/openhab-bin/files/openhab.env b/app-misc/openhab-bin/files/openhab.env
new file mode 100644
index 000000000000..2c68436c7e15
--- /dev/null
+++ b/app-misc/openhab-bin/files/openhab.env
@@ -0,0 +1,5 @@
+OPENHAB_HOME=/usr/share/openhab
+OPENHAB_CONF=/etc/openhab
+OPENHAB_RUNTIME=/usr/share/openhab/runtime
+OPENHAB_USERDATA=/var/lib/openhab
+OPENHAB_LOGDIR=/var/log/openhab

diff --git a/app-misc/openhab-bin/files/openhab.service b/app-misc/openhab-bin/files/openhab.service
new file mode 100644
index 000000000000..1a32a07bbc4d
--- /dev/null
+++ b/app-misc/openhab-bin/files/openhab.service
@@ -0,0 +1,26 @@
+[Unit]
+Description=openHAB - empowering the smart home
+Documentation=https://www.openhab.org/docs/
+Documentation=https://community.openhab.org
+Wants=network-online.target
+After=network-online.target
+
+[Service]
+EnvironmentFile=/etc/env.d/50openhab
+EnvironmentFile=-/etc/default/openhab
+
+User=openhab
+
+WorkingDirectory=/usr/share/openhab
+ExecStart=openhab daemon
+ExecStop=openhab stop
+
+SuccessExitStatus=0 143
+RestartSec=15
+Restart=on-failure
+TimeoutStopSec=120
+
+LimitNOFILE=102642
+
+[Install]
+WantedBy=multi-user.target

diff --git a/app-misc/openhab-bin/files/openhab.tmpfiles b/app-misc/openhab-bin/files/openhab.tmpfiles
new file mode 100644
index 000000000000..41292255957b
--- /dev/null
+++ b/app-misc/openhab-bin/files/openhab.tmpfiles
@@ -0,0 +1,8 @@
+# OpenHAB, or rather jrxtx, a fork of rxtx used by OpenHAB, require write access to
+# /run/lock to access devices on serial ports.
+# See also
+# - https://bugs.gentoo.org/416439
+# - https://bugs.gentoo.org/892517
+
+#Type  Path                           Mode User Group Age Argument
+A+     /run/lock                      -    -    -     -   u:openhab:rwx

diff --git a/app-misc/openhab-bin/metadata.xml b/app-misc/openhab-bin/metadata.xml
new file mode 100644
index 000000000000..c25da2ef63e2
--- /dev/null
+++ b/app-misc/openhab-bin/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<maintainer type="person">
+		<name>Florian Schmaus</name>
+		<email>flow@gentoo.org</email>
+	</maintainer>
+	<upstream>
+		<remote-id type="github">openhab/openhab-core</remote-id>
+	</upstream>
+</pkgmetadata>

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
+}


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: app-misc/openhab-bin/, app-misc/openhab-bin/files/
@ 2024-07-25  7:21 Florian Schmaus
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Schmaus @ 2024-07-25  7:21 UTC (permalink / raw
  To: gentoo-commits

commit:     e765c8b50800a67f21a7b5e65a13a6a6971b5b8b
Author:     Florian Schmaus <flow <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 24 11:59:40 2024 +0000
Commit:     Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Thu Jul 25 07:20:39 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e765c8b5

app-misc/openhab-bin: add support for OpenRC

Thanks to Xavier Miller for the initial patches.

Closes: https://bugs.gentoo.org/936265
Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>

 app-misc/openhab-bin/files/openhab.initd               | 18 ++++++++++++++++++
 ...ab-bin-4.2.0.ebuild => openhab-bin-4.2.0-r1.ebuild} | 11 +++++++++++
 2 files changed, 29 insertions(+)

diff --git a/app-misc/openhab-bin/files/openhab.initd b/app-misc/openhab-bin/files/openhab.initd
new file mode 100644
index 000000000000..a5899b24994f
--- /dev/null
+++ b/app-misc/openhab-bin/files/openhab.initd
@@ -0,0 +1,18 @@
+#!/sbin/openrc-run
+
+pidfile=/run/${SVCNAME}.pid
+
+command_user="openhab:openhab"
+command="/usr/bin/openhab"
+command_args="daemon"
+command_background=true
+
+depend() {
+	need net
+}
+
+stop() {
+    ebegin "Stopping ${RC_SVCNAME}"
+    ${command} stop
+    eend $?
+}

diff --git a/app-misc/openhab-bin/openhab-bin-4.2.0.ebuild b/app-misc/openhab-bin/openhab-bin-4.2.0-r1.ebuild
similarity index 88%
rename from app-misc/openhab-bin/openhab-bin-4.2.0.ebuild
rename to app-misc/openhab-bin/openhab-bin-4.2.0-r1.ebuild
index 9b1c384fe722..6625624aba64 100644
--- a/app-misc/openhab-bin/openhab-bin-4.2.0.ebuild
+++ b/app-misc/openhab-bin/openhab-bin-4.2.0-r1.ebuild
@@ -96,6 +96,8 @@ export JAVA_HOME
 exec /usr/share/openhab/runtime/bin/karaf "\$@"
 EOF
 	newbin "${DISTDIR}"/openhab-cli-2024-01-14 openhab-cli
+
+	newinitd "${FILESDIR}"/openhab.initd openhab
 }
 
 pkg_postinst() {
@@ -120,5 +122,14 @@ pkg_postinst() {
 		if [[ -v openhab_service_active ]]; then
 			edob systemctl start openhab
 		fi
+	elif [[ -d /run/openrc ]]; then
+		einfo "Follow these steps to complete the update of OpenHAB:"
+		einfo
+		einfo "1. Stop the OpenHAB's service"
+		einfo "$ rc-service openhab stop"
+		einfo "2. Clean OpenHAB's cache"
+		einfo "$ openahb-cli clean-cache"
+		einfo "3. Restart OpenHAB's service"
+		einfo "$ rc-service openhab start"
 	fi
 }


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-07-25  7:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-24 17:16 [gentoo-commits] repo/gentoo:master commit in: app-misc/openhab-bin/, app-misc/openhab-bin/files/ Florian Schmaus
  -- strict thread matches above, loose matches on Subject: below --
2024-07-25  7:21 Florian Schmaus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox