summaryrefslogtreecommitdiffstats
path: root/nix-rust/src/lib.rs
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-03-27 23:40:35 +0100
committerEelco Dolstra <edolstra@gmail.com>2019-11-26 22:07:28 +0100
commit045708db4343174f30f3647776971c852f72a9e8 (patch)
treec37c82882d48e44338c9bae61eacb3839421f359 /nix-rust/src/lib.rs
parente60f6bd4ce831ced94fafeb527c429b6f88159ac (diff)
Make <nix/unpack-channel.nix> a builtin builder
This was the last function using a shell script, so this allows us to get rid of tar, coreutils, bash etc.
Diffstat (limited to 'nix-rust/src/lib.rs')
-rw-r--r--nix-rust/src/lib.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/nix-rust/src/lib.rs b/nix-rust/src/lib.rs
index 799d52e31..ac6dee543 100644
--- a/nix-rust/src/lib.rs
+++ b/nix-rust/src/lib.rs
@@ -33,7 +33,7 @@ pub extern "C" fn unpack_tarfile(source: Source, dest_dir: &str) -> bool {
for file in tar.entries().unwrap() {
let mut file = file.unwrap();
- let dest_file = dest_dir.join(file.header().path().unwrap());
+ let dest_file = dest_dir.join(file.path().unwrap());
fs::create_dir_all(dest_file.parent().unwrap()).unwrap();
@@ -55,6 +55,9 @@ pub extern "C" fn unpack_tarfile(source: Source, dest_dir: &str) -> bool {
.unwrap();
io::copy(&mut file, &mut f).unwrap();
}
+ tar::EntryType::Symlink => {
+ std::os::unix::fs::symlink(file.header().link_name().unwrap().unwrap(), dest_file).unwrap();
+ }
t => panic!("Unsupported tar entry type '{:?}'.", t),
}
}