Making some progress
This commit is contained in:
parent
783c53ebb8
commit
5361b36238
3 changed files with 22 additions and 11 deletions
|
|
@ -2,7 +2,8 @@ use std::{fs, io, path::PathBuf};
|
|||
|
||||
use anyhow::Result;
|
||||
use clap::{Parser, Subcommand};
|
||||
use ublue_rs::Recipe;
|
||||
use tera::{Context, Tera};
|
||||
use ublue_rs::{Recipe, DEFAULT_CONTAINERFILE};
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(name = "Ublue Builder", author, version, about, long_about = None)]
|
||||
|
|
@ -40,7 +41,11 @@ fn main() -> Result<()> {
|
|||
containerfile,
|
||||
} => {
|
||||
let recipe: Recipe = serde_yaml::from_str(fs::read_to_string(recipe)?.as_str())?;
|
||||
println!("{:#?}", recipe);
|
||||
println!("{:#?}", &recipe);
|
||||
let context = Context::from_serialize(recipe)?;
|
||||
dbg!(&context);
|
||||
let output = Tera::one_off(DEFAULT_CONTAINERFILE, &context, true)?;
|
||||
println!("{output}");
|
||||
}
|
||||
CommandArgs::Build { containerfile } => {
|
||||
println!("Not yet implemented!");
|
||||
|
|
|
|||
|
|
@ -18,9 +18,9 @@ pub struct Recipe {
|
|||
pub rpm: Rpm,
|
||||
|
||||
#[serde(rename = "usr-dir-overlays")]
|
||||
pub usr_dir_overlays: Vec<String>,
|
||||
pub usr_dir_overlays: Option<Vec<String>>,
|
||||
|
||||
pub containerfiles: Containerfiles,
|
||||
pub containerfiles: Option<Containerfiles>,
|
||||
|
||||
pub firstboot: FirstBoot,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,9 +4,11 @@ ARG RECIPE={{ recipe }}
|
|||
|
||||
COPY usr/ /usr
|
||||
|
||||
{% if usr_dir_overlays %}
|
||||
{% for usr_dir in usr_dir_overlays %}
|
||||
COPY {{ usr_dir }}/ /usr
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
COPY ${RECIPE} /usr/share/ublue-os/recipe.yml
|
||||
|
||||
|
|
@ -22,16 +24,18 @@ COPY --from=gcr.io/projectsigstore/cosign /ko-app/cosign /usr/bin/cosign
|
|||
|
||||
COPY scripts /tmp/scripts
|
||||
|
||||
{% for containerfile in containerfiles.pre %}
|
||||
{{ print_containerfile(containerfile) }}
|
||||
{% endfor %}
|
||||
{% if continerfiles %}
|
||||
{% for containerfile in containerfiles.pre %}
|
||||
{{ print_containerfile(containerfile = containerfile) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% for script in scripts.pre %}
|
||||
RUN chmod +x /tmp/scripts/{{ script }} && /tmp/scripts/{{ script }}
|
||||
{% endfor %}
|
||||
|
||||
{% for repo in rpm.repo %}
|
||||
RUN wget "${{{ repo }}//%FEDORA_VERSION%/{{ fedora_verison }}}" -P "/etc/yum.repos.d/"
|
||||
RUN wget {% raw %}"${{% endraw %}{{ repo }}//%FEDORA_VERSION%/{{ fedora_verison }}{% raw %}}"{% endraw %} -P "/etc/yum.repos.d/"
|
||||
{% endfor %}
|
||||
|
||||
RUN rpm-ostree uninstall {% for app in rpm.remove %}{{ app }}{% endfor %}
|
||||
|
|
@ -42,8 +46,10 @@ RUN rpm-ostree install {% for app in rpm.install %}{{ app }}{% endfor %}
|
|||
RUN chmod +x /tmp/scripts/{{ script }} && /tmp/scripts/{{ script }}
|
||||
{% endfor %}
|
||||
|
||||
{% for containerfile in containerfiles.post %}
|
||||
{{ print_containerfile(containerfile) }}
|
||||
{% endfor %}
|
||||
{% if continerfiles %}
|
||||
{% for containerfile in containerfiles.post %}
|
||||
{{ print_containerfile(containerfile = containerfile) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
RUN rm -rf /tmp/* /var/* && ostree container commit
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue