summaryrefslogtreecommitdiff
blob: 0902da152dc33d3159179f2181c4bffac4c2c6cd (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
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-admin/puppetdb/puppetdb-3.0.1.ebuild,v 1.1 2015/07/18 07:52:37 prometheanfire Exp $

EAPI=5

inherit multilib systemd user

DESCRIPTION="PuppetDB collects data generated by Puppet."
HOMEPAGE="http://docs.puppetlabs.com/puppetdb/"
SRC_URI="https://downloads.puppetlabs.com/puppetdb/puppetdb-${PV}.tar.gz"

LICENSE="Apache-2.0"
SLOT="0"
IUSE=""
# will need the same keywords as puppet
KEYWORDS="~amd64 ~x86"

RDEPEND+="virtual/jdk:1.7"
DEPEND+=""

initdir=/etc/init.d
unitdir=/usr/lib/systemd/system
tmpfilesdir=/usr/lib/tmpfiles.d
datadir=/usr/share
real_name=puppetdb
projdatadir=/usr/share/puppetdb
confdir=/etc
projconfdir=/etc/puppetlabs/puppetdb
bindir=/opt/puppetlabs/server/apps/puppetdb/bin
uxbindir=/opt/puppetlabs/bin
symbindir=/opt/puppetlabs/server/bin
app_prefix=/opt/puppetlabs/server/apps/puppetdb
app_data=/opt/puppetlabs/server/data/puppetdb

app_logdir=/var/log/puppetlabs/puppetdb
rundir=/run/puppetlabs/puppetdb

pkg_setup() {
	enewgroup puppetdb
	enewuser puppetdb -1 -1 /opt/puppetlabs/server/data/puppetdb "puppetdb"
}

src_prepare() {
	sed -i 's/sysconfig/conf\.d/g' ext/redhat/puppetdb.service || die
	sed -i 's/sysconfig/conf\.d/g' ext/bin/puppetdb || die
	sed -i 's/sysconfig/conf\.d/g' install.sh || die
}

src_compile() {
		einfo "not compiling"
}

src_install() {
	dodir /opt/puppetlabs/server/data/puppetdb
	insinto /opt/puppetlabs/server/apps/puppetdb
	insopts -m0744
	doins ext/ezbake-functions.sh
	insopts -m0644
	doins ext/ezbake.manifest
	doins puppetdb.jar
	insinto /etc/puppetlabs/puppetdb
	doins ext/config/logback.xml
	doins ext/config/bootstrap.cfg
	doins ext/config/request-logging.xml
	insinto /etc/puppetlabs/puppetdb/conf.d
	doins ext/config/conf.d/jetty.ini
	doins ext/config/conf.d/repl.ini
	doins ext/config/conf.d/database.ini
	doins ext/config/conf.d/config.ini
	insopts -m0755
	insinto /opt/puppetlabs/server/apps/puppetdb/scripts
	doins install.sh
	insinto /opt/puppetlabs/server/apps/puppetdb/cli/apps
	doins ext/cli/foreground
	doins ext/cli/ssl-setup
	doins ext/cli/export
	doins ext/cli/config-migration
	doins ext/cli/foreground
	doins ext/cli/anonymize
	doins ext/cli/import
	insinto opt/puppetlabs/server/apps/puppetdb/bin
	doins ext/bin/puppetdb
	insopts -m0644
	dodir /opt/puppetlabs/server/bin
	dosym ../apps/puppetdb/bin/puppetdb /opt/puppetlabs/server/bin/puppetdb
	dodir /opt/puppetlabs/bin
	dosym ../server/apps/puppetdb/bin/puppetdb /opt/puppetlabs/bin/puppetdb
	# init type tasks
	newconfd ext/default puppetdb
	systemd_dounit ext/redhat/puppetdb.service
	systemd_newtmpfilesd ext/puppetdb.tmpfiles.conf puppetdb.conf
	newinitd "${FILESDIR}/puppetdb.initd" puppetdb
	# misc
	insinto /etc/logrotate.d
	newins ext/puppetdb.logrotate.conf puppetdb
	fowners -R puppetdb:puppetdb /opt/puppetlabs/server/data/puppetdb
	fperms -R 770 /opt/puppetlabs/server/data/puppetdb
}

pkg_postinst() {
	elog "to install please run '/opt/puppetlabs/server/bin/puppetdb ssl-setup'"
	elog
	elog "to upgrade please run '/opt/puppetlabs/server/bin/puppetdb config-migration'"
}