Skip to content

Commit fdcecb2

Browse files
committed
consolidate make_nodes and mknod_cpio
Signed-off-by: Zen <[email protected]>
1 parent f209923 commit fdcecb2

File tree

4 files changed

+6
-11
lines changed

4 files changed

+6
-11
lines changed

docs/configuration.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Modules write to a shared config dict that is accessible by other modules.
4141
* `build_dir` (initramfs_build) If relative, it will be placed under `tmpdir`, defines the build directory.
4242
* `random_build_dir` (false) Adds a uuid to the end of the build dir name when true.
4343
* `build_logging` (false) Enables additional logging during the build process.
44-
* `make_nodes` (false) Create real device nodes in the build dir.
44+
* `make_nodes` (false) Create real device nodes in the build dir. Otherwise they are created in the CPIO archive.
4545
* `find_libgcc` (true) Automatically locates libgcc using ldconfig -p and adds it to the initramfs.
4646
* `musl_libc` (false) Disable ldconfig -p usage for libgcc detection, skip ld.so.cache regeneration.
4747
* `out_dir` (initramfs_out) If relative, it will be placed under `tmpdir`, defines the output directory.
@@ -296,7 +296,6 @@ This module can be enabled by adding `ugrd.fs.fakeudev` to the `modules` list.
296296

297297
This module handles CPIO creation.
298298

299-
* `mknod_cpio` (true) Only create device nodes within the CPIO.
300299
* `cpio_compression` (xz) Sets the compression method for the CPIO file, passed to PyCPIO.
301300
* `cpio_rotate` (true) Rotates old CPIO files, keeping `old_count` number of old files.
302301

src/ugrd/base/core.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__author__ = "desultory"
2-
__version__ = "4.7.0"
2+
__version__ = "4.7.1"
33

44
from os import environ, makedev, mknod, uname
55
from pathlib import Path
@@ -303,9 +303,7 @@ def deploy_nodes(self) -> None:
303303
self.logger.info("Created device node '%s' at path: %s" % (node, node_path))
304304
except PermissionError as e:
305305
self.logger.error("Unable to create device node %s at path: %s" % (node, node_path))
306-
self.logger.info(
307-
"`mknod_cpio` in `ugrd.base` can be used to generate device nodes within the initramfs archive if they cannot be created on the host system."
308-
)
306+
self.logger.info("When `make_nodes` is disabled, device nodes are synthetically created in the resulting CPIO archive.")
309307
raise e
310308

311309

src/ugrd/fs/cpio.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__author__ = "desultory"
2-
__version__ = "3.7.3"
2+
__version__ = "3.8.0"
33

44
from pathlib import Path
55

@@ -86,13 +86,13 @@ def make_cpio(self) -> None:
8686
"""
8787
Populates the CPIO archive using the build directory,
8888
writes it to the output file, and rotates the output file if necessary.
89-
Creates device nodes in the CPIO archive if the mknod_cpio option is set.
89+
Creates device nodes in the CPIO archive if make_nodes is False. (make_nodes will create actual files instead)
9090
Raises FileNotFoundError if the output directory does not exist.
9191
"""
9292
cpio = self._cpio_archive
9393
cpio.append_recursive(self._get_build_path("/"), relative=True)
9494

95-
if self.get("mknod_cpio"):
95+
if not self.get("make_nodes"):
9696
for node in self["nodes"].values():
9797
self.logger.debug("Adding CPIO node: %s" % node)
9898
cpio.add_chardev(name=node["path"], mode=node["mode"], major=node["major"], minor=node["minor"])

src/ugrd/fs/cpio.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
mknod_cpio = true
21
cpio_compression = "xz"
32
cpio_rotate = true
43
check_cpio = true
@@ -14,7 +13,6 @@ check_cpio = true
1413

1514
[custom_parameters]
1615
cpio_rotate = "bool" # makes a .old backup of the cpio file if it already exists.
17-
mknod_cpio = "bool" # When enabled, mknod is not used to create device nodes, they are just created in the cpio.
1816
cpio_compression = "str" # The compression method to use for the cpio file. XZ and ZSTD are supported.
1917
_cpio_archive = "PyCPIO" # The cpio archive object.
2018
check_cpio = "bool" # When enabled, the CPIO archive contents are checked for errors.

0 commit comments

Comments
 (0)