rebrand to krata

This commit is contained in:
Alex Zenla
2024-02-21 20:57:46 +00:00
parent af50f1d996
commit c582f15c54
35 changed files with 139 additions and 136 deletions

View File

@ -1,5 +1,5 @@
[package]
name = "hyphactr"
name = "kratactr"
version.workspace = true
edition = "2021"
resolver = "2"
@ -22,12 +22,12 @@ ipnetwork = { workspace = true }
workspace = true
features = ["process"]
[dependencies.hypha]
[dependencies.krata]
path = "../shared"
[lib]
path = "src/lib.rs"
[[bin]]
name = "hyphactr"
name = "kratactr"
path = "bin/init.rs"

View File

@ -1,19 +1,19 @@
use anyhow::{anyhow, Result};
use env_logger::Env;
use hyphactr::init::ContainerInit;
use kratactr::init::ContainerInit;
use std::env;
#[tokio::main]
async fn main() -> Result<()> {
env::set_var("RUST_BACKTRACE", "1");
env_logger::Builder::from_env(Env::default().default_filter_or("warn")).init();
if env::var("HYPHA_UNSAFE_ALWAYS_ALLOW_INIT").unwrap_or("0".to_string()) != "1" {
if env::var("KRATA_UNSAFE_ALWAYS_ALLOW_INIT").unwrap_or("0".to_string()) != "1" {
let pid = std::process::id();
if pid > 3 {
return Err(anyhow!(
"not running because the pid of {} indicates this is probably not \
the right context for the init daemon. \
run with HYPHA_UNSAFE_ALWAYS_ALLOW_INIT=1 to bypass this check",
run with KRATA_UNSAFE_ALWAYS_ALLOW_INIT=1 to bypass this check",
pid
));
}

View File

@ -1,7 +1,7 @@
use anyhow::{anyhow, Result};
use futures::stream::TryStreamExt;
use hypha::{LaunchInfo, LaunchNetwork};
use ipnetwork::IpNetwork;
use krata::{LaunchInfo, LaunchNetwork};
use log::{trace, warn};
use nix::libc::{c_int, dup2, ioctl, wait};
use nix::unistd::{execve, fork, ForkResult, Pid};
@ -289,7 +289,7 @@ impl ContainerInit {
fs::create_dir(etc)?;
}
let resolv = PathBuf::from_str("/etc/resolv.conf")?;
let mut lines = vec!["# hypha resolver configuration".to_string()];
let mut lines = vec!["# krata resolver configuration".to_string()];
for nameserver in &network.resolver.nameservers {
lines.push(format!("nameserver {}", nameserver));
}
@ -386,7 +386,7 @@ impl ContainerInit {
None => vec![],
Some(value) => value.clone(),
};
env.push("HYPHA_CONTAINER=1".to_string());
env.push("KRATA_CONTAINER=1".to_string());
env.push("TERM=vt100".to_string());
if let Some(extra_env) = &launch.env {
env.extend_from_slice(extra_env.as_slice());
@ -446,8 +446,8 @@ impl ContainerInit {
}
fn death(&mut self, code: c_int) -> Result<()> {
println!("[hypha] container process exited: status = {}", code);
println!("[hypha] looping forever");
println!("[krata] container process exited: status = {}", code);
println!("[krata] looping forever");
loop {
sleep(Duration::from_secs(1));
}