<commit_before># Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI="5"

inherit eutils user

DESCRIPTION="Payara Server is a drop in replacement for GlassFish Server Open Source Edition, with the peace of mind of quarterly releases containing enhancements, bug fixes and patches."
HOMEPAGE="https://www.payara.fish/"
LICENSE="cddl"
SRC_URI="https://s3-eu-west-1.amazonaws.com/payara.fish/Payara+Downloads/Payara+${PV}/payara-${PV}.zip"
RESTRICT="mirror"
SLOT="0"
KEYWORDS="x86 amd64"
IUSE="-external-config"

RDEPEND=">=virtual/jdk-1.8 virtual/jdbc-postgresql-bin"

S="${WORKDIR}/payara41"
MY_PN="payara"
INSTALL_DIR="/opt/${MY_PN}"

pkg_setup() {
	enewgroup glassfish
	enewuser glassfish -1 /bin/bash /home/glassfish glassfish
}

src_prepare() {
	find . \( -name \*.bat -or -name \*.exe \) -delete
}

src_prepare() {
	if use external-config ; then
		config_files=(admin-keyfile cacerts.jks domain-passwords domain.xml
			keyfile keystore.jks logging.properties)

		for filename in ${config_files[@]} ; do
			rm glassfish/domains/domain1/config/"$filename" || die
		done

		rm glassfish/lib/registration/servicetag-registry.xml || die
	fi
}

src_install() {
	insinto "${INSTALL_DIR}"

	doins -r glassfish javadb mq bin
	keepdir "${INSTALL_DIR}"/home

	for i in bin/* ; do
		fperms 755 ${INSTALL_DIR}/${i}
		make_wrapper "$(basename ${i})" "${INSTALL_DIR}/${i}"
	done

	for i in glassfish/bin/* ; do
		fperms 755 ${INSTALL_DIR}/${i}
	done
		# TODO - major version function
	newconfd "${FILESDIR}"/conf glassfishv3
    newinitd "${FILESDIR}"/init glassfishv3


	keepdir ${INSTALL_DIR}/glassfish/domains
	fperms -R g+w "${INSTALL_DIR}/glassfish/domains"

	fowners -R glassfish:glassfish ${INSTALL_DIR}

	echo "CONFIG_PROTECT=\"${INSTALL_DIR}/glassfish/config\"" > "${T}/25payara"
	doenvd "${T}/25payara"
}

pkg_postinst() {
	elog "You must be in the glassfish group to use Payara without root rights."<commit_msg>www-servers/payara-bin: clean-up<commit_after># Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI="5"

inherit eutils user

DESCRIPTION="Payara Server is a drop in replacement for GlassFish Server Open Source Edition, with the peace of mind of quarterly releases containing enhancements, bug fixes and patches."
HOMEPAGE="https://www.payara.fish/"
LICENSE="cddl"
SRC_URI="https://s3-eu-west-1.amazonaws.com/payara.fish/Payara+Downloads/Payara+${PV}/payara-${PV}.zip"
RESTRICT="mirror"
SLOT="0"
KEYWORDS="x86 amd64"
IUSE="-external-config"

RDEPEND=">=virtual/jdk-1.8 virtual/jdbc-postgresql-bin"

S="${WORKDIR}"/payara41
INSTALL_DIR=/opt/payara

pkg_setup() {
	enewgroup glassfish
	enewuser glassfish -1 /bin/bash /home/glassfish glassfish
}

src_prepare() {
	find . \( -name \*.bat -or -name \*.exe \) -delete
}

src_prepare() {
	if use external-config ; then
		config_files=(admin-keyfile cacerts.jks domain-passwords domain.xml
			keyfile keystore.jks logging.properties)

		for filename in ${config_files[@]} ; do
			rm glassfish/domains/domain1/config/"${filename}" || die
		done

		rm glassfish/lib/registration/servicetag-registry.xml || die
	fi
}

src_install() {
	insinto "${INSTALL_DIR}"

	doins -r glassfish javadb mq bin
	keepdir "${INSTALL_DIR}"/home

	for filename in bin/* ; do
		fperms 755 "${INSTALL_DIR}"/"${filename}"
		make_wrapper "$(basename "${filename}")" "${INSTALL_DIR}"/"${filename}"
	done

	for filename in glassfish/bin/* ; do
		fperms 755 "${INSTALL_DIR}"/"${filename}"
	done
		# TODO - major version function
	newconfd "${FILESDIR}"/conf glassfishv3
    newinitd "${FILESDIR}"/init glassfishv3


	keepdir "${INSTALL_DIR}"/glassfish/domains
	fperms -R g+w "${INSTALL_DIR}"/glassfish/domains

	fowners -R glassfish:glassfish "${INSTALL_DIR}"

	echo "CONFIG_PROTECT=\"${INSTALL_DIR}/glassfish/config\"" > "${T}"/25payara
	doenvd "${T}"/25payara
}

pkg_postinst() {
	elog "You must be in the glassfish group to use Payara without root rights."
{'fraction_non_alphanumeric': 0.14367816091954022, 'fraction_numerical': 0.017491254372813594, 'mean_word_length': 4.710413694721826, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 4, 'lorem ipsum': 0, 'www.': 3, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4819220', 'n_tokens_mistral': 1513, 'n_tokens_neox': 1386, 'n_words': 349}