1 |
commit: dc0f5a4bb2025268bb62d4b6df83d5b014e37e26 |
2 |
Author: Dennis Lamm <expeditioneer <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Apr 27 18:42:28 2022 +0000 |
4 |
Commit: Conrad Kostecki <conikost <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Apr 28 20:43:57 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dc0f5a4b |
7 |
|
8 |
net-wireless/unifi: add system-mongodb useflag |
9 |
|
10 |
Signed-off-by: Dennis Lamm <expeditioneer <AT> gentoo.org> |
11 |
Package-Manager: Portage-3.0.30, Repoman-3.0.3 |
12 |
Closes: https://github.com/gentoo/gentoo/pull/25230 |
13 |
Signed-off-by: Conrad Kostecki <conikost <AT> gentoo.org> |
14 |
|
15 |
net-wireless/unifi/files/README.gentoo | 11 +++ |
16 |
net-wireless/unifi/files/unifi-mongodb.initd | 25 ++++++ |
17 |
net-wireless/unifi/files/unifi-mongodb.service | 15 ++++ |
18 |
net-wireless/unifi/metadata.xml | 3 + |
19 |
net-wireless/unifi/unifi-7.1.61-r1.ebuild | 107 +++++++++++++++++++++++++ |
20 |
5 files changed, 161 insertions(+) |
21 |
|
22 |
diff --git a/net-wireless/unifi/files/README.gentoo b/net-wireless/unifi/files/README.gentoo |
23 |
new file mode 100644 |
24 |
index 000000000000..b6284b3017ea |
25 |
--- /dev/null |
26 |
+++ b/net-wireless/unifi/files/README.gentoo |
27 |
@@ -0,0 +1,11 @@ |
28 |
+System MongoDB |
29 |
+============== |
30 |
+ |
31 |
+If you want using the system-mongodb systemd service instead of the started |
32 |
+mongodb from the unifi service please add to |
33 |
+"var/lib/unifi/data/system.properties" the following properties: |
34 |
+ |
35 |
+db.mongo.local=false |
36 |
+db.mongo.uri=mongodb\://127.0.0.1\:27017/ace |
37 |
+statdb.mongo.uri=mongodb\://127.0.0.1\:27017/ace_stat |
38 |
+unifi.db.name=ace |
39 |
|
40 |
diff --git a/net-wireless/unifi/files/unifi-mongodb.initd b/net-wireless/unifi/files/unifi-mongodb.initd |
41 |
new file mode 100644 |
42 |
index 000000000000..fb55027eb149 |
43 |
--- /dev/null |
44 |
+++ b/net-wireless/unifi/files/unifi-mongodb.initd |
45 |
@@ -0,0 +1,25 @@ |
46 |
+#!/sbin/openrc-run |
47 |
+# Copyright 1999-2022 Gentoo Authors |
48 |
+# Distributed under the terms of the GNU General Public License v2 |
49 |
+ |
50 |
+unifi_exec="/usr/bin/unifi" |
51 |
+unifi_path="/usr/lib/unifi" |
52 |
+ |
53 |
+unifi_user="unifi" |
54 |
+unifi_group="unifi" |
55 |
+ |
56 |
+name="UniFi Controller" |
57 |
+ |
58 |
+start_stop_daemon_args="--chdir ${unifi_path}" |
59 |
+ |
60 |
+command="${unifi_exec}" |
61 |
+command_args="start" |
62 |
+command_background=true |
63 |
+command_progress=true |
64 |
+command_user="${unifi_user}:${unifi_group}" |
65 |
+ |
66 |
+pidfile="/run/${RC_SVCNAME}.pid" |
67 |
+retry=TERM/60 |
68 |
+ |
69 |
+rc_after="mongodb" |
70 |
+rc_need="mongodb" |
71 |
|
72 |
diff --git a/net-wireless/unifi/files/unifi-mongodb.service b/net-wireless/unifi/files/unifi-mongodb.service |
73 |
new file mode 100644 |
74 |
index 000000000000..6d9b9d55ee2e |
75 |
--- /dev/null |
76 |
+++ b/net-wireless/unifi/files/unifi-mongodb.service |
77 |
@@ -0,0 +1,15 @@ |
78 |
+[Unit] |
79 |
+Description=UniFi Controller |
80 |
+After=mongodb.service network.target |
81 |
+Requires=mongodb.service |
82 |
+ |
83 |
+[Service] |
84 |
+Type=simple |
85 |
+User=unifi |
86 |
+Group=unifi |
87 |
+WorkingDirectory=/usr/lib/unifi |
88 |
+ExecStart=/usr/bin/unifi start |
89 |
+ExecStop=/usr/bin/unifi stop |
90 |
+ |
91 |
+[Install] |
92 |
+WantedBy=multi-user.target |
93 |
|
94 |
diff --git a/net-wireless/unifi/metadata.xml b/net-wireless/unifi/metadata.xml |
95 |
index d81a3fef9a30..4835f95389c4 100644 |
96 |
--- a/net-wireless/unifi/metadata.xml |
97 |
+++ b/net-wireless/unifi/metadata.xml |
98 |
@@ -11,4 +11,7 @@ |
99 |
Also all kind of statistics are collected, which can be accessed through UniFi. |
100 |
There is also an internal RADIUS server, which can be used for WPA2-Enterprise. |
101 |
</longdescription> |
102 |
+ <use> |
103 |
+ <flag name="system-mongodb">Using <pkg>dev-db/mongodb</pkg> systemd service instead of the bundled one</flag> |
104 |
+ </use> |
105 |
</pkgmetadata> |
106 |
|
107 |
diff --git a/net-wireless/unifi/unifi-7.1.61-r1.ebuild b/net-wireless/unifi/unifi-7.1.61-r1.ebuild |
108 |
new file mode 100644 |
109 |
index 000000000000..1db40a1dd013 |
110 |
--- /dev/null |
111 |
+++ b/net-wireless/unifi/unifi-7.1.61-r1.ebuild |
112 |
@@ -0,0 +1,107 @@ |
113 |
+# Copyright 1999-2022 Gentoo Authors |
114 |
+# Distributed under the terms of the GNU General Public License v2 |
115 |
+ |
116 |
+EAPI=8 |
117 |
+ |
118 |
+# Set this var for any releases except stable |
119 |
+RC_SUFFIX="-c7eb1400e2" |
120 |
+ |
121 |
+inherit java-pkg-2 readme.gentoo-r1 systemd |
122 |
+ |
123 |
+DESCRIPTION="A Management Controller for Ubiquiti Networks UniFi APs" |
124 |
+HOMEPAGE="https://www.ubnt.com" |
125 |
+SRC_URI="https://dl.ui.com/unifi/${PV}${RC_SUFFIX}/UniFi.unix.zip -> ${P}.zip" |
126 |
+S="${WORKDIR}/UniFi" |
127 |
+ |
128 |
+KEYWORDS="-* ~amd64 ~arm64" |
129 |
+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" |
130 |
+SLOT="0/$(ver_cut 1-2)" |
131 |
+IUSE="systemd system-mongodb" |
132 |
+RESTRICT="bindist mirror" |
133 |
+ |
134 |
+RDEPEND=" |
135 |
+ acct-group/unifi |
136 |
+ acct-user/unifi |
137 |
+ dev-db/mongodb |
138 |
+ virtual/jre:1.8 |
139 |
+" |
140 |
+ |
141 |
+BDEPEND="app-arch/unzip" |
142 |
+ |
143 |
+DOCS=( "readme.txt" ) |
144 |
+ |
145 |
+QA_PREBUILT="usr/lib/unifi/lib/native/Linux/x86_64/*.so" |
146 |
+ |
147 |
+src_prepare() { |
148 |
+ # Remove unneeded files Mac and Windows |
149 |
+ rm -r lib/native/{Mac,Windows} || die |
150 |
+ |
151 |
+ if [[ ${CHOST} != aarch64* ]]; then |
152 |
+ rm -r lib/native/Linux/aarch64 || die "Failed in removing aarch64 native libraries" |
153 |
+ fi |
154 |
+ if [[ ${CHOST} != armv7* ]]; then |
155 |
+ rm -r lib/native/Linux/armv7 || die "Failed in removing armv7 native libraries" |
156 |
+ fi |
157 |
+ if [[ ${CHOST} != x86_64* ]]; then |
158 |
+ rm -r lib/native/Linux/x86_64 || die "Failed in removing x86_64 native libraries" |
159 |
+ fi |
160 |
+ |
161 |
+ if [[ ${CHOST} == aarch64* ]]; then |
162 |
+ if ! use systemd; then |
163 |
+ rm lib/native/Linux/aarch64/libubnt_sdnotify_jni.so || die |
164 |
+ fi |
165 |
+ fi |
166 |
+ if [[ ${CHOST} == armv7* ]]; then |
167 |
+ if ! use systemd; then |
168 |
+ rm lib/native/Linux/armv7/libubnt_sdnotify_jni.so || die |
169 |
+ fi |
170 |
+ fi |
171 |
+ if [[ ${CHOST} == x86_64* ]]; then |
172 |
+ if ! use systemd; then |
173 |
+ rm lib/native/Linux/x86_64/libubnt_sdnotify_jni.so || die |
174 |
+ fi |
175 |
+ fi |
176 |
+ |
177 |
+ default |
178 |
+} |
179 |
+ |
180 |
+src_compile() { |
181 |
+ :; |
182 |
+} |
183 |
+ |
184 |
+src_install() { |
185 |
+ insinto /usr/lib/unifi |
186 |
+ doins -r dl lib webapps |
187 |
+ ! use system-mongodb && doins -r bin |
188 |
+ |
189 |
+ diropts -o unifi -g unifi |
190 |
+ keepdir /var/lib/unifi/{conf,data,run,tmp,work} /var/log/unifi |
191 |
+ |
192 |
+ for symlink in conf data run tmp work; do |
193 |
+ dosym ../../../var/lib/unifi/${symlink} /usr/lib/unifi/${symlink} |
194 |
+ done |
195 |
+ dosym ../../../var/log/unifi /usr/lib/unifi/logs |
196 |
+ |
197 |
+ java-pkg_regjar "${D}"/usr/lib/unifi/lib/*.jar |
198 |
+ java-pkg_dolauncher unifi --java_args '-Dorg.xerial.snappy.tempdir=/usr/lib/unifi/tmp -Djava.library.path=' --jar ace.jar --pwd '/usr/lib/unifi' |
199 |
+ |
200 |
+ if use system-mongodb; then |
201 |
+ systemd_newunit "${FILESDIR}"/unifi-mongodb.service unifi.service |
202 |
+ newinitd "${FILESDIR}"/unifi-mongodb.initd unifi |
203 |
+ else |
204 |
+ systemd_newunit "${FILESDIR}"/unifi.service-r2 unifi.service |
205 |
+ newinitd "${FILESDIR}"/unifi.initd-r2 unifi |
206 |
+ fi |
207 |
+ |
208 |
+ newconfd "${FILESDIR}"/unifi.confd unifi |
209 |
+ |
210 |
+ echo 'CONFIG_PROTECT="/var/lib/unifi"' > "${T}"/99unifi || die |
211 |
+ doenvd "${T}"/99unifi |
212 |
+ |
213 |
+ einstalldocs |
214 |
+ readme.gentoo_create_doc |
215 |
+} |
216 |
+ |
217 |
+pkg_postinst() { |
218 |
+ readme.gentoo_print_elog |
219 |
+} |