Rebrand to boco
CI / build (push) Successful in 13s

This commit is contained in:
2026-09-11 17:56:38 +02:00
parent 8782baa705
commit a24e1efe31
12 changed files with 142 additions and 142 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
[package]
name = "slim-init"
name = "boco-init"
version = "0.1.0"
edition = "2024"
+13 -13
View File
@@ -1,6 +1,6 @@
//! slim universal init.
//! boco universal init.
//!
//! Injected by `slim build` at /slim/init and invoked via init=/slim/init.
//! Injected by `boco build` at /boco/init and invoked via init=/boco/init.
//! Sets up devices, filesystems, networking, and 9p shares, then execs the
//! container's CMD/ENTRYPOINT (or a runtime override) with execvp so the
//! command becomes PID 1 directly.
@@ -19,7 +19,7 @@ use std::path::Path;
use std::process::Command;
fn warn(msg: &str) {
eprintln!("slim-init: {msg}");
eprintln!("boco-init: {msg}");
}
/// Run a fallible operation, logging on error.
@@ -219,7 +219,7 @@ fn setup_9p_shares(workdir: &str) {
let b64 = base64::engine::general_purpose::STANDARD;
for tok in cmdline.split_whitespace() {
if let Some(rest) = tok.strip_prefix("slim.mount=") {
if let Some(rest) = tok.strip_prefix("boco.mount=") {
let Some((tag, dest_b64)) = rest.split_once(':') else {
continue;
};
@@ -270,11 +270,11 @@ fn split_null_delimited(data: &[u8]) -> Vec<String> {
}
fn read_argv() -> Vec<String> {
// Check for runtime override: slim.cmd=<base64(null-delimited argv)>
// Check for runtime override: boco.cmd=<base64(null-delimited argv)>
let b64 = base64::engine::general_purpose::STANDARD;
if let Ok(cmdline) = fs::read_to_string("/proc/cmdline") {
for tok in cmdline.split_whitespace() {
if let Some(rest) = tok.strip_prefix("slim.cmd=")
if let Some(rest) = tok.strip_prefix("boco.cmd=")
&& let Ok(decoded) = b64.decode(rest)
{
let argv = split_null_delimited(&decoded);
@@ -285,15 +285,15 @@ fn read_argv() -> Vec<String> {
}
}
// Fall back to build-time argv from /slim/exec
match fs::read("/slim/exec") {
// Fall back to build-time argv from /boco/exec
match fs::read("/boco/exec") {
Ok(data) => {
let argv = split_null_delimited(&data);
if !argv.is_empty() {
return argv;
}
}
Err(e) => warn(&format!("read /slim/exec: {e}")),
Err(e) => warn(&format!("read /boco/exec: {e}")),
}
warn("no command found, falling back to /bin/sh");
@@ -301,7 +301,7 @@ fn read_argv() -> Vec<String> {
}
fn apply_env() {
if let Ok(data) = fs::read("/slim/env") {
if let Ok(data) = fs::read("/boco/env") {
for entry in split_null_delimited(&data) {
if let Some((key, val)) = entry.split_once('=') {
// SAFETY: we are single-threaded before fork/exec.
@@ -312,7 +312,7 @@ fn apply_env() {
}
fn apply_workdir() {
if let Some(dir) = read_file_opt("/slim/workdir") {
if let Some(dir) = read_file_opt("/boco/workdir") {
try_io("set working directory", || env::set_current_dir(&dir));
}
}
@@ -413,7 +413,7 @@ fn main() {
setup_networking();
// === 9p shares ===
let workdir = read_file_opt("/slim/workdir").unwrap_or_default();
let workdir = read_file_opt("/boco/workdir").unwrap_or_default();
setup_9p_shares(&workdir);
// === Environment & working directory ===
@@ -421,7 +421,7 @@ fn main() {
apply_workdir();
// === Resolve user for privilege drop ===
let user = read_file_opt("/slim/user").and_then(|spec| resolve_user(&spec));
let user = read_file_opt("/boco/user").and_then(|spec| resolve_user(&spec));
// === Execute the configured command ===
let argv = read_argv();