From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1048425-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id E220B138334
	for <garchives@archives.gentoo.org>; Sat, 22 Sep 2018 17:29:58 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 77963E07D8;
	Sat, 22 Sep 2018 17:29:57 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 34A01E07D8
	for <gentoo-commits@lists.gentoo.org>; Sat, 22 Sep 2018 17:29:56 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 267DF335C6F
	for <gentoo-commits@lists.gentoo.org>; Sat, 22 Sep 2018 17:29:55 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id A80ED3AA
	for <gentoo-commits@lists.gentoo.org>; Sat, 22 Sep 2018 17:29:52 +0000 (UTC)
From: "Sergei Trofimovich" <slyfox@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Sergei Trofimovich" <slyfox@gentoo.org>
Message-ID: <1537637371.d83590e94a84d6f90c7a4b3bb0377b5734c892ca.slyfox@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: net-im/openfire/
X-VCS-Repository: repo/gentoo
X-VCS-Files: net-im/openfire/openfire-4.2.3-r1.ebuild
X-VCS-Directories: net-im/openfire/
X-VCS-Committer: slyfox
X-VCS-Committer-Name: Sergei Trofimovich
X-VCS-Revision: d83590e94a84d6f90c7a4b3bb0377b5734c892ca
X-VCS-Branch: master
Date: Sat, 22 Sep 2018 17:29:52 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: 6091084c-99e2-4d25-9df2-7298ae9eca34
X-Archives-Hash: b37cb86b0f4c71327cc3f2bc3ff24775

commit:     d83590e94a84d6f90c7a4b3bb0377b5734c892ca
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 22 17:29:31 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Sep 22 17:29:31 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d83590e9

net-im/openfire: set ownership at src_install() phase, bug #630914

As Michael explains in bug #630914 the code below is prone to
chown-ing files not belonging to package:

```
  pkg_postinst() {
      ...
      chown -R jabber:jabber "${ROOT}"/opt/openfire
  }
```

Move chown to src_install() to contain the damage to builder.

Reported-by: Michael Orlitzky
Bug: https://bugs.gentoo.org/630914
Package-Manager: Portage-2.3.49, Repoman-2.3.10

 net-im/openfire/openfire-4.2.3-r1.ebuild | 96 ++++++++++++++++++++++++++++++++
 1 file changed, 96 insertions(+)

diff --git a/net-im/openfire/openfire-4.2.3-r1.ebuild b/net-im/openfire/openfire-4.2.3-r1.ebuild
new file mode 100644
index 00000000000..ea631de1f71
--- /dev/null
+++ b/net-im/openfire/openfire-4.2.3-r1.ebuild
@@ -0,0 +1,96 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit eutils java-pkg-2 java-ant-2 systemd
+
+MY_P=${PN}_src_${PV//./_}
+DESCRIPTION="Openfire (formerly wildfire) real time collaboration (RTC) server"
+HOMEPAGE="http://www.igniterealtime.org/projects/openfire/"
+SRC_URI="http://www.igniterealtime.org/builds/openfire/${MY_P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc"
+
+RDEPEND=">=virtual/jre-1.7"
+DEPEND="net-im/jabber-base
+	~dev-java/ant-contrib-1.0_beta2
+	>=virtual/jdk-1.7"
+
+S=${WORKDIR}/${PN}_src
+
+pkg_setup() {
+	java-pkg-2_pkg_setup
+}
+
+src_compile() {
+	# Jikes doesn't support -source 1.5
+	java-pkg_filter-compiler jikes
+
+	ANT_TASKS="ant-contrib"
+	eant -f build/build.xml openfire plugins $(use_doc)
+
+	# delete nativeAuth prebuilt libs:
+	#    uses outdated unmaintained libshaj, does not support amd64
+	rm -rfv target/openfire/resources/nativeAuth || die
+}
+
+src_install() {
+	dodir /opt/openfire
+
+	newinitd "${FILESDIR}"/openfire-initd openfire
+	newconfd "${FILESDIR}"/openfire-confd openfire
+	systemd_dounit "${FILESDIR}"/${PN}.service
+
+	dodir /opt/openfire/conf
+	insinto /opt/openfire/conf
+	newins target/openfire/conf/openfire.xml openfire.xml.sample
+	newins target/openfire/conf/security.xml security.xml.sample
+
+	dodir /opt/openfire/logs
+	keepdir /opt/openfire/logs
+
+	dodir /opt/openfire/lib
+	insinto /opt/openfire/lib
+	doins target/openfire/lib/*
+
+	dodir /opt/openfire/plugins
+	insinto /opt/openfire/plugins
+	doins -r target/openfire/plugins/*
+
+	dodir /opt/openfire/resources
+	insinto /opt/openfire/resources
+	doins -r target/openfire/resources/*
+
+	if use doc; then
+		dohtml -r documentation/docs/*
+	fi
+	dodoc documentation/dist/*
+
+	#Protect ssl key on upgrade
+	dodir /etc/env.d/
+	echo 'CONFIG_PROTECT="/opt/openfire/resources/security/"' > "${D}"/etc/env.d/98openfire
+
+	fowners -R jabber:jabber /opt/openfire
+}
+
+pkg_postinst() {
+	local src
+	local dst
+
+	# http://community.igniterealtime.org/thread/52289
+	for dst in "${ROOT%/}"/opt/openfire/conf/{openfire,security}.xml
+	do
+		src="${dst}".sample
+		if [[ -f "${dst}" ]]; then
+			einfo "Leaving old '${dst}'"
+		else
+			einfo "Created default '${dst}'. Please edit."
+			cp -v "${src}" "${dst}" || ewarn "cp '${dst}' failed"
+			chmod -v 0600 "${dst}" || ewarn "chmod '${dst}' failed"
+		fi
+	done
+}