about summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorLily Foster <lily@lily.flowers>2023-02-20 07:02:55 -0500
committerLily Foster <lily@lily.flowers>2023-02-20 07:02:55 -0500
commit4df8f9a2f82c85a8c2ef64362cef5a3cec695dbb (patch)
tree6b1cf514261047902050beca0c198b34e4bde2f1 /pkgs/build-support
parent9b31147be92551e14c3b906f45096d6c7961e6ff (diff)
make-initrd-ng: support wrapped executables
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/kernel/make-initrd-ng/src/main.rs16
1 files changed, 15 insertions, 1 deletions
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)?;