Skip to content

Commit 61fa17c

Browse files
author
Roman Stingler
committed
chroot: add support for XDG_CONFIG_HOME/pacman/makepkg.conf
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 #1283
1 parent c9c4a23 commit 61fa17c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/chroot.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,19 @@ impl Chroot {
9292
cmd.arg(format!("{}.d:/etc/makepkg.conf.d", self.makepkg_conf));
9393
}
9494

95+
let xdg_config = std::env::var_os("XDG_CONFIG_HOME")
96+
.map(|p| PathBuf::from(p).join("pacman/makepkg.conf"));
97+
98+
if let Some(xdg_config) = xdg_config {
99+
if xdg_config.exists() {
100+
cmd.arg("--bind-ro");
101+
cmd.arg(format!(
102+
"{}:/etc/makepkg.conf.d/xdg.conf",
103+
xdg_config.display()
104+
));
105+
}
106+
}
107+
95108
for file in &self.ro {
96109
cmd.arg("--bind-ro");
97110
cmd.arg(file);

0 commit comments

Comments
 (0)