Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Modules write to a shared config dict that is accessible by other modules.
* `build_dir` (initramfs_build) If relative, it will be placed under `tmpdir`, defines the build directory.
* `random_build_dir` (false) Adds a uuid to the end of the build dir name when true.
* `build_logging` (false) Enables additional logging during the build process.
* `make_nodes` (false) Create real device nodes in the build dir.
* `make_nodes` (false) Create real device nodes in the build dir. Otherwise they are created in the CPIO archive.
* `find_libgcc` (true) Automatically locates libgcc using ldconfig -p and adds it to the initramfs.
* `musl_libc` (false) Disable ldconfig -p usage for libgcc detection, skip ld.so.cache regeneration.
* `out_dir` (initramfs_out) If relative, it will be placed under `tmpdir`, defines the output directory.
Expand Down Expand Up @@ -296,7 +296,6 @@ This module can be enabled by adding `ugrd.fs.fakeudev` to the `modules` list.

This module handles CPIO creation.

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

Expand Down
6 changes: 2 additions & 4 deletions src/ugrd/base/core.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__author__ = "desultory"
__version__ = "4.7.0"
__version__ = "4.7.1"

from os import environ, makedev, mknod, uname
from pathlib import Path
Expand Down Expand Up @@ -303,9 +303,7 @@ def deploy_nodes(self) -> None:
self.logger.info("Created device node '%s' at path: %s" % (node, node_path))
except PermissionError as e:
self.logger.error("Unable to create device node %s at path: %s" % (node, node_path))
self.logger.info(
"`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."
)
self.logger.info("When `make_nodes` is disabled, device nodes are synthetically created in the resulting CPIO archive.")
raise e


Expand Down
6 changes: 3 additions & 3 deletions src/ugrd/fs/cpio.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__author__ = "desultory"
__version__ = "3.7.3"
__version__ = "3.8.0"

from pathlib import Path

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

if self.get("mknod_cpio"):
if not self.get("make_nodes"):
for node in self["nodes"].values():
self.logger.debug("Adding CPIO node: %s" % node)
cpio.add_chardev(name=node["path"], mode=node["mode"], major=node["major"], minor=node["minor"])
Expand Down
2 changes: 0 additions & 2 deletions src/ugrd/fs/cpio.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
mknod_cpio = true
cpio_compression = "xz"
cpio_rotate = true
check_cpio = true
Expand All @@ -14,7 +13,6 @@ check_cpio = true

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