migrate to rust

This commit is contained in:
Mikaël Cluseau
2024-04-29 12:54:25 +02:00
parent 6e1cb57e03
commit 8fcd2d6684
85 changed files with 3451 additions and 2460 deletions

19
src/cmd/bootstrap.rs Normal file
View File

@ -0,0 +1,19 @@
use eyre::Result;
use tokio::{fs, io, io::AsyncWriteExt};
pub async fn run() -> Result<()> {
let mut input = io::stdin();
let mut out = fs::File::create("/bootstrap.tar.part").await?;
let n = io::copy(&mut input, &mut out).await?;
out.flush().await?;
drop(out);
eprintln!("copied {n} bytes");
fs::rename("/bootstrap.tar.part", "/bootstrap.tar").await?;
eprintln!("/bootstrap.tar ready to use");
Ok(())
}