aboutsummaryrefslogtreecommitdiffstats
path: root/testing/artifactory-oss/APKBUILD
blob: 9790ffa17bb0fdd4f5ae48b57444bd0a612b051b (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
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=artifactory-oss
_pkgname=artifactory
pkgver=4.12.1
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 \
			logback.xml \
			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

	# 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

	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
}

md5sums="1eadbbf5a98abdca5d92e054fd7ad18e  jfrog-artifactory-oss-4.12.1.zip
5ea41a4fe0693f54d6c37de9a09c4277  artifactory.confd"
sha256sums="163dee4f853b706fffb49fc47408a7d662b8cfd38606380fd186ab1ef253b8f1  jfrog-artifactory-oss-4.12.1.zip
cf0feb3fb3c88bd0b074e796babaea1961760eea4862d8dee1e4fab5be1fcbe3  artifactory.confd"
sha512sums="ed9d3f4459aecf864edfb82bc485ff8d648a9dd2ea9571073e5cab71da91e2830a9010e4f6c80c0e8c0f0ad68ea8f5858e6dd74ec67f7f282d29ebf55dda683f  jfrog-artifactory-oss-4.12.1.zip
824c4862f2ae28d8aa6f44ae6e02739e0604e974000520ca5efb9b6e293e564bf6b2b79785720fa2b864864462dce84fca7cdbb67291356e58821eccdb287c2b  artifactory.confd"