mirror of
https://github.com/philmmanjaro/alma.git
synced 2025-07-25 14:39:29 +02:00
AUR fixes
The commit switches to using yay-bin instead of yay, avoiding the need to install Go. In addition, it fixes a bug where aur packages aren't build when specified only in the command line
This commit is contained in:
parent
fdbe285855
commit
38d0085ba1
@ -3,6 +3,7 @@ use std::str::FromStr;
|
||||
|
||||
pub struct AurHelper {
|
||||
pub name: String,
|
||||
pub package_name: String,
|
||||
pub install_command: Vec<String>,
|
||||
}
|
||||
|
||||
@ -13,6 +14,7 @@ impl FromStr for AurHelper {
|
||||
match s {
|
||||
"yay" => Ok(AurHelper {
|
||||
name: String::from("yay"),
|
||||
package_name: String::from("yay-bin"),
|
||||
install_command: vec![
|
||||
String::from("yay"),
|
||||
String::from("-S"),
|
||||
|
@ -10,4 +10,4 @@ SystemMaxUse=16M
|
||||
pub const BASE_PACKAGES: [&str; 1] = ["base"];
|
||||
|
||||
// we add go so that it is cached when installing yay
|
||||
pub const AUR_DEPENDENCIES: [&str; 4] = ["base-devel", "git", "sudo", "go"];
|
||||
pub const AUR_DEPENDENCIES: [&str; 3] = ["base-devel", "git", "sudo"];
|
||||
|
33
src/main.rs
33
src/main.rs
@ -225,7 +225,8 @@ fn create(command: args::CreateCommand) -> anyhow::Result<()> {
|
||||
|
||||
packages.extend(presets.packages);
|
||||
|
||||
if !presets.aur_packages.is_empty() {
|
||||
let use_aur = !(presets.aur_packages.is_empty() && command.aur_packages.is_empty());
|
||||
if use_aur {
|
||||
packages.extend(constants::AUR_DEPENDENCIES.iter().map(|s| String::from(*s)));
|
||||
}
|
||||
|
||||
@ -276,7 +277,9 @@ fn create(command: args::CreateCommand) -> anyhow::Result<()> {
|
||||
.run()
|
||||
.context("locale-gen failed")?;
|
||||
|
||||
if !presets.aur_packages.is_empty() {
|
||||
if use_aur {
|
||||
info!("Installing AUR packages");
|
||||
|
||||
arch_chroot
|
||||
.execute()
|
||||
.arg(mount_point.path())
|
||||
@ -284,16 +287,8 @@ fn create(command: args::CreateCommand) -> anyhow::Result<()> {
|
||||
.run()
|
||||
.context("Failed to create temporary user to install AUR packages")?;
|
||||
|
||||
arch_chroot
|
||||
.execute()
|
||||
.arg(mount_point.path())
|
||||
.args(&[
|
||||
"sed",
|
||||
"-i",
|
||||
"s/# %wheel ALL=(ALL) NOPASSWD: ALL/aur ALL=(ALL) NOPASSWD: ALL/g",
|
||||
])
|
||||
.arg("/etc/sudoers")
|
||||
.run()
|
||||
let aur_sudoers = mount_point.path().join("etc/sudoers.d/aur");
|
||||
fs::write(&aur_sudoers, "aur ALL=(ALL) NOPASSWD: ALL")
|
||||
.context("Failed to modify sudoers file for AUR packages")?;
|
||||
|
||||
arch_chroot
|
||||
@ -304,7 +299,7 @@ fn create(command: args::CreateCommand) -> anyhow::Result<()> {
|
||||
.arg("clone")
|
||||
.arg(format!(
|
||||
"https://aur.archlinux.org/{}.git",
|
||||
&command.aur_helper.name
|
||||
&command.aur_helper.package_name
|
||||
))
|
||||
.arg(format!("/home/aur/{}", &command.aur_helper.name))
|
||||
.run()
|
||||
@ -342,17 +337,7 @@ fn create(command: args::CreateCommand) -> anyhow::Result<()> {
|
||||
.run()
|
||||
.context("Failed to delete temporary aur user")?;
|
||||
|
||||
arch_chroot
|
||||
.execute()
|
||||
.arg(mount_point.path())
|
||||
.args(&[
|
||||
"sed",
|
||||
"-i",
|
||||
"s/aur ALL=(ALL) NOPASSWD: ALL/# %wheel ALL=(ALL) NOPASSWD: ALL/g",
|
||||
])
|
||||
.arg("/etc/sudoers")
|
||||
.run()
|
||||
.context("Failed to undo sudoers changes")?;
|
||||
fs::remove_file(&aur_sudoers).context("Cannot delete the AUR sudoers temporary file")?;
|
||||
}
|
||||
if !presets.scripts.is_empty() {
|
||||
info!("Running custom scripts");
|
||||
|
Loading…
x
Reference in New Issue
Block a user