diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000000..1e0a91932a --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "coreos-assembler" +version = "0.1.0" +authors = ["Colin Walters "] + +[dependencies] +clap = "~2.28" +failure = "0.1.1" + +[[bin]] +name = "coreos-assembler-rs" +path = "src/coreos-assembler.rs" \ No newline at end of file diff --git a/Makefile b/Makefile index 597abdf843..d0a1ec358c 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,19 @@ PREFIX ?= /usr DESTDIR ?= -.PHONY: all mantle install +.PHONY: all rust mantle install -all: mantle +all: mantle rust + +rust: + cargo build --release mantle: cd mantle && ./build ore kola kolet install: install -D -t $(DESTDIR)$(PREFIX)/bin coreos-assembler $$(find src/compat -maxdepth 1 -type f) + install -D -t $(DESTDIR)$(PREFIX)/libexec target/release/coreos-assembler-rs install -D -t $(DESTDIR)$(PREFIX)/libexec/coreos-assembler $$(find src/ -maxdepth 1 -type f) install -D -t $(DESTDIR)$(PREFIX)/bin mantle/bin/{ore,kola} install -D -m 0755 -t $(DESTDIR)$(PREFIX)/lib/kola/amd64 mantle/bin/amd64/kolet diff --git a/src/coreos-assembler.rs b/src/coreos-assembler.rs new file mode 100644 index 0000000000..5547ad8005 --- /dev/null +++ b/src/coreos-assembler.rs @@ -0,0 +1,38 @@ +extern crate clap; +#[macro_use] +extern crate failure; + +use failure::Error; +use clap::{App, SubCommand}; + +fn hello() -> Result<(), Error> { + println!("🦀"); + Ok(()) +} + +fn run() -> Result<(), Error> { + let matches = App::new("coreos-assembler") + .version("0.1") + .about("CoreOS assembler") + .subcommand( + SubCommand::with_name("hello") + .about("Say hello") + ) + .get_matches(); + + match matches.subcommand() { + ("hello", _) => hello(), + ("", _) => bail!("No command given"), + _ => unreachable!(), + } +} + +fn main() { + match run() { + Ok(_) => {} + Err(e) => { + eprintln!("{:?}", e); + std::process::exit(1) + } + } +}