rand/www-apps/healthchecks/healthchecks-1.19.0.ebuild
Martin Sekera 4bf6278ce0 Add www-apps/healthchecks and its dependencies:
www-apps/healthchecks
dev-python/statsd
dev-python/requests-oauthlib
dev-python/oauthlib
dev-python/fido2
dev-python/cron-descriptor
dev-python/apprise
2021-02-18 00:38:45 +01:00

80 lines
2.3 KiB
Bash

# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
PYTHON_COMPAT=( python3_{7,8,9} )
inherit python-single-r1 systemd
DESCRIPTION="Periodic task monitoring."
HOMEPAGE="https://github.com/${PN}/${PN}"
SRC_URI="https://github.com/${PN}/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~arm64"
IUSE="apprise"
REQUIRED_USE=${PYTHON_REQUIRED_USE}
RDEPEND="
acct-group/healthchecks
acct-user/healthchecks
${PYTHON_DEPS}
$(python_gen_cond_dep '
>=dev-python/django-3.1[${PYTHON_MULTI_USEDEP}]
>=dev-python/django-compressor-2.4[${PYTHON_MULTI_USEDEP}]
>=dev-python/fido2-0.9.1[${PYTHON_MULTI_USEDEP}]
dev-python/cron-descriptor[${PYTHON_MULTI_USEDEP}]
dev-python/croniter[${PYTHON_MULTI_USEDEP}]
dev-python/psycopg[${PYTHON_MULTI_USEDEP}]
dev-python/pytz[${PYTHON_MULTI_USEDEP}]
dev-python/requests[${PYTHON_MULTI_USEDEP}]
dev-python/statsd[${PYTHON_MULTI_USEDEP}]
www-servers/gunicorn[${PYTHON_MULTI_USEDEP}]
apprise? ( dev-python/apprise[${PYTHON_MULTI_USEDEP}] )
')"
DEPEND="${RDEPEND}"
src_install() {
TD=/usr/share/${PN}
insinto /etc/${PN}
newins ${FILESDIR}/local_settings.py local_settings.py.example
fowners root:${PN} /etc/${PN}/local_settings.py.example
fperms 640 /etc/${PN}/local_settings.py.example
dosym /etc/${PN}/local_settings.py ${TD}/hc/local_settings.py
SECRET=$(python3 -c "import random; print(random.randbytes(25).hex())")
sed -i "s/__RANDOM__/${SECRET}/" "${ED}/etc/${PN}/local_settings.py.example"
insinto ${TD}
doins -r *
systemd_dounit ${FILESDIR}/${PN}-server.service
systemd_dounit ${FILESDIR}/${PN}-monitor.service
}
pkg_config() {
if [[ ! -a "/etc/${PN}/local_settings.py" ]]; then
eerror "Create /etc/${PN}/local_settings.py with your configuration first."
return 1
fi
cd /usr/share/${PN}
einfo "This will apply migrations and/or create a superuser. You can skip any step."
einfo "Apply migrations? [y/N]"
read CHOICE
if [[ ${CHOICE:0:1} == "y" ]]; then
ebegin "Running migrations"
sudo -u ${PN} python3 manage.py migrate || die
eend 0
fi
einfo "Createa a new superuser? [y/N]"
read CHOICE
if [[ ${CHOICE:0:1} == "y" ]]; then
ebegin "Creating a superuser"
sudo -u ${PN} python3 manage.py createsuperuser || die
eend 0
fi
}