commit 4acfb544321a59b918808499bd38030890826b89
Author: Richard Shaw <hobbes1069(a)gmail.com>
Date: Thu Oct 10 15:30:18 2019 -0500
Final fix for using java 1.8.0 without alternatives.
SETUP | 27 ---------------------------
unifi-cloud.xml | 6 ++++++
unifi.service | 5 +++--
unifi.spec | 6 ++++--
4 files changed, 13 insertions(+), 31 deletions(-)
---
diff --git a/SETUP b/SETUP
index 4c37e6e..c6102d7 100644
--- a/SETUP
+++ b/SETUP
@@ -1,30 +1,3 @@
-##############
-### Fedora ###
-##############
-
-For Fedora java 1.8.0 must be selected:
-
-# alternatives --config java
-
-There are 2 programs which provide 'java'.
-
- Selection Command
------------------------------------------------
- 1 java-openjdk.x86_64
(/usr/lib/jvm/java-11-openjdk-11.0.1.13-11.rolling.fc29.x86_64/bin/java)
-*+ 2 java-1.8.0-openjdk.x86_64
(/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-11.fc29.x86_64/jre/bin/java)
-
-Enter to keep the current selection[+], or type selection number:
-
-
-#######################
-#### RHEL/CentOS/SL ###
-#######################
-
-For RHEL/CentOS/SL etc, you will also need Fedora EPEL repository installed for mongodb,
on CentOS it's already available:
-
-(as root or sudo)
-# yum install epel-release
-
####################
#### All systems ###
####################
diff --git a/unifi-cloud.xml b/unifi-cloud.xml
new file mode 100644
index 0000000..08c7131
--- /dev/null
+++ b/unifi-cloud.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<service version="1.0">
+<short>unifi-cloud</short>
+<description>UniFi Cloud Access</description>
+ <port port="8883" protocol="tcp"/>
+</service>
diff --git a/unifi.service b/unifi.service
index 5e4806d..f4bf151 100644
--- a/unifi.service
+++ b/unifi.service
@@ -8,8 +8,9 @@ Type=simple
User=unifi
WorkingDirectory=/usr/share/unifi
EnvironmentFile=-/etc/sysconfig/unifi
-ExecStart=/usr/bin/java $JAVA_OPTS -jar /usr/share/unifi/lib/ace.jar start
-ExecStop=/usr/bin/java $JAVA_OPTS -jar /usr/share/unifi/lib/ace.jar stop
+Environment=JAVA_HOME=/usr/lib/jvm/jre-1.8.0
+ExecStart=/usr/lib/jvm/jre-1.8.0/bin/java $JAVA_OPTS -jar /usr/share/unifi/lib/ace.jar
start
+ExecStop=/usr/lib/jvm/jre-1.8.0/bin/java $JAVA_OPTS -jar /usr/share/unifi/lib/ace.jar
stop
Restart=on-success
[Install]
diff --git a/unifi.spec b/unifi.spec
index a0eb9a1..dda433e 100644
--- a/unifi.spec
+++ b/unifi.spec
@@ -13,7 +13,8 @@ URL:
https://unifi-sdn.ubnt.com/
Source0:
http://dl.ubnt.com/unifi/%{version}/UniFi.unix.zip#/UniFi-%{version}.unix...
Source1: unifi.service
-Source3: unifi.xml
+Source2: unifi.xml
+Source3: unifi-cloud.xml
Source4: unifi.logrotate
Source6: mongod.sh
Source100: PERMISSION-1.html
@@ -166,6 +167,7 @@ install -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
# Install firewalld config
mkdir -p %{buildroot}%{_prefix}/lib/firewalld/services
+install -pm 0644 %{SOURCE2} %{buildroot}%{_prefix}/lib/firewalld/services/
install -pm 0644 %{SOURCE3} %{buildroot}%{_prefix}/lib/firewalld/services/
# Remove non-native executables
@@ -208,7 +210,7 @@ install -pm 0755 %{SOURCE6} %{buildroot}%{_datadir}/unifi/bin/mongod
# Install sysconfig file.
mkdir -p %{buildroot}%{_sysconfdir}/sysconfig
cat > %{buildroot}%{_sysconfdir}/sysconfig/%{name} <<EOL
-JAVA_HOME=/usr/lib/jvm/java-1.8.0
+# Add site specific java options here by assining "JAVA_OPTS"
EOL