blob: 4963da3411403ad2eb734a6a5280fcf0cb01a122 (
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
# Copyright 2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# Autogenerated by pycargoebuild 0.15.0
EAPI=8
CRATES="
diff@0.1.13
glob@0.3.3
libc@0.2.177
log@0.4.28
pretty_assertions@1.4.1
yansi@1.0.1
"
inherit pam cargo
DESCRIPTION="A memory safe implementation of sudo and su."
HOMEPAGE="https://github.com/trifectatechfoundation/sudo-rs"
SRC_URI="
https://github.com/trifectatechfoundation/${PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
${CARGO_CRATE_URIS}
"
LICENSE="|| ( Apache-2.0 MIT )"
# Dependent crate licenses
LICENSE+=" || ( Apache-2.0 MIT )"
SLOT="0"
KEYWORDS="~amd64 ~arm64"
IUSE="pam su system-names"
RDEPEND="
system-names? (
!app-admin/sudo
su? (
!sys-apps/util-linux[su]
!sys-apps/shadow[su]
)
)
"
QA_FLAGS_IGNORED="usr/bin/.*"
DOCS=(
README.md
SECURITY.md
CHANGELOG.md
)
PATCHES=(
# disable tests that require root access
"${FILESDIR}/sudo-rs-0.2.8-tests.patch"
)
src_prepare() {
if ! use system-names; then
find "${S}" -name '*.rs' -or -name 'Cargo.toml' \
| xargs sed -r -e 's:"(sudo|visudo|su|su-l)":"\1-rs": ; s:"sudo-i":"sudo-rs-i":' -i || die
elif ! use su; then
find "${S}" -name '*.rs' -or -name 'Cargo.toml' \
| xargs sed -r -e 's:"(su|su-l)":"\1-rs":' -i || die
fi
default
}
src_install() {
cargo_src_install
local ext=$(usex system-names '' '-rs')
local su_ext=$(usex su "${ext}" '-rs')
local -a binaries=(
sudo${ext}
su${su_ext}
)
dodoc "${DOCS[@]}"
local man dest
for man in docs/man/*.?.man; do
dest="${man##*/}"
dest="${dest%.man}"
if [[ ${dest#.*} == su.* ]]; then
dest="${dest/./${su_ext}.}"
else
dest="${dest/./${ext}.}"
fi
newman "${man}" "${dest}"
done
fperms 4755 $(printf -- '/usr/bin/%s\n' "${binaries[@]}")
insinto /etc
doins "${FILESDIR}"/sudoers-rs
keepdir /etc/sudoers.d
if use pam; then
pamd_mimic system-auth sudo${ext} auth account session
pamd_mimic system-auth sudo${ext}-i auth account session
if use su; then
pamd_mimic system-auth su${ext}-l auth account session
fi
fi
}
|