summaryrefslogtreecommitdiff
path: root/sys-auth/citadel/citadel-0.1.0-r3.ebuild
blob: 9faa9b157c8fd0ca58d3b2e3e19dc30a645aba69 (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
EAPI=8

DESCRIPTION="Generic modular identity, session, authorization and node-enrollment service"
HOMEPAGE="https://baldeagleos.com/"
SRC_URI="https://distfiles.baldeagleos.com/citadel-0.1.0-r1.tar.zst"
S="${WORKDIR}/citadel"

LICENSE="all-rights-reserved"
SLOT="0"
KEYWORDS="~amd64"
IUSE=""

RDEPEND="
	dev-db/postgresql:18
	acct-group/citadel
	acct-group/citadel-agent
	acct-user/citadel
	acct-user/citadel-agent
"
BDEPEND="
	dev-lang/rust
	net-misc/rsync
"

src_unpack() {
	# Portage on this host does not recognize .tar.zst through the generic
	# unpack helper; extract explicitly and retain the immutable source root.
	mkdir -p "${WORKDIR}" || die
	tar --zstd -xf "${DISTDIR}/citadel-0.1.0-r1.tar.zst" -C "${WORKDIR}" || die
	local extracted
	extracted=$(find "${WORKDIR}" -mindepth 1 -maxdepth 1 -type d -name 'citadel-package-src.*' -print -quit)
	[[ -n ${extracted} && -d ${extracted} ]] || die "unexpected Citadel source root"
	mv "${extracted}" "${WORKDIR}/citadel" || die
	S="${WORKDIR}/citadel"
}

src_compile() {
	cd "${S}" || die
	cargo build --offline --release --workspace --locked || die
}

src_install() {
	newbin target/release/login-server citadeld
	newbin target/release/login-admin citadel-admin
	dodir /etc/citadel
	keepdir /var/lib/citadel /var/log/citadel
	insinto /usr/share/citadel
	doins -r migrations
	doins -r config
	dodir /usr/share/citadel/tools
	doins tools/preflight-production-import.py
	insinto /etc/citadel
	doins config/callers.example.json
	newinitd "${FILESDIR}/citadeld.initd" citadeld
	newconfd "${FILESDIR}/citadeld.confd" citadeld
	fperms 0750 /etc/citadel /var/lib/citadel /var/log/citadel
}

pkg_postinst() {
	einfo "Citadel is installed but not enabled or started."
	einfo "Run the explicit migration/bootstrap qualification before production use."
}