diff --git a/src/internal/structs.rs b/src/internal/structs.rs index 7fd8007..39b3729 100644 --- a/src/internal/structs.rs +++ b/src/internal/structs.rs @@ -20,4 +20,5 @@ pub struct Options { pub verbosity: i32, pub noconfirm: bool, pub asdeps: bool, + pub skippgp: bool, } diff --git a/src/main.rs b/src/main.rs index 10870db..86f7f6e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -39,6 +39,12 @@ fn main() { .set(ArgSettings::Global) .help("Complete operation without prompting user"), ) + .arg( + Arg::with_name("skippgp") + .long("skippgp") + .set(ArgSettings::Global) + .help("Ignore checking PGP signatures in PKGBUILDs"), + ) .subcommand( SubCommand::with_name("install") .about( @@ -133,11 +139,13 @@ fn main() { let verbosity: i32 = matches.occurrences_of("verbose") as i32; let noconfirm: bool = matches.is_present("noconfirm"); + let skippgp: bool = matches.is_present("skippgp"); let options = Options { verbosity, noconfirm, asdeps: false, + skippgp, }; init(options); diff --git a/src/operations/aur_install.rs b/src/operations/aur_install.rs index b040bc9..86d4de2 100644 --- a/src/operations/aur_install.rs +++ b/src/operations/aur_install.rs @@ -1,8 +1,8 @@ -use std::env; use std::env::set_current_dir; use std::fs::remove_dir_all; use std::path::Path; use std::process::{Command, Stdio}; +use std::{env, fs}; use crate::internal::rpc::rpcinfo; use crate::internal::{crash, prompt}; @@ -13,6 +13,7 @@ pub fn aur_install(a: Vec, options: Options) { let cachedir = format!("{}/.cache/ame/", env::var("HOME").unwrap()); let verbosity = options.verbosity; let noconfirm = options.noconfirm; + let skippgp = options.skippgp; if verbosity >= 1 { log(format!("Installing from AUR: {:?}", &a)); @@ -40,7 +41,7 @@ pub fn aur_install(a: Vec, options: Options) { .arg("clone") .arg(format!("{}/{}", url, pkg)) .stdout(Stdio::null()) - .status() + .output() .expect("Something has gone wrong"); if verbosity >= 1 { @@ -82,6 +83,7 @@ pub fn aur_install(a: Vec, options: Options) { verbosity, noconfirm, asdeps: true, + skippgp, }; if !sorted.nf.is_empty() || !md_sorted.nf.is_empty() { @@ -111,6 +113,7 @@ pub fn aur_install(a: Vec, options: Options) { .unwrap(); let p2 = prompt(format!("Would you still like to install {}?", pkg), true); if !p2 { + fs::remove_dir_all(format!("{}/{}", cachedir, pkg)).unwrap(); crash("Not proceeding".to_string(), 6); } } @@ -134,6 +137,9 @@ pub fn aur_install(a: Vec, options: Options) { if options.noconfirm { makepkg_args.push("--noconfirm") } + if options.skippgp { + makepkg_args.push("--skippgp") + } // package building and installing info("Building time!".to_string()); @@ -144,6 +150,7 @@ pub fn aur_install(a: Vec, options: Options) { .expect("Something has gone wrong"); if out.code() != Some(0) { + fs::remove_dir_all(format!("{}/{}", cachedir, pkg)).unwrap(); crash( format!("Error encountered while installing {}, aborting", pkg), 7, diff --git a/src/operations/search.rs b/src/operations/search.rs index 08d5006..2056f67 100644 --- a/src/operations/search.rs +++ b/src/operations/search.rs @@ -30,7 +30,7 @@ pub fn repo_search(a: &str, options: Options) { let verbosity = options.verbosity; let rs = Command::new("pacman") .arg("-Ss") - .arg(format!("^{}$", &a)) + .arg(&a) .output() .expect("Something has gone wrong");