summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorHermes Agent <hermes@localhost>2026-08-12 00:02:26 +0000
committerHermes Agent <hermes@localhost>2026-08-12 00:02:26 +0000
commit25f39c857da591c665865b77483b79495caf5e00 (patch)
tree1e7dd7118fcd1978b13c8bd1aa6cb202bb72a32a /src/main.rs
parent1860cc5beb8df6e85d0f9690e5852709a534ebd7 (diff)
Replace legacy profile parser with typed image spec
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs61
1 files changed, 2 insertions, 59 deletions
diff --git a/src/main.rs b/src/main.rs
index f468124..1ca0cab 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,61 +1,4 @@
-use std::env;
-use std::fs;
-use std::path::PathBuf;
-use std::process::Command;
-
-use alt_controller_image::{artifact_path, Profile};
-
-fn run(command: &mut Command, description: &str) {
- let status = command.status().unwrap_or_else(|error| panic!("{description}: {error}"));
- assert!(status.success(), "{description} exited with {status}");
-}
-
fn main() {
- let project = env::current_dir().expect("current directory");
- let profile_path = project.join("profiles/alt-controller.profile");
- let profile = Profile::load(&profile_path).unwrap_or_else(|error| panic!("profile: {error}"));
- let workdir: PathBuf = project.join("work/alt-controller");
- let rootfs = workdir.join("chroot");
- let artifact = artifact_path(&project);
-
- let archive_existing = env::args().any(|argument| argument == "--archive-existing");
- if !archive_existing {
- if workdir.exists() {
- run(
- Command::new("sudo").args(["rm", "-rf"]).arg(&workdir),
- "remove previous Hasher workdir",
- );
- }
- fs::create_dir_all(&workdir).expect("create Hasher workdir");
- run(
- Command::new("hsh")
- .args(["--mountpoints=/proc", "--initroot-only", "--workdir"])
- .arg(&workdir),
- "initialize isolated Hasher root",
- );
-
- let mut install = Command::new("hsh-install");
- install.args(["--mountpoints=/proc", "--workdir"]);
- install.arg(&workdir);
- install.args(profile.install_arguments());
- run(&mut install, "install target rootfs packages");
- }
- assert!(rootfs.is_dir(), "isolated rootfs is missing: {}", rootfs.display());
- fs::create_dir_all(artifact.parent().expect("artifact parent")).expect("create output directory");
-
- if artifact.exists() {
- fs::remove_file(&artifact).expect("remove previous artifact");
- }
- run(
- Command::new("sudo")
- .arg("tar")
- .args(["--numeric-owner", "--exclude=./.host", "-C"])
- .arg(&rootfs)
- .args(["-cpf"])
- .arg(&artifact)
- .arg("."),
- "archive isolated rootfs",
- );
-
- println!("{}", artifact.display());
+ eprintln!("The command-line interface is not available yet. Use the library to load an ImageSpec.");
+ std::process::exit(2);
}