aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuraj Lutter <otis@FreeBSD.org>2025-12-08 19:59:47 +0000
committerJuraj Lutter <otis@FreeBSD.org>2025-12-09 07:46:59 +0000
commit7d6bfe80fab9ba9d506dc4aef8e79b04073792e4 (patch)
tree27fb85c36fc097f50cdf3ca15283e16925ad45d2
parentd805780b3f67d10c8430c8f818c5cfd359b978fe (diff)
net-mgmt/unifi10: Add new port
Add version 10.x of UniFi controller. See UPDATING entry for details. Release notes: https://community.ui.com/releases/r/network/10.0.160
-rw-r--r--UPDATING10
-rw-r--r--net-mgmt/Makefile1
-rw-r--r--net-mgmt/unifi10/Makefile101
-rw-r--r--net-mgmt/unifi10/distinfo5
-rw-r--r--net-mgmt/unifi10/files/pkg-message.extdb.in19
-rw-r--r--net-mgmt/unifi10/files/unifi.in93
-rw-r--r--net-mgmt/unifi10/pkg-descr2
7 files changed, 231 insertions, 0 deletions
diff --git a/UPDATING b/UPDATING
index e2fd7a5200a6..3c546d361b48 100644
--- a/UPDATING
+++ b/UPDATING
@@ -5,6 +5,16 @@ they are unavoidable.
You should get into the habit of checking this file for changes each time
you update your ports collection, before attempting any port upgrades.
+20251208:
+ AFFECTS: users of net-mgmt/unifi{9,10}
+ AUTHOR: otis@FreeBSD.org
+
+ Version 10 of UniFi controller has been introduced, conflicting with
+ version 9.
+
+ Users are strongly advised to make a fresh backup of UniFi controller
+ database from within the UI, prior to upgrade to unifi10.
+
20251201:
AFFECTS: users of lang/php83
AUTHOR: bofh@FreeBSD.org
diff --git a/net-mgmt/Makefile b/net-mgmt/Makefile
index a9abaed72644..5f158dab16de 100644
--- a/net-mgmt/Makefile
+++ b/net-mgmt/Makefile
@@ -411,6 +411,7 @@
SUBDIR += triton-guesttools
SUBDIR += unbound_exporter
SUBDIR += unifi9
+ SUBDIR += unifi10
SUBDIR += victoria-logs
SUBDIR += victoria-metrics
SUBDIR += virt-viewer
diff --git a/net-mgmt/unifi10/Makefile b/net-mgmt/unifi10/Makefile
new file mode 100644
index 000000000000..04aba4e5ed9e
--- /dev/null
+++ b/net-mgmt/unifi10/Makefile
@@ -0,0 +1,101 @@
+PORTNAME= unifi10
+PORTVERSION= 10.0.160
+PORTREVISION?= 0
+CATEGORIES= net-mgmt java
+MASTER_SITES= http://dl.ubnt.com/unifi/%SUBDIR%/:unifi \
+ https://repo1.maven.org/maven2/%SUBDIR%/:jax
+MASTER_SITE_SUBDIR= ${PORTVERSION}/:unifi \
+ javax/activation/${_JAX_DISTNAME}/${_JAX_VERSION}/:jax
+DISTFILES= unifi_sysvinit_all.deb:unifi \
+ ${_JAX_DISTNAME}-${_JAX_VERSION}.jar:jax
+DIST_SUBDIR= ${PORTNAME}-${PORTVERSION}
+EXTRACT_ONLY= unifi_sysvinit_all.deb
+
+MAINTAINER= otis@FreeBSD.org
+COMMENT= UniFi Controller v10
+WWW= https://help.ui.com/hc/en-us/categories/200320654-UniFi-Wireless
+
+RUN_DEPENDS= snappyjava>0:archivers/snappy-java
+
+FLAVORS= default armv80a externaldb
+FLAVOR?= ${FLAVORS:[1]}
+
+armv80a_PKGNAMESUFFIX= -armv80a
+externaldb_PKGNAMESUFFIX= -externaldb
+
+USES= cpe java
+CPE_VENDOR= ui
+CPE_PRODUCT= unifi_controller
+JAVA_VERSION= 17
+USE_RC_SUBR= unifi
+
+CONFLICTS_INSTALL= unifi9
+
+EXTRACT_CMD= ${AR}
+EXTRACT_BEFORE_ARGS= -p
+EXTRACT_AFTER_ARGS= data.tar.xz | ${TAR} -xf -
+
+NO_ARCH= yes
+NO_BUILD= yes
+
+SUB_LIST+= GROUPS=${GROUPS} \
+ JAVA=${JAVA} \
+ JAVA_HOME=${JAVA_HOME} \
+ JAVASHAREDIR=${JAVASHAREDIR} \
+ USERS=${USERS}
+
+NO_WRKSUBDIR= yes
+
+USERS= unifi
+GROUPS= unifi
+
+OPTIONS_DEFINE= EXTERNALDB
+
+.if ${FLAVOR:U} == armv80a
+MONGODB_PKGNAMESUFFIX= -${FLAVOR}
+.endif
+.if ${FLAVOR:U} == externaldb
+OPTIONS_DEFAULT+= EXTERNALDB
+.endif
+
+EXTERNALDB_DESC= Use external MongoDB server
+EXTERNALDB_VARS= PKGMESSAGE+=${WRKSRC}/pkg-message.extdb \
+ SUB_FILES+=pkg-message.extdb
+EXTERNALDB_VARS_OFF= RUN_DEPENDS+=mongodb70${MONGODB_PKGNAMESUFFIX}>0:databases/mongodb70@${FLAVOR}
+
+_DIR_LIST= conf data logs run work
+_JAX_DISTNAME= javax.activation-api
+_JAX_VERSION= 1.2.0
+_SNAPPY_VERSION= 1.1.10.5
+
+post-extract:
+ ${INSTALL_DATA} ${DISTDIR}/${DIST_SUBDIR}/${_JAX_DISTNAME}-${_JAX_VERSION}.jar \
+ ${WRKSRC}/usr/lib/unifi/lib/
+
+post-patch:
+ (cd ${WRKSRC}/usr/lib/unifi/lib/local && \
+ ${RM} snappy-java-${_SNAPPY_VERSION}.jar && \
+ ${LN} -f -s ${JAVAJARDIR}/snappy-java.jar snappy-java-${_SNAPPY_VERSION}.jar)
+ ${RM} -r ${WRKSRC}/usr/lib/unifi/lib/native
+
+do-install:
+ ${MKDIR} ${STAGEDIR}${JAVASHAREDIR}/unifi
+ (cd ${WRKSRC}/usr/lib/unifi && \
+ ${COPYTREE_SHARE} . ${STAGEDIR}${JAVASHAREDIR}/unifi)
+# Create directories that will be writable by unifi
+.for i in data logs run work
+ ${MKDIR} ${STAGEDIR}/${JAVASHAREDIR}/unifi/${i}
+.endfor
+
+do-install-EXTERNALDB-off:
+ ${LN} -sf ${PREFIX}/bin/mongod ${STAGEDIR}${JAVASHAREDIR}/unifi/bin/mongod
+
+post-install:
+ @${FIND} -s ${STAGEDIR}${JAVASHAREDIR}/unifi -not -type d | \
+ ${SORT} | ${SED} -e 's#^${STAGEDIR}${PREFIX}/##' >> ${TMPPLIST}
+.for dir in ${_DIR_LIST}
+ @${ECHO} "@dir(unifi,wheel,) ${JAVASHAREDIR}/unifi/${dir}" >> \
+ ${TMPPLIST}
+.endfor
+
+.include <bsd.port.mk>
diff --git a/net-mgmt/unifi10/distinfo b/net-mgmt/unifi10/distinfo
new file mode 100644
index 000000000000..90232fdcb0ba
--- /dev/null
+++ b/net-mgmt/unifi10/distinfo
@@ -0,0 +1,5 @@
+TIMESTAMP = 1765223753
+SHA256 (unifi10-10.0.160/unifi_sysvinit_all.deb) = 7023c198cc3fac83021b935f5555a980c7e991e6928295d623f696f9ba9263be
+SIZE (unifi10-10.0.160/unifi_sysvinit_all.deb) = 124264822
+SHA256 (unifi10-10.0.160/javax.activation-api-1.2.0.jar) = 43fdef0b5b6ceb31b0424b208b930c74ab58fac2ceeb7b3f6fd3aeb8b5ca4393
+SIZE (unifi10-10.0.160/javax.activation-api-1.2.0.jar) = 56674
diff --git a/net-mgmt/unifi10/files/pkg-message.extdb.in b/net-mgmt/unifi10/files/pkg-message.extdb.in
new file mode 100644
index 000000000000..945b333966c7
--- /dev/null
+++ b/net-mgmt/unifi10/files/pkg-message.extdb.in
@@ -0,0 +1,19 @@
+[
+{ type: install
+ message: <<EOM
+In order to use the external MongoDB server, put the following lines
+into %%JAVASHAREDIR%%/unifi/data/system.properties file:
+
+db.mongo.local=false
+db.mongo.uri=mongodb://ubnt:password@IP_ADDRESS:PORT/unifi-test
+statdb.mongo.uri=mongodb://ubnt:password@IP_ADDRESS:PORT/unifi-test_stat
+unifi.db.name=unifi-test
+
+Adjust username, password, IP_ADDRESS, PORT and database name
+according to your needs.
+
+For more information see:
+https://community.ui.com/questions/External-MongoDB-Server/d311a8f8-43b6-4aeb-859d-eefec9dc1bbc
+EOM
+}
+]
diff --git a/net-mgmt/unifi10/files/unifi.in b/net-mgmt/unifi10/files/unifi.in
new file mode 100644
index 000000000000..24c27141bebe
--- /dev/null
+++ b/net-mgmt/unifi10/files/unifi.in
@@ -0,0 +1,93 @@
+#!/bin/sh
+#
+# Created by: Mark Felder <feld@FreeBSD.org>
+
+# PROVIDE: unifi
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+
+#
+# Add the following line to /etc/rc.conf to enable `unifi':
+#
+# unifi_enable="YES"
+#
+# Other configuration settings for unifi that can be set in /etc/rc.conf:
+#
+# unifi_user (str)
+# This is the user that unifi runs as
+# Set to %%USERS%% by default
+#
+# unifi_group (str)
+# This is the group that unifi runs as
+# Set to %%GROUPS%% by default
+#
+# unifi_chdir (str)
+# This is the directory that unifi chdirs into before starting
+# Set to %%JAVASHAREDIR%%/unifi by default
+#
+# unifi_java_home (str)
+# The path to the base directory for the Java to use to run unifi
+# Defaults to %%JAVA_HOME%%
+#
+# unifi_javaflags (str)
+# Flags passed to Java to run unifi
+# Set to "-Djava.awt.headless=true -Xmx1024M" by default
+#
+
+. /etc/rc.subr
+name=unifi
+
+rcvar=unifi_enable
+load_rc_config ${name}
+
+: ${unifi_enable:=NO}
+: ${unifi_user:=%%USERS%%}
+: ${unifi_group:=%%GROUPS%%}
+: ${unifi_chdir=%%JAVASHAREDIR%%/unifi}
+: ${unifi_java_home=%%JAVA_HOME%%}
+: ${unifi_javaflags="-Djava.awt.headless=true \
+ -Djava.net.preferIPv4Stack=false \
+ -Dapple.awt.UIElement=true \
+ -Dfile.encoding=UTF-8 \
+ -Xmx1024M \
+ --add-opens java.base/java.lang=ALL-UNNAMED \
+ --add-opens java.base/java.time=ALL-UNNAMED \
+ --add-opens java.base/sun.security.util=ALL-UNNAMED \
+ --add-opens java.base/java.io=ALL-UNNAMED \
+ --add-opens java.rmi/sun.rmi.transport=ALL-UNNAMED"}
+
+pidfile="/var/run/unifi/${name}.pid"
+procname=${unifi_java_home}/bin/java
+command=/usr/sbin/daemon
+command_args="-f -p ${pidfile} ${unifi_java_home}/bin/java ${unifi_javaflags} -jar lib/ace.jar start"
+start_precmd=start_precmd
+stop_precmd=stop_precmd
+stop_postcmd=stop_postcmd
+
+export CLASSPATH=$(echo ${unifi_chdir}/lib/*.jar | tr ' ' ':')
+
+start_precmd()
+{
+ if [ ! -e /var/run/unifi ] ; then
+ install -d -o %%USERS%% -g %%GROUPS%% /var/run/unifi;
+ fi
+}
+
+stop_precmd()
+{
+ if [ -r ${pidfile} ]; then
+ _UNIFIPID=$(check_pidfile ${pidfile} ${procname})
+ export _UNIFI_CHILDREN=$(pgrep -P ${_UNIFIPID})
+ fi
+}
+
+stop_postcmd()
+{
+ if ! [ -z ${_UNIFI_CHILDREN} ]; then
+ echo "Cleaning up leftover child processes."
+ kill $sig_stop ${_UNIFI_CHILDREN}
+ wait_for_pids ${_UNIFI_CHILDREN}
+ fi
+}
+
+run_rc_command "$1"
diff --git a/net-mgmt/unifi10/pkg-descr b/net-mgmt/unifi10/pkg-descr
new file mode 100644
index 000000000000..36573c9e0af5
--- /dev/null
+++ b/net-mgmt/unifi10/pkg-descr
@@ -0,0 +1,2 @@
+The UniFi Controller allows you to manage Wireless, Routing & Switching,
+VoIP and Video of Ubiquiti Networks.