Skip to content

Commit

Permalink
fix(aura): remove sudo check
Browse files Browse the repository at this point in the history
Fixes #943 #935
  • Loading branch information
fosskers committed Sep 29, 2024
1 parent 8557779 commit 12112e5
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 16 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Aura Changelog

## Unreleased

#### Fixed

- Removed the check for `sudo` as it is causing more problems than it sought to fix.

## 4.0.7 (2024-09-15)

Pacman 7 has been released. See [here][pac7] for more information.
Expand Down
4 changes: 0 additions & 4 deletions rust/aura-pm/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
use crate::localization::Localised;
use aura_core::aur::dependencies as deps;
use i18n_embed::fluent::FluentLanguageLoader;
use i18n_embed_fl::fl;
use log::error;

/// Error type for all issues that can occur in the Aura library or executable.
Expand All @@ -20,7 +19,6 @@ pub(crate) enum Error {
Check(crate::check::Error),
Stats(crate::stats::Error),
Deps(crate::deps::Error),
AuraRunWithSudo,
}

impl From<crate::deps::Error> for Error {
Expand Down Expand Up @@ -98,7 +96,6 @@ impl Nested for Error {
Error::Check(e) => e.nested(),
Error::Stats(e) => e.nested(),
Error::Deps(e) => e.nested(),
Error::AuraRunWithSudo => {}
}
}
}
Expand All @@ -117,7 +114,6 @@ impl Localised for Error {
Error::Check(e) => e.localise(fll),
Error::Stats(e) => e.localise(fll),
Error::Deps(e) => e.localise(fll),
Error::AuraRunWithSudo => fl!(fll, "err-sudo"),
}
}
}
Expand Down
7 changes: 0 additions & 7 deletions rust/aura-pm/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,6 @@ fn env(args: &Args) -> Result<Env, Error> {
fn work(args: Args, env: Env, fll: &FluentLanguageLoader) -> Result<(), Error> {
info!("Language: {}", fll.current_language().language.as_str());

// Running Aura with sudo is not supported as it conflicts with the `nobody`
// user's lack of a `$HOME`, which causes problems for certain build tools
// that assume they can write there.
if utils::is_sudo_user() {
return Err(Error::AuraRunWithSudo);
}

match args.subcmd {
// --- Pacman Commands --- //
SubCmd::Database(d) => pacman(&env, d.needs_sudo())?,
Expand Down
5 changes: 0 additions & 5 deletions rust/aura-pm/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,6 @@ pub(crate) fn is_root_user() -> bool {
matches!(karen::check(), RunningAs::Root)
}

/// Is Aura being run undo `sudo`? It shouldn't be!
pub(crate) fn is_sudo_user() -> bool {
matches!(karen::check(), RunningAs::Root) && std::env::var("SUDO_USER").is_ok()
}

/// An [`Iterator`] that knows if the current iteration step is the last one.
/// Utilizes [`Peekable`] under the hood, so note that this forces the iteration
/// of the next element.
Expand Down

0 comments on commit 12112e5

Please sign in to comment.