mirror of
https://github.com/philmmanjaro/alma.git
synced 2025-07-24 05:59:28 +02:00
Add pacman_conf argument for alma create. (#68)
This commit is contained in:
parent
0680de7c42
commit
a6984b0b84
@ -38,6 +38,12 @@ pub struct CreateCommand {
|
||||
#[structopt(parse(from_os_str))]
|
||||
pub path: Option<PathBuf>,
|
||||
|
||||
/// Path to a pacman.conf file which will be used to pacstrap packages into the image.
|
||||
///
|
||||
/// This pacman.conf will also be copied into the resulting Arch Linux image.
|
||||
#[structopt(short = "c", long = "pacman-conf", value_name = "pacman_conf")]
|
||||
pub pacman_conf: Option<PathBuf>,
|
||||
|
||||
/// Additional packages to install
|
||||
#[structopt(short = "p", long = "extra-packages", value_name = "package")]
|
||||
pub extra_packages: Vec<String>,
|
||||
|
10
src/main.rs
10
src/main.rs
@ -234,9 +234,15 @@ fn create(command: args::CreateCommand) -> anyhow::Result<()> {
|
||||
|
||||
packages.extend(constants::AUR_DEPENDENCIES.iter().map(|s| String::from(*s)));
|
||||
|
||||
let pacman_conf_path = command
|
||||
.pacman_conf
|
||||
.unwrap_or_else(|| "/etc/pacman.conf".into());
|
||||
|
||||
info!("Bootstrapping system");
|
||||
pacstrap
|
||||
.execute()
|
||||
.arg("-C")
|
||||
.arg(&pacman_conf_path)
|
||||
.arg("-c")
|
||||
.arg(mount_point.path())
|
||||
.args(packages)
|
||||
@ -244,6 +250,10 @@ fn create(command: args::CreateCommand) -> anyhow::Result<()> {
|
||||
.run()
|
||||
.context("Pacstrap error")?;
|
||||
|
||||
// Copy pacman.conf to the image.
|
||||
fs::copy(pacman_conf_path, mount_point.path().join("etc/pacman.conf"))
|
||||
.context("Failed copying pacman.conf")?;
|
||||
|
||||
let fstab = fix_fstab(
|
||||
&genfstab
|
||||
.execute()
|
||||
|
Loading…
x
Reference in New Issue
Block a user