feat: add some functionality to bootpkg
This commit is contained in:
parent
94f0e7070b
commit
70a22810b2
2 changed files with 24 additions and 14 deletions
|
@ -13,7 +13,7 @@ pub struct PKGR {
|
|||
#[derive(Serialize, Deserialize)]
|
||||
pub struct Bootstrap {
|
||||
pub check_installed_commands: Vec<String>,
|
||||
pub commands: Vec<String>
|
||||
pub commands: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
|
@ -30,7 +30,7 @@ pub fn mani_from_str(s: &str) -> Manifest<Option<PKGR>> {
|
|||
fs: mani.fs,
|
||||
bin: mani.bin,
|
||||
build: mani.build,
|
||||
pkgr: bmani.pkgr
|
||||
pkgr: bmani.pkgr,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,26 +41,29 @@ pub fn run_bootstrap(mani: Manifest<Option<PKGR>>) -> bool {
|
|||
std::process::Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(s.into())
|
||||
.spawn().expect("Could not spawn process.")
|
||||
.wait().expect("Could not wait for process.")
|
||||
.code().expect("Could not fetch exit code.")
|
||||
.spawn()
|
||||
.expect("Could not spawn process.")
|
||||
.wait()
|
||||
.expect("Could not wait for process.")
|
||||
.code()
|
||||
.expect("Could not fetch exit code.")
|
||||
}
|
||||
|
||||
for command in &bootstrap.check_installed_commands {
|
||||
if run_command(command) != 0 {
|
||||
println!("!! Command failed: {}", command);
|
||||
println!("!! Already installed.");
|
||||
return false
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for command in &bootstrap.commands {
|
||||
if run_command(command) != 0 {
|
||||
println!("!! Command failed: {}", command);
|
||||
println!("!! Bootstrap failed!!!");
|
||||
return false
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue