diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2023-02-21 00:02:33 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-21 00:02:33 +0000 |
commit | e3e8374b6ff7ed1608897078beb92c4a55cdc4f3 (patch) | |
tree | 933d7044a25f2a981efa492f33b4b40008445654 /pkgs/build-support | |
parent | 1a0051b61eb313391088cc73875631af219e6376 (diff) | |
parent | 5be19d43a20d64e179b9fd5e6b480711702dcff3 (diff) |
Merge master into staging-next
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/kernel/make-initrd-ng/README.md | 3 | ||||
-rw-r--r-- | pkgs/build-support/kernel/make-initrd-ng/src/main.rs | 16 |
2 files changed, 18 insertions, 1 deletions
diff --git a/pkgs/build-support/kernel/make-initrd-ng/README.md b/pkgs/build-support/kernel/make-initrd-ng/README.md index 741eba67e43f0..d92b7eab7fe18 100644 --- a/pkgs/build-support/kernel/make-initrd-ng/README.md +++ b/pkgs/build-support/kernel/make-initrd-ng/README.md @@ -38,6 +38,9 @@ object is copied depends on its type. - If it is *also* an ELF file, then all of its direct shared library dependencies are also listed as objects to be copied. + - If an unwrapped file exists as `.[filename]-wrapped`, then it is + also listed as an object to be copied. + 2. A directory's direct children are listed as objects to be copied, and a directory at the same absolute path in the initrd is created. diff --git a/pkgs/build-support/kernel/make-initrd-ng/src/main.rs b/pkgs/build-support/kernel/make-initrd-ng/src/main.rs index 89a7c08fda7ea..c23713b723c39 100644 --- a/pkgs/build-support/kernel/make-initrd-ng/src/main.rs +++ b/pkgs/build-support/kernel/make-initrd-ng/src/main.rs @@ -1,8 +1,9 @@ use std::collections::{HashSet, VecDeque}; use std::env; -use std::ffi::OsStr; +use std::ffi::{OsStr, OsString}; use std::fs; use std::hash::Hash; +use std::iter::FromIterator; use std::io::{BufRead, BufReader, Error}; use std::os::unix; use std::path::{Component, Path, PathBuf}; @@ -163,6 +164,19 @@ fn handle_path( let typ = fs::symlink_metadata(&source)?.file_type(); if typ.is_file() && !target.exists() { copy_file(&source, &target, queue)?; + + if let Some(filename) = source.file_name() { + source.set_file_name(OsString::from_iter([ + OsStr::new("."), + filename, + OsStr::new("-wrapped"), + ])); + + let wrapped_path = source.as_path(); + if wrapped_path.exists() { + queue.push_back(Box::from(wrapped_path)); + } + } } else if typ.is_symlink() { let link_target = fs::read_link(&source)?; |