public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [gentoo-commits] repo/gentoo:master commit in: net-wireless/unifi/, net-wireless/unifi/files/
@ 2022-04-28 20:53 99% Conrad Kostecki
  0 siblings, 0 replies; 1+ results
From: Conrad Kostecki @ 2022-04-28 20:53 UTC (permalink / raw
  To: gentoo-commits

commit:     dc0f5a4bb2025268bb62d4b6df83d5b014e37e26
Author:     Dennis Lamm <expeditioneer <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 27 18:42:28 2022 +0000
Commit:     Conrad Kostecki <conikost <AT> gentoo <DOT> org>
CommitDate: Thu Apr 28 20:43:57 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dc0f5a4b

net-wireless/unifi: add system-mongodb useflag

Signed-off-by: Dennis Lamm <expeditioneer <AT> gentoo.org>
Package-Manager: Portage-3.0.30, Repoman-3.0.3
Closes: https://github.com/gentoo/gentoo/pull/25230
Signed-off-by: Conrad Kostecki <conikost <AT> gentoo.org>

 net-wireless/unifi/files/README.gentoo         |  11 +++
 net-wireless/unifi/files/unifi-mongodb.initd   |  25 ++++++
 net-wireless/unifi/files/unifi-mongodb.service |  15 ++++
 net-wireless/unifi/metadata.xml                |   3 +
 net-wireless/unifi/unifi-7.1.61-r1.ebuild      | 107 +++++++++++++++++++++++++
 5 files changed, 161 insertions(+)

diff --git a/net-wireless/unifi/files/README.gentoo b/net-wireless/unifi/files/README.gentoo
new file mode 100644
index 000000000000..b6284b3017ea
--- /dev/null
+++ b/net-wireless/unifi/files/README.gentoo
@@ -0,0 +1,11 @@
+System MongoDB
+==============
+
+If you want using the system-mongodb systemd service instead of the started
+mongodb from the unifi service please add to
+"var/lib/unifi/data/system.properties" the following properties:
+
+db.mongo.local=false
+db.mongo.uri=mongodb\://127.0.0.1\:27017/ace
+statdb.mongo.uri=mongodb\://127.0.0.1\:27017/ace_stat
+unifi.db.name=ace

diff --git a/net-wireless/unifi/files/unifi-mongodb.initd b/net-wireless/unifi/files/unifi-mongodb.initd
new file mode 100644
index 000000000000..fb55027eb149
--- /dev/null
+++ b/net-wireless/unifi/files/unifi-mongodb.initd
@@ -0,0 +1,25 @@
+#!/sbin/openrc-run
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+unifi_exec="/usr/bin/unifi"
+unifi_path="/usr/lib/unifi"
+
+unifi_user="unifi"
+unifi_group="unifi"
+
+name="UniFi Controller"
+
+start_stop_daemon_args="--chdir ${unifi_path}"
+
+command="${unifi_exec}"
+command_args="start"
+command_background=true
+command_progress=true
+command_user="${unifi_user}:${unifi_group}"
+
+pidfile="/run/${RC_SVCNAME}.pid"
+retry=TERM/60
+
+rc_after="mongodb"
+rc_need="mongodb"

diff --git a/net-wireless/unifi/files/unifi-mongodb.service b/net-wireless/unifi/files/unifi-mongodb.service
new file mode 100644
index 000000000000..6d9b9d55ee2e
--- /dev/null
+++ b/net-wireless/unifi/files/unifi-mongodb.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=UniFi Controller
+After=mongodb.service network.target
+Requires=mongodb.service
+
+[Service]
+Type=simple
+User=unifi
+Group=unifi
+WorkingDirectory=/usr/lib/unifi
+ExecStart=/usr/bin/unifi start
+ExecStop=/usr/bin/unifi stop
+
+[Install]
+WantedBy=multi-user.target

diff --git a/net-wireless/unifi/metadata.xml b/net-wireless/unifi/metadata.xml
index d81a3fef9a30..4835f95389c4 100644
--- a/net-wireless/unifi/metadata.xml
+++ b/net-wireless/unifi/metadata.xml
@@ -11,4 +11,7 @@
 		Also all kind of statistics are collected, which can be accessed through UniFi.
 		There is also an internal RADIUS server, which can be used for WPA2-Enterprise.
 	</longdescription>
+	<use>
+		<flag name="system-mongodb">Using <pkg>dev-db/mongodb</pkg> systemd service instead of the bundled one</flag>
+	</use>
 </pkgmetadata>

diff --git a/net-wireless/unifi/unifi-7.1.61-r1.ebuild b/net-wireless/unifi/unifi-7.1.61-r1.ebuild
new file mode 100644
index 000000000000..1db40a1dd013
--- /dev/null
+++ b/net-wireless/unifi/unifi-7.1.61-r1.ebuild
@@ -0,0 +1,107 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Set this var for any releases except stable
+RC_SUFFIX="-c7eb1400e2"
+
+inherit java-pkg-2 readme.gentoo-r1 systemd
+
+DESCRIPTION="A Management Controller for Ubiquiti Networks UniFi APs"
+HOMEPAGE="https://www.ubnt.com"
+SRC_URI="https://dl.ui.com/unifi/${PV}${RC_SUFFIX}/UniFi.unix.zip -> ${P}.zip"
+S="${WORKDIR}/UniFi"
+
+KEYWORDS="-* ~amd64 ~arm64"
+LICENSE="Apache-1.0 Apache-2.0 BSD-1 BSD-2 BSD CDDL EPL-1.0 GPL-2 LGPL-2.1 LGPL-3 MIT ubiquiti"
+SLOT="0/$(ver_cut 1-2)"
+IUSE="systemd system-mongodb"
+RESTRICT="bindist mirror"
+
+RDEPEND="
+	acct-group/unifi
+	acct-user/unifi
+	dev-db/mongodb
+	virtual/jre:1.8
+"
+
+BDEPEND="app-arch/unzip"
+
+DOCS=( "readme.txt" )
+
+QA_PREBUILT="usr/lib/unifi/lib/native/Linux/x86_64/*.so"
+
+src_prepare() {
+	# Remove unneeded files Mac and Windows
+	rm -r lib/native/{Mac,Windows} || die
+
+	if [[ ${CHOST} != aarch64* ]]; then
+		rm -r lib/native/Linux/aarch64 || die "Failed in removing aarch64 native libraries"
+	fi
+	if [[ ${CHOST} != armv7* ]]; then
+		rm -r lib/native/Linux/armv7 || die "Failed in removing armv7 native libraries"
+	fi
+	if [[ ${CHOST} != x86_64* ]]; then
+		rm -r lib/native/Linux/x86_64 || die "Failed in removing x86_64 native libraries"
+	fi
+
+	if [[ ${CHOST} == aarch64* ]]; then
+		if ! use systemd; then
+			rm lib/native/Linux/aarch64/libubnt_sdnotify_jni.so || die
+		fi
+	fi
+	if [[ ${CHOST} == armv7* ]]; then
+		if ! use systemd; then
+			rm lib/native/Linux/armv7/libubnt_sdnotify_jni.so || die
+		fi
+	fi
+	if [[ ${CHOST} == x86_64* ]]; then
+		if ! use systemd; then
+			rm lib/native/Linux/x86_64/libubnt_sdnotify_jni.so || die
+		fi
+	fi
+
+	default
+}
+
+src_compile() {
+	:;
+}
+
+src_install() {
+	insinto /usr/lib/unifi
+	doins -r dl lib webapps
+	! use system-mongodb && doins -r bin
+
+	diropts -o unifi -g unifi
+	keepdir /var/lib/unifi/{conf,data,run,tmp,work} /var/log/unifi
+
+	for symlink in conf data run tmp work; do
+		dosym ../../../var/lib/unifi/${symlink} /usr/lib/unifi/${symlink}
+	done
+	dosym ../../../var/log/unifi /usr/lib/unifi/logs
+
+	java-pkg_regjar "${D}"/usr/lib/unifi/lib/*.jar
+	java-pkg_dolauncher unifi --java_args '-Dorg.xerial.snappy.tempdir=/usr/lib/unifi/tmp -Djava.library.path=' --jar ace.jar --pwd '/usr/lib/unifi'
+
+	if use system-mongodb; then
+		systemd_newunit "${FILESDIR}"/unifi-mongodb.service unifi.service
+		newinitd "${FILESDIR}"/unifi-mongodb.initd unifi
+	else
+		systemd_newunit "${FILESDIR}"/unifi.service-r2 unifi.service
+		newinitd "${FILESDIR}"/unifi.initd-r2 unifi
+	fi
+
+	newconfd "${FILESDIR}"/unifi.confd unifi
+
+	echo 'CONFIG_PROTECT="/var/lib/unifi"' > "${T}"/99unifi || die
+	doenvd "${T}"/99unifi
+
+	einstalldocs
+	readme.gentoo_create_doc
+}
+
+pkg_postinst() {
+	readme.gentoo_print_elog
+}


^ permalink raw reply related	[relevance 99%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2022-04-28 20:53 99% [gentoo-commits] repo/gentoo:master commit in: net-wireless/unifi/, net-wireless/unifi/files/ Conrad Kostecki

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