summaryrefslogtreecommitdiff
path: root/packages/sys-boot/dracut/dracut.exlib
blob: 84b58b7ad6b3aaf3ff919ddaa28cd8a5c95158be (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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# Copyright 2010 Alex Elsayed <eternaleye@gmail.com>
# Copyright 2010 Brett Witherspoon <spoonb@exherbo.org>
# Distributed under the terms of the GNU General Public License v2

require systemd-service

DOWNLOADS="mirror://kernel/linux/utils/boot/${PN}/${PNV}.tar.gz"

export_exlib_phases src_prepare src_install

SUMMARY="Dracut is a modular initramfs infrastructure."
DESCRIPTION="
Unlike existing initramfs's, this is an attempt at having as little as possible hard-coded into
the initramfs as possible. The initramfs has (basically) one purpose in life -- getting the rootfs
mounted so that we can transition to the real rootfs. This is all driven off of device availability.
Therefore, instead of scripts hard-coded to do various things, we depend on udev to create device
nodes for us and then when we have the rootfs's device node, we mount and carry on. This helps to
keep the time required in the initramfs as little as possible so that things like a 5 second boot
aren't made impossible as a result of the very existence of an initramfs. It's likely that we'll
grow some hooks for running arbitrary commands in the flow of the script, but it's worth trying
to resist the urge as much as we can as hooks are guaranteed to be the path to slow-down. Also,
there is an attempt to keep things as distribution-agnostic as possible.
"
HOMEPAGE="https://dracut.wiki.kernel.org/"

UPSTREAM_DOCUMENTATION="
    https://www.kernel.org/pub/linux/utils/boot/dracut/dracut.html [[ description = [ Manual ] lang = en ]]
"

LICENCES="GPL-2"
SLOT="0"
MYOPTIONS=""

DEPENDENCIES="
    build:
        app-doc/asciidoc
        app-text/docbook-xml-dtd:4.5
        dev-libs/libxslt
        dev-util/elfutils
        sys-apps/kmod[>=23]
    run:
        app-shells/bash[>=4.0]
        virtual/pkg-config
        sys-apps/coreutils[xattr]
        sys-apps/util-linux[>=2.21]
    test:
        app-shells/dash
    recommendation:
        sys-boot/dracut-config-redcore [[
            description = [ Redcore Linux Project dracut config ]
        ]]
        sys-process/procps [[
            description = [ Required by the base module for pidof if not using busybox ]
        ]]
    suggestion:
        app-arch/pigz [[
            description = [ Support parallel (de)compression via pigz ]
        ]]
        app-crypt/gnupg [[
            description = [ Add support for GPG-encrypted keys to the crypt module ]
        ]]
        app-shells/dash [[
            description = [ Support for dash as the initramfs shell ]
        ]]
        net-fs/cifs-utils [[
            description = [ Required by the CIFS module for rootfs on CIFS ]
        ]]
        net-fs/nfs-utils [[
            description = [ Required by the NFS module for rootfs on NFS ]
            group-name = [ dracut-nfs-module ]
        ]]
        net-misc/open-iscsi [[
            description = [ Support for rootfs on iSCSI ]
        ]]
        net-nds/rpcbind [[
            description = [ Reguired by the NFS module for rootfs on NFS ]
            group-name = [ dracut-nfs-module ]
        ]]
        sys-boot/plymouth [[
            description = [ Provides boot splash support ]
        ]]
        sys-fs/btrfs-progs [[
            description = [ Support for multi-device btrfs filesystems ]
        ]]
        sys-fs/cryptsetup [[
            description = [ Support for an encrypted rootfs using dmcrypt ]
        ]]
        sys-fs/lvm2 [[
            description = [ Support for LVM volumes and device-mapper partitions for various modules ]
        ]]
        sys-fs/multipath-tools [[
            description = [ Support for rootfs on multipath devices ]
        ]]
        net-misc/bridge-utils [[
            description = [ Required by the network boot module for brctl ]
            group-name = [ dracut-network-module ]
        ]]
        net-misc/dhcp [[
            description = [ Required by the network boot module for dhclient ]
            group-name = [ dracut-network-module ]
        ]]
        net-misc/iputils [[
            description = [ Required by the network boot and debug module for arping and ping ]
            group-name = [ dracut-network-module ]
        ]]
        sys-apps/iproute2 [[
            description = [ Required by the network boot module for ip ]
            group-name = [ dracut-network-module ]
        ]]
        sys-apps/keyutils [[
            description = [ Required by the masterkey, ecryptfs and integrity modules to decrypt keys ]
        ]]
        sys-apps/net-tools [[
            description = [ Required by the iSCSI and debug module for hostname and netstat ]
        ]]
        sys-libs/libcap [[
            description = [ Required by the caps module for initramfs which drops capabilities ]
        ]]
        virtual/syslog [[
            description = [ Support for logging to a remote server with the syslog module ]
        ]]
"

# As broken as it gets - the tests even signal failure when they're just checking
# for the file system type
RESTRICT="test"

# TODO
#   - Some modules need additional/unpackaged dependencies and testing.
#     See module-info.sh or module-setup.sh in the module directory,


DEFAULT_SRC_PREPARE_PATCHES=(
    "${FILES}"/0001-base-dracut-lib.sh-dev_unit_name-guard-against-dev-b.patch
    "${FILES}"/0002-systemd-initrd-add-initrd-root-device.target.patch
    "${FILES}"/0003-50-dracut.install-use-bin-bash-shebang.patch
    "${FILES}"/0004-redcore-change-default-initramfs-name.patch
    "${FILES}"/0005-dracut-044-bash-4.4.patch
    "${FILES}"/0006-dracut-044-preserve-xattrs-when-copying.patch
    "${FILES}"/0007-dracut-044-backport-fix-for-microcode-loading.patch
    "${FILES}"/0008-dracut-044-ext4-and-f2fs-need-crc32X-too.patch
    "${FILES}"/0009-sort-fixup-creating-early-microcode.patch
)

DEFAULT_SRC_CONFIGURE_PARAMS=(
    --bashcompletiondir=/usr/share/bash-completion/completions
    --systemdsystemunitdir="${SYSTEMDSYSTEMUNITDIR}"
)

DEFAULT_SRC_INSTALL_PARAMS=(
    prefix=/usr
    libdir=/usr/$(exhost --target)/lib
    sysconfdir=/etc
)

dracut_src_prepare() {
    default

    edo sed -i -e "s:HOST-\(strip\):$(exhost --target)-\1:g" dracut.sh

    # Dracut's "Test Matrix" requires root privileges and are excessive.
    # This disables them and only runs the syntax check with dash.
    edo sed -i -e '/$(MAKE) -C test check/d' Makefile

    # Fix libdir.
    edo sed -i -e "s:/lib\(/kernel/install.d\):/$(exhost --target)/lib\1:" Makefile

    # Remove modules that are not compatible with Exherbo.
    edo rm -r modules.d/45ifcfg
}

dracut_src_install() {
    export systemdsystemunitdir="${SYSTEMDSYSTEMUNITDIR}"

    default

    insinto /usr/share/doc/${PNVR}/html/
    doins dracut.html dracut.png

    keepdir /etc/dracut.conf.d
    keepdir /usr/$(exhost --target)/lib/dracut/dracut.conf.d

    insinto /etc/logrotate.d/
    newins dracut.logrotate dracut
}