summaryrefslogtreecommitdiff
path: root/testing/artifactory-oss/APKBUILD
blob: 31b9a5626a183e759ebaac7a476c91a3be2802b8 (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
95
96
97
98
99
100
101
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=artifactory-oss
_pkgname=artifactory
pkgver=4.16.0
pkgrel=0
pkgdesc="Open source Maven repository manager"
url="https://www.jfrog.com/open-source/"
arch="noarch"
license="AGPL3"
depends="jetty-runner openjdk8-jre-base"
makedepends="unzip zip"
install="$pkgname.pre-install $pkgname.post-install"
pkgusers="artifact"
pkggroups="artifact"
source="https://jcenter.bintray.com/org/artifactory/oss/jfrog-$pkgname/$pkgver/jfrog-$pkgname-$pkgver.zip
	$_pkgname.confd"
builddir="$srcdir/$pkgname-$pkgver"

prepare() {
	default_prepare || return 1

	cd "$builddir"

	# Prepare default storage config (this is copied from Artifactory).
	cat > etc/storage.properties <<-'EOF'
		type=derby
		url=jdbc:derby:{db.home};create=true
		driver=org.apache.derby.jdbc.EmbeddedDriver
	EOF

	# Allow to change logs directory using system property.
	sed -i 's|${artifactory.home}/logs|${artifactory.logs}|' \
		etc/logback.xml || return 1

	cd webapps

	# Remove tomcat-juli from WAR, it conflicts with Jetty's implementation.
	zip -d $_pkgname.war WEB-INF/lib/tomcat-juli-*.jar || return 1

	# Patch web.xml inside WAR; remove second declaration of
	# welcome-file-list that overwrites the previous correct one.
	unzip $_pkgname.war WEB-INF/web.xml || return 1
	patch -l WEB-INF/web.xml <<-EOF || return 1
		@@ -159,8 +159,5 @@
		         <url-pattern>/ui/*</url-pattern>
		     </servlet-mapping>

		-    <welcome-file-list>
		-        <welcome-file>TC7-49422</welcome-file>
		-    </welcome-file-list>

		 </web-app>
	EOF
	zip -u $_pkgname.war WEB-INF/web.xml
}

package() {
	local libdir="$pkgdir/var/lib/$_pkgname"

	cd "$builddir"

	install -m 644 -D webapps/$_pkgname.war \
		"$pkgdir"/usr/share/java/$_pkgname.war || return 1

	install -m 750 -o $pkgusers -g $pkggroups -d \
		"$libdir" "$libdir"/etc "$libdir"/data || return 1

	install -m 755 -o $pkgusers -g $pkggroups -d \
		"$pkgdir"/var/log/$_pkgname || return 1

	# Derby insists on logging into ./logs, so we must symlink it.
	ln -s /var/log/$_pkgname "$libdir"/logs || return 1

	local f
	for f in artifactory.system.properties mimetypes.xml storage.properties; do
		install -m 644 -D etc/$f "$pkgdir"/etc/$_pkgname/$f || return 1
		ln -s /etc/$_pkgname/$f "$libdir"/etc/$f || return 1
	done

	# Fix permissions, this file may contain DB password.
	install -m 640 -o root -g $pkggroups etc/storage.properties \
		"$pkgdir"/etc/$_pkgname/storage.properties || return 1

	# Artifactory dumps settings from web admin interface, so keep it in
	# /usr/lib instead of /etc.
	install -m 600 -o $pkgusers -g $pkggroups \
		etc/artifactory.config.xml "$libdir"/etc/ || return 1

	# Artifactory doesn't like symlinked logback.xml, so we must keep it here.
	install -m 644 -o $pkgusers -g $pkggroups \
		etc/logback.xml "$libdir"/etc/ || return 1

	mkdir -p "$pkgdir"/etc/init.d
	ln -s jetty-runner "$pkgdir"/etc/init.d/$_pkgname || return 1

	install -m 644 -D "$srcdir"/$_pkgname.confd "$pkgdir"/etc/conf.d/$_pkgname
}

sha512sums="ce7c65ef9afde2aab3c0cc8b4c9e6a069483f101dccb475a8bd3a851c88dd96c3154c2ff1202139aee6f14efbb4d17477dcdd54f2360caddc5d888c657e3b16d  jfrog-artifactory-oss-4.16.0.zip
2701ea102da77b86be3b9aa75d5aa92fd5d81081ae1c835aaea49b0f0fd015bd5b32128ba913afda10fac122eec2d0bd1e203af4ee3d13106c3e66e7d1b83498  artifactory.confd"