aboutsummaryrefslogtreecommitdiffstats
path: root/main/awstats/APKBUILD
blob: 31fd7de5237607e007ed7143017bdd2902ac112f (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
# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=awstats
pkgver=7.8
pkgrel=0
pkgdesc="Free real-time logfile analyzer to get advanced statistics"
url="http://awstats.sourceforge.net/"
arch="noarch"
license="GPL-3.0-or-later"
depends="perl perl-uri"
subpackages="$pkgname-doc"
options="!check" # no testsuite
source="https://prdownloads.sourceforge.net/awstats/awstats-$pkgver.tar.gz
	CVE-2020-35176.patch"

# secfixes:
#   7.8-r0:
#     - CVE-2020-29600
#     - CVE-2020-35176
#   7.6-r2:
#     - CVE-2017-1000501

prepare() {
	local file
	default_prepare
	for file in tools/* wwwroot/cgi-bin/*; do
		[ -f "${file}" ] || continue
		sed -e "s:/usr/local/$pkgname/wwwroot:/usr/lib/$pkgname:g" \
			-i "$file"
	done
	for file in wwwroot/cgi-bin/*; do
		[ -f "${file}" ] || continue
		sed -e "s:/usr/share/$pkgname:/usr/lib/$pkgname/cgi-bin:g" \
			-i "$file"
	done
}

package() {
	cd "$builddir"
	install -d "$pkgdir"/usr/share/doc/$pkgname \
		"$pkgdir"/var/lib/$pkgname \
		"$pkgdir"/usr/lib/$pkgname \
		"$pkgdir"/etc/$pkgname \
		"$pkgdir"/usr/bin

	# docs
	cp -a docs tools/xslt "$pkgdir"/usr/share/doc/$pkgname || return 1

	# cgi-bin
	cp -a wwwroot/* "$pkgdir"/usr/lib/$pkgname
	mv "$pkgdir"/usr/lib/$pkgname/cgi-bin/$pkgname.model.conf \
		"$pkgdir"/etc/awstats/
	ln -s /etc/$pkgname/$pkgname.model.conf \
		"$pkgdir"/usr/lib/$pkgname/cgi-bin/$pkgname.model.conf

	# tools
	cp tools/*.pl "$pkgdir"/usr/bin/ || return 1
	ln -s /usr/lib/$pkgname/cgi-bin/$pkgname.pl "$pkgdir"/usr/bin/

	# remove java sources and example plugin
	rm -fr "$pkgdir"/usr/lib/$pkgname/classes/src \
		"$pkgdir"/usr/lib/$pkgname/cgi-bin/plugins/example
}

sha512sums="b532f74a8b420841b1ae7eea73fd341049925af01688a06114f53807c14c6a4edc4ca4f671b2b9c1aee8024ba25ccf69b6eae391250e5722d2fd719de4cf87e2  awstats-7.8.tar.gz
d012866662206ffba9f84af437824324bf402a49ecb67161833b3f9593ccd4327db4b465d305c3ca78e5b29917acd469760faac6f7678055d4de01621f689c63  CVE-2020-35176.patch"