aboutsummaryrefslogtreecommitdiffstats
path: root/testing/artifactory-oss/APKBUILD
blob: 07d43082748d72ea9980407e78b43882896a708a (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
102
103
104
105
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=artifactory-oss
_pkgname=artifactory
pkgver=4.14.0
pkgrel=1
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
}

md5sums="ce36815e9be82625641f3dd23ce0bdf4  jfrog-artifactory-oss-4.14.0.zip
e64dca85dc3505db85e774d936b94a0c  artifactory.confd"
sha256sums="ce21dd97b5919a3736cc02aa321877e9b1030fa9100b489b70c3a3459bf7d7e9  jfrog-artifactory-oss-4.14.0.zip
3616ab9ae116a76e2c5bfec523f76f4f56fde8894113c5d4dce15416660b3ecd  artifactory.confd"
sha512sums="e69d8d046cd320e0ed9848538a555e0f8aaf0e65520de79c6b380a180f4d628d5ff7ee441140b48dd076528c2c5b8982719d9ab94ec6dbaf42c0495c7e0433e9  jfrog-artifactory-oss-4.14.0.zip
2701ea102da77b86be3b9aa75d5aa92fd5d81081ae1c835aaea49b0f0fd015bd5b32128ba913afda10fac122eec2d0bd1e203af4ee3d13106c3e66e7d1b83498  artifactory.confd"