aboutsummaryrefslogtreecommitdiffstats
path: root/testing/artifactory-oss/APKBUILD
blob: 80c1998d55e158d043e921ecbea2bd41a48eadaa (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.14.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

	# 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
}

md5sums="ce36815e9be82625641f3dd23ce0bdf4  jfrog-artifactory-oss-4.14.0.zip
5ea41a4fe0693f54d6c37de9a09c4277  artifactory.confd"
sha256sums="ce21dd97b5919a3736cc02aa321877e9b1030fa9100b489b70c3a3459bf7d7e9  jfrog-artifactory-oss-4.14.0.zip
cf0feb3fb3c88bd0b074e796babaea1961760eea4862d8dee1e4fab5be1fcbe3  artifactory.confd"
sha512sums="e69d8d046cd320e0ed9848538a555e0f8aaf0e65520de79c6b380a180f4d628d5ff7ee441140b48dd076528c2c5b8982719d9ab94ec6dbaf42c0495c7e0433e9  jfrog-artifactory-oss-4.14.0.zip
824c4862f2ae28d8aa6f44ae6e02739e0604e974000520ca5efb9b6e293e564bf6b2b79785720fa2b864864462dce84fca7cdbb67291356e58821eccdb287c2b  artifactory.confd"