mirror of
https://github.com/NixOS/nix
synced 2025-06-25 23:11:16 +02:00
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.
This commit is contained in:
parent
e60f6bd4ce
commit
045708db43
9 changed files with 55 additions and 84 deletions
|
@ -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),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue