Skip to content

Commit

Permalink
feat: add shell task
Browse files Browse the repository at this point in the history
  • Loading branch information
koehlma committed Nov 29, 2023
1 parent 33374b6 commit 3306eec
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
14 changes: 13 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/rugpi-bakery/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ anyhow = "1.0.71"
camino = { version = "1.1.4", features = ["serde"] }
clap = { version = "4.3.8", features = ["derive"] }
hex = "0.4.3"
nix = { version = "0.27.1", features = ["process"] }
rugpi-common = { path = "../rugpi-common" }
serde = { version = "1.0.171", features = ["derive", "rc"] }
sha1 = "0.10.5"
Expand Down
11 changes: 10 additions & 1 deletion crates/rugpi-bakery/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
use std::path::PathBuf;
use std::{
ffi::{CStr, CString},
path::PathBuf,
};

use clap::Parser;
use rugpi_common::Anyhow;
Expand Down Expand Up @@ -31,6 +34,8 @@ pub enum Task {
Customize(CustomizeTask),
/// Bake a final image for distribution.
Bake(BakeTask),
/// Spawn a shell in the Rugpi Bakery Docker container.
Shell,
}

fn main() -> Anyhow<()> {
Expand All @@ -45,6 +50,10 @@ fn main() -> Anyhow<()> {
Task::Bake(task) => {
bake::run(&args, task)?;
}
Task::Shell => {
let zsh_prog = CString::new("/bin/zsh")?;
nix::unistd::execv::<&CStr>(&zsh_prog, &[])?;
}
}
Ok(())
}

0 comments on commit 3306eec

Please sign in to comment.