Skip to content

Commit

Permalink
chroot: add support for XDG_CONFIG_HOME/pacman/makepkg.conf
Browse files Browse the repository at this point in the history
Allow users to override makepkg.conf settings by placing a config file
in $XDG_CONFIG_HOME/pacman/makepkg.conf. When present, this config
will be mounted read-only in the chroot at /etc/makepkg.conf.d/xdg.conf,
allowing its settings to take precedence over the base config.

Closes Morganamilo#1283
  • Loading branch information
Roman Stingler committed Dec 17, 2024
1 parent 330e71b commit e46155e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/chroot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,19 @@ impl Chroot {
cmd.arg(format!("{}.d:/etc/makepkg.conf.d", self.makepkg_conf));
}

let xdg_config = std::env::var_os("XDG_CONFIG_HOME")
.map(|p| PathBuf::from(p).join("pacman/makepkg.conf"));

if let Some(xdg_config) = xdg_config {
if xdg_config.exists() {
cmd.arg("--bind-ro");
cmd.arg(format!(
"{}:/etc/makepkg.conf.d/xdg.conf",
xdg_config.display()
));
}
}

for file in &self.ro {
cmd.arg("--bind-ro");
cmd.arg(file);
Expand Down

0 comments on commit e46155e

Please sign in to comment.