Fixed install_package except WHERE TF IS IT PUTTING THE SYMLINKS
This commit is contained in:
parent
af2897efb1
commit
aa66e60019
1 changed files with 52 additions and 34 deletions
|
@ -6,6 +6,7 @@
|
|||
clippy::missing_panics_doc
|
||||
)]
|
||||
#![feature(str_as_str)]
|
||||
#![feature(impl_trait_in_bindings)]
|
||||
|
||||
use std::{
|
||||
ffi::OsString,
|
||||
|
@ -1076,27 +1077,43 @@ pub fn install_package(
|
|||
}
|
||||
}
|
||||
|
||||
for entry in std::fs::read_dir(&path)? {
|
||||
println!("entry");
|
||||
/// Fuck me.
|
||||
#[derive(Clone)]
|
||||
struct VisitDir<'a> {
|
||||
/// Fuck me.
|
||||
f: &'a dyn Fn(std::io::Result<std::fs::DirEntry>, VisitDir) -> std::io::Result<()>
|
||||
}
|
||||
|
||||
let diritem = VisitDir {
|
||||
f: &|entry: std::io::Result<std::fs::DirEntry>, visit_dir: VisitDir| -> std::io::Result<()> {
|
||||
let entry = entry?;
|
||||
|
||||
if entry.file_name() == *".BUILDINFO"
|
||||
|| entry.file_name() == *".MTREE"
|
||||
|| entry.file_name() == *".PKGINFO"
|
||||
{
|
||||
continue;
|
||||
return Ok(());
|
||||
}
|
||||
println!("{}", entry.file_name().to_string_lossy());
|
||||
|
||||
if entry.file_type()?.is_dir() {
|
||||
std::fs::create_dir_all(out.join(entry.path()))?;
|
||||
for entry in std::fs::read_dir(path.join(entry.path()))? {
|
||||
(visit_dir.clone().f)(entry, visit_dir.clone())?;
|
||||
}
|
||||
} else {
|
||||
std::fs::create_dir_all(out.join(entry.path().parent().unwrap()))?;
|
||||
std::fs::remove_file(out.join(entry.path()))?;
|
||||
std::os::unix::fs::symlink(path.join(entry.path()), out.join(entry.path()))?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
};
|
||||
|
||||
for entry in std::fs::read_dir(&path)? {
|
||||
(diritem.clone().f)(entry, diritem.clone())?;
|
||||
}
|
||||
|
||||
if std::fs::exists(out.join(".INSTALL"))? {
|
||||
std::os::unix::fs::chroot(&out)?;
|
||||
|
||||
if !std::process::Command::new("/usr/bin/bash")
|
||||
|
@ -1116,6 +1133,7 @@ pub fn install_package(
|
|||
std::os::unix::fs::chroot(".")?;
|
||||
|
||||
std::fs::remove_file(out.join(".INSTALL"))?;
|
||||
}
|
||||
|
||||
let mut packages = std::fs::OpenOptions::new()
|
||||
.create(true)
|
||||
|
|
Loading…
Add table
Reference in a new issue