aboutsummaryrefslogtreecommitdiffstats
path: root/non-free
diff options
context:
space:
mode:
authorCarlo Landmeter <clandmeter@alpinelinux.org>2017-12-05 23:37:56 +0000
committerCarlo Landmeter <clandmeter@alpinelinux.org>2017-12-05 23:39:27 +0000
commite29a96d23c931d911574bc297c7752214859303c (patch)
tree044398a2c892ffc1b00237cf752d754e096bbc78 /non-free
parent1b6cb62539ac826131cbbb015b5fa2833db42fbe (diff)
downloadaports-e29a96d23c931d911574bc297c7752214859303c.tar.gz
aports-e29a96d23c931d911574bc297c7752214859303c.tar.bz2
aports-e29a96d23c931d911574bc297c7752214859303c.tar.xz
non-free/unifi: new aport
ref: https://github.com/alpinelinux/aports/pull/2530
Diffstat (limited to 'non-free')
-rw-r--r--non-free/unifi/APKBUILD74
-rw-r--r--non-free/unifi/unifi.initd16
-rw-r--r--non-free/unifi/unifi.logrotated11
-rw-r--r--non-free/unifi/unifi.pre-install6
4 files changed, 107 insertions, 0 deletions
diff --git a/non-free/unifi/APKBUILD b/non-free/unifi/APKBUILD
new file mode 100644
index 0000000000..07a05ea961
--- /dev/null
+++ b/non-free/unifi/APKBUILD
@@ -0,0 +1,74 @@
+# Maintainer: TBK <alpine@jjtc.eu>
+# Contributer: TBK <alpine@jjtc.eu>
+pkgname=unifi
+_pkgname=UniFi
+pkgver=5.6.22
+pkgrel=0
+pkgdesc="The Ubiquiti UniFi network controller"
+url="http://wiki.ubnt.com/UniFi_FAQ"
+arch="noarch"
+license="UniFi-EULA"
+depends="openjdk8-jre-base java-snappy mongodb"
+install="$pkgname.pre-install"
+pkgusers="$pkgname"
+pkggroups="$pkgname"
+options="!check !fhs"
+subpackages="$pkgname-doc"
+source="$pkgname-$pkgver.zip::https://dl.ubnt.com/$pkgname/$pkgver/$_pkgname.unix.zip
+ $pkgname.initd
+ $pkgname.logrotated
+ "
+builddir="$srcdir/$_pkgname"
+
+prepare() {
+ default_prepare
+ # removing libubnt_webrtc_jni.so which disables rtc support
+ # which disabled cloud features (afaik)
+ rm -rf "$builddir"/lib/native
+}
+
+package() {
+ cd "$builddir"
+ # unifi wants everything in a base directory but we dont
+ local basedir="$pkgdir/usr/lib/$pkgname"
+ local datadir="$pkgdir/var/lib/$pkgname"
+ local webapps="$pkgdir/usr/share/webapps"
+
+ mkdir -p $basedir/bin $datadir $webapps
+
+ install -Dm644 "$srcdir"/$pkgname.logrotated \
+ "$pkgdir"/etc/logrotate.d/$pkgname
+ install -Dm755 "$srcdir"/$pkgname.initd \
+ "$pkgdir"/etc/init.d/$pkgname
+ install -Dm644 readme.txt \
+ "$pkgdir"/usr/share/doc/$pkgname/readme.txt
+
+ cp -r webapps $webapps/$pkgname
+
+ local dir; for dir in dl lib conf; do
+ cp -r $dir "$basedir"/
+ done
+
+ local dir; for dir in work data; do
+ install -dm 755 -o $pkgname -g $pkgname "$datadir/$dir"
+ done
+
+ # link things back to basedir
+ ln -sf /usr/bin/mongod $basedir/bin/mongod
+ ln -sf /var/log/$pkgname $basedir/logs
+ ln -sf /run/$pkgname $basedir/run
+ ln -sf /usr/share/webapps/$pkgname $basedir/webapps
+ ln -sf /var/lib/$pkgname/data $basedir/data
+ ln -sf /var/lib/$pkgname/work $basedir/work
+
+
+ # overwrite with local snappy
+ ln -sf /usr/share/java/snappy-java-1.1.2.6.jar \
+ "$basedir"/lib/snappy-java-1.1.2.6.jar
+
+ # make sure datadir is writable by our user
+ chown -R $pkgname:$pkgname $datadir
+}
+sha512sums="5fa9f0b6904c61b13e1c2430c0244404797795c119323eec61c296e6412184a114389d3db62e4d70e274d972768e030c8436820f2c20ac23767d145e8f8fedcc unifi-5.6.22.zip
+d0f5a6fe23e4d9e24f0beb7b8c1d19be99ebc27784457a802f49c4d0f1b3182a0d22f820a289a728db93d65fcb0b46397dc7cd57f793c9b48bbc876f97250423 unifi.initd
+c4293d5908b7a843044c9f9645232c7a385f92384eb52b040039ead1cbc4f8902e7276ac9650b2842d8014ce06cdd1de445a55c84d80dcf994626fbf356bdf65 unifi.logrotated"
diff --git a/non-free/unifi/unifi.initd b/non-free/unifi/unifi.initd
new file mode 100644
index 0000000000..bfb0d84229
--- /dev/null
+++ b/non-free/unifi/unifi.initd
@@ -0,0 +1,16 @@
+#!/sbin/openrc-run
+
+supervisor=supervise-daemon
+command=/usr/bin/java
+command_args="-jar lib/ace.jar start"
+command_user="unifi"
+pidfile=/run/unifi/${RC_SVCNAME}.pid
+command_background=yes
+supervise_daemon_args="--chdir /usr/lib/unifi \
+ --stdout /var/log/unifi/${RC_SVCNAME}.log \
+ --stderr /var/log/unifi/${RC_SVCNAME}.log"
+
+start_pre() {
+ checkpath --directory --owner $command_user --mode 0775 \
+ /run/unifi /var/log/unifi
+}
diff --git a/non-free/unifi/unifi.logrotated b/non-free/unifi/unifi.logrotated
new file mode 100644
index 0000000000..2e33dde9bb
--- /dev/null
+++ b/non-free/unifi/unifi.logrotated
@@ -0,0 +1,11 @@
+/var/log/unifi/*.log {
+ daily
+ rotate 10
+ missingok
+ notifempty
+ compress
+ sharedscripts
+ postrotate
+ /etc/init.d/unifi --ifstarted --quiet restart
+ endscript
+}
diff --git a/non-free/unifi/unifi.pre-install b/non-free/unifi/unifi.pre-install
new file mode 100644
index 0000000000..382c3ca863
--- /dev/null
+++ b/non-free/unifi/unifi.pre-install
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+addgroup -S unifi 2>/dev/null
+adduser -S -D -H -h /var/lib/unifi -s /sbin/nologin -G unifi -g unifi unifi 2>/dev/null
+
+exit 0