aboutsummaryrefslogtreecommitdiffstats
path: root/non-free/unifi/APKBUILD
blob: 38a1f90ec5dfc7e655a6e2de043f4486fa88764e (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
# Maintainer: TBK <alpine@jjtc.eu>
# Contributer: TBK <alpine@jjtc.eu>
pkgname=unifi
_pkgname=UniFi
pkgver=5.7.20
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"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.zip::http://dl.ubnt.com/unifi/$pkgver/$_pkgname.unix.zip
	$pkgname.initd
	$pkgname.confd
	$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 "$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
	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

	# tell search engines to do not index
	echo -e "User-Agent:*\nDisallow:/" > "$webapps"/$pkgname/ROOT/robots.txt
}
sha512sums="530f666dd066fbe07e158cd138ecd900366c7b8f2c98b310ef1f18f3877cfb0feeeb6e0475f2ef8737730219cd0032e47d6bb5ecc2faa4e62765754e7e7e1c1c  unifi-5.7.20.zip
b19a7d684ef2ec7c4159417c21185ccd8ce498da25405b69014fdb32e346a0077f7edc5dfc994481d12936aa8dbf22e6baf29571fd0003aaad19609d24c549f4  unifi.initd
d339555a91de7488badbedf8a4c85cff878e7d0720a8cf6a8340f51f3666dcf4878b47a1fff4c9c2846d7af140d11e48e898f8c4dba1f81c1004b76a81f0821e  unifi.confd
9e54d9e1c720b8e50c9af9363105f6ea9ff2cffff7dc67477a7701aacf21ba977424fe9fbaba6a00d5f64310a2e2517e9328a7acb91a4bc06ed237139a8e0d9b  unifi.logrotated"