deb: add --inject to inject a package
Some checks failed
CI / build (push) Failing after 20m25s
CI / snap (push) Has been skipped

This commit is contained in:
2026-02-18 23:19:57 +01:00
parent eb3e71a938
commit 87b48bf9c8
3 changed files with 50 additions and 4 deletions

View File

@@ -10,6 +10,7 @@ use std::path::Path;
use crate::apt;
use crate::deb::cross;
#[allow(clippy::too_many_arguments)]
pub async fn build(
package: &str,
version: &str,
@@ -18,6 +19,7 @@ pub async fn build(
build_root: &str,
cross: bool,
ppa: Option<&str>,
inject_packages: Option<&[&str]>,
) -> Result<(), Box<dyn Error>> {
// Environment
let mut env = HashMap::<String, String>::new();
@@ -166,6 +168,20 @@ pub async fn build(
.to_str()
.ok_or("Invalid package directory path")?;
// Install injected packages if specified
if let Some(packages) = inject_packages {
log::info!("Installing injected packages: {:?}", packages);
let mut cmd = ctx.command("apt-get");
cmd.envs(env.clone())
.arg("-y")
.arg("install")
.args(packages);
let status = cmd.status()?;
if !status.success() {
return Err(format!("Could not install injected packages: {:?}", packages).into());
}
}
// Install arch-specific build dependencies
log::debug!("Installing arch-specific build dependencies...");
let mut cmd = ctx.command("apt-get");