summaryrefslogtreecommitdiff
blob: c760e927efba27985c64ef563c8b9e6611fea80c (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
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI="8"

VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/dehydrated.asc

inherit verify-sig

DESCRIPTION="A client for signing certificates with an ACME-server"
HOMEPAGE="https://dehydrated.io/"
SRC_URI="
	https://github.com/dehydrated-io/${PN}/releases/download/v${PV}/${P}.tar.gz
	verify-sig? ( https://github.com/dehydrated-io/${PN}/releases/download/v${PV}/${P}.tar.gz.asc )
"

LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86"
IUSE="+cron"

BDEPEND="verify-sig? ( sec-keys/openpgp-keys-dehydrated )"
RDEPEND="acct-group/dehydrated
	acct-user/dehydrated
	app-shells/bash
	net-misc/curl
	cron? ( virtual/cron )"

src_configure() {
	default
	sed -i  's,^#CONFIG_D=.*,CONFIG_D="/etc/dehydrated/config.d",' docs/examples/config \
		|| die "could not set config (CONFIG_D)"
}

src_install() {
	dobin ${PN}
	insinto /etc/${PN}
	doins docs/examples/{config,domains.txt,hook.sh}
	fperms u+x /etc/${PN}/hook.sh
	dodoc docs/*.md

	insinto /etc/${PN}/config.d
	newins "${FILESDIR}"/00_gentoo.sh-r1 00_gentoo.sh

	keepdir /etc/${PN}/domains.d

	doman  docs/man/dehydrated.1

	if use cron ; then
		insinto /etc/cron.d
		newins "${FILESDIR}"/cron-r1 ${PN}
	fi
}

pkg_postinst() {
	if [[ -z "${REPLACING_VERSIONS}" ]] ; then
		einfo "See /etc/dehydrated/config for configuration."

		use cron && einfo "After finishing setup you should enable the cronjob in /etc/cron.d/dehydrated."
	fi
}