Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for downloading extra packages in the disc image #17

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,10 @@ pub struct DnfRootBuilder {
pub arch_exclude: BTreeMap<String, Vec<String>>,
#[serde(default)]
pub repodir: Option<PathBuf>,

/// Extra packages to download in the disc image idk
#[serde(default)]
pub extra_packages: Vec<String>,
}

impl RootBuilder for DnfRootBuilder {
Expand Down Expand Up @@ -375,6 +379,24 @@ impl RootBuilder for DnfRootBuilder {
manifest.users.iter().try_for_each(|user| user.add_to_chroot(&chroot))?;
}

// get the workspace folder

let out = manifest.out_file.as_ref().map_or("katsu-work/repo", |s| s);
let out = Path::new(out);

if !self.extra_packages.is_empty() {
// workaround for being unable to access fields in run_cmd!
let extra_packages = self.extra_packages.clone();
info!("Downloading extra packages to workspace");
// todo: copy the repo to the resulting image
// run command in host namespace
cmd_lib::run_cmd!(
mkdir -p $out;
$dnf download -y --destdir=$out $[extra_packages] 2>&1;
createrepo_c $out;
)?;
}

// now, let's run some funny post-install scripts

info!("Running post-install scripts");
Expand Down
Loading