blob: e8222f67c6a232921c66f8cc366dc9d2d37e247b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
# Maintainer: TBK <alpine@jjtc.eu>
# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=unifi
_pkgname=UniFi
pkgver=5.8.30
pkgrel=0
pkgdesc="The Ubiquiti UniFi SDN 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" # No test suite
subpackages="$pkgname-doc $pkgname-openrc"
source="$pkgname-$pkgver.zip::https://dl.ubnt.com/unifi/$pkgver/$_pkgname.unix.zip
$pkgname.initd
$pkgname.confd
$pkgname.logrotated
mongo_prune.js
unifi_db_prune.cron
"
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 "$srcdir"/$pkgname.confd \
"$pkgdir"/etc/conf.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 but
# first we got to figure out the version
local file=$(ls lib/ | grep snappy-java)
local name=${file%.*}
local version=${name##*-}
# the java-snappy pkg has a symlink so we use that
ln -sf /usr/share/java/snappy-java.jar \
"$basedir"/lib/snappy-java-$version.jar
# make sure datadir is writable by our user
chown -R $pkgname:$pkgname $datadir
# tell search engines to do not index
echo -e "User-Agent:*\nDisallow:/" > "$webapps"/$pkgname/ROOT/robots.txt
# install purging DB job (disabled by default)
install -Dm644 "$srcdir"/mongo_prune.js "$pkgdir"/etc/unifi/mongo_prune.js
install -Dm755 "$srcdir"/unifi_db_prune.cron "$pkgdir"/etc/periodic/weekly/unifi_db_prune
}
sha512sums="0d4a714ba875e17ce359b28e2a0a967366125971f021eb95f598c7e4860c03016afadcef0a4bb6e64f30b99afb790b65aaa166ccc31bb31f268412c1a1f1bffd unifi-5.8.30.zip
b19a7d684ef2ec7c4159417c21185ccd8ce498da25405b69014fdb32e346a0077f7edc5dfc994481d12936aa8dbf22e6baf29571fd0003aaad19609d24c549f4 unifi.initd
d339555a91de7488badbedf8a4c85cff878e7d0720a8cf6a8340f51f3666dcf4878b47a1fff4c9c2846d7af140d11e48e898f8c4dba1f81c1004b76a81f0821e unifi.confd
9e54d9e1c720b8e50c9af9363105f6ea9ff2cffff7dc67477a7701aacf21ba977424fe9fbaba6a00d5f64310a2e2517e9328a7acb91a4bc06ed237139a8e0d9b unifi.logrotated
3eec528077af9b32aa065610b4ffc50537a1c851c84624eaa63287787d853c0f8c953a97bd58bc6c2cab7f9f26eaff8c8b2815a84454169f7e0d96b94dfc91ee mongo_prune.js
25d66b144403676bcb6142f4942b62c6f969a6b359ccb4dd4fcb826b1e57f902179d01182369704970b2d6094b8b3789fd375c17cec908cac53f7abf01fb2e1b unifi_db_prune.cron"
|