summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: c0a8148d1825fcd9b0901c2b0b7af06a44c318d1 (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
# Maintainer: Peter Lamby <peterlamby@web.de>
pkgname=sonarqube-lts
pkgver=4.5.4
pkgrel=1
pkgdesc='An open platform to manage code quality'
arch=('i686' 'x86_64')
url='http://www.sonarqube.org/'
license=('LGPL3')
depends=('java-runtime>=7')
conflicts=('sonar' 'sonarqube')
options=('!strip')
install=sonarqube-lts.install
source=('http://downloads.sonarsource.com/sonarqube/sonarqube-4.5.4.zip'
        'sonarqube.service'
        'sonar.sh.patch')
md5sums=('59c454a0fa62fe1fe6c269616770b288'
         'e98cb43f4f6b9af33312fa1d8aba88e3'
         '2b443049eede589adc4ad451197f1c10')

prepare() {
	cd ${srcdir}

	# Customize .service for $CARCH
	if [ $CARCH = 'x86_64' ]; then
		sed -i 's/ARCH/linux-x86-64/g' sonarqube.service
	else
		sed -i '/s/ARCH/linux-x86-32/g' sonarqube.service
	fi

	cd sonarqube-${pkgver}


	cd bin
		# Delete unneeded binaries
		rm -rf linux-ppc-64 macosx-universal-64 solaris* windows*

		if [ $CARCH = 'x86_64' ]; then
			patch linux-x86-64/sonar.sh < "${srcdir}/sonar.sh.patch"
			rm -rf linux-x86-32
		else
			patch linux-x86-32/sonar.sh < "${srcdir}/sonar.sh.patch"
			rm -rf linux-x86-64
		fi
	cd ..

	# Fix EOL in configuration files
	for i in conf/* ; do
		awk '{ sub("\r$", ""); print }' $i > $i.new
		mv $i.new $i
	done
}

package() {
	cd "${srcdir}"

	install -Dm644 sonarqube.service "${pkgdir}/usr/lib/systemd/system/sonarqube.service"

	cd sonarqube-${pkgver}
	install -d "${pkgdir}/opt/sonarqube"
	cp -r * "${pkgdir}/opt/sonarqube/"
	mkdir "${pkgdir}/opt/sonarqube/run"
}