blob: b8d3f75a0f20d067b2b1adcd176769c84c6d6168 (
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
|
# Copyright 2023-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( python3_{11..12} )
inherit distutils-r1 optfeature shell-completion
DESCRIPTION="Python based initramfs generator with TOML defintions"
HOMEPAGE="https://github.com/desultory/ugrd"
SRC_URI="https://github.com/desultory/${PN}/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~arm64"
RDEPEND="
app-misc/pax-utils
>=dev-python/zenlib-2.2.3[${PYTHON_USEDEP}]
>=dev-python/pycpio-1.3.2[${PYTHON_USEDEP}]
sys-apps/pciutils
"
BDEPEND="
test? (
amd64? ( app-emulation/qemu[qemu_softmmu_targets_x86_64] )
arm64? ( app-emulation/qemu[qemu_softmmu_targets_aarch64] )
)
"
python_install_all() {
# Call the distutils-r1_python_install_all function
distutils-r1_python_install_all
# Install the example config into /etc/ugrd/config.toml
# Do not overwrite an existing config
insinto /etc/ugrd
newins examples/example.toml config.toml
# Install the kernel preinst.d hook
exeinto /usr/lib/kernel/preinst.d
doexe hooks/installkernel/52-ugrd.install
exeinto /usr/lib/kernel/install.d
doexe hooks/kernel-install/52-ugrd.install
dobashcomp completion/ugrd # Install bash autocomplete script
dozshcomp completion/_ugrd # Install zsh autocomplete script
}
pkg_postinst() {
optfeature "ugrd.crypto.cryptsetup support" sys-fs/cryptsetup
optfeature "ugrd.fs.btrfs support" sys-fs/btrfs-progs
optfeature "ugrd.crypto.gpg support" app-crypt/gnupg
optfeature "ugrd.fs.lvm support" sys-fs/lvm2[lvm]
optfeature "ugrd.fs.mdraid support" sys-fs/mdadm
}
distutils_enable_tests unittest
src_test() {
if [[ ! -w '/dev/kvm' ]]; then
ewarn "Skipping tests: Cannot write to /dev/kvm."
return 1
fi
if [[ ! -r "$(command -v mount)" ]]; then
ewarn "Cannot read the mount binary, tests may fail until"
ewarn "util-linux is re-emerged without the sfperms feature."
fi
distutils-r1_src_test
}
python_test() {
eunittest tests/
}
|