From 7099439e0e2dd8e1f9be358b61703862c425fb95 Mon Sep 17 00:00:00 2001 From: Aminda Suomalainen Date: Thu, 15 Aug 2024 12:17:42 +0300 Subject: [PATCH] usr-local-bin/pacman: initial commit made on Fedora instead of actual Arch, so let's see if this will work --- bash/usr-local-bin/.gitignore | 1 + bash/usr-local-bin/pacman | 25 +++++++++++++++++++++++++ bash/usr-local-bin/yay | 1 + 3 files changed, 27 insertions(+) create mode 100755 bash/usr-local-bin/pacman create mode 120000 bash/usr-local-bin/yay diff --git a/bash/usr-local-bin/.gitignore b/bash/usr-local-bin/.gitignore index 5f9ee34..e2f7549 100644 --- a/bash/usr-local-bin/.gitignore +++ b/bash/usr-local-bin/.gitignore @@ -9,3 +9,4 @@ ff chrome iwd-wifi.bash vim +yay diff --git a/bash/usr-local-bin/pacman b/bash/usr-local-bin/pacman new file mode 100755 index 0000000..097fba8 --- /dev/null +++ b/bash/usr-local-bin/pacman @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +set -x + +export LC_ALL=en_DK.UTF-8 + +# if yay is installed and we aren't root, run it instead +if [[ -f /usr/bin/yay && $(id -u) != 0 ]]; then + if [[ "$1" == "-S" ]]; then + /usr/bin/yay --needed "$*" + else + /usr/bin/yay "$*" + fi +# otherwise attempt to run pacman, but keep the --needed for installs +elif [[ -f /usr/bin/pacman ]]; then + if [[ "$1" == "-S" ]]; then + /usr/bin/pacman --needed "$*" + else + /usr/bin/pacman "$*" + fi +# otherwise fail gracefully +else + printf "Neither yay or pacman was found.\n" + exit 1 +fi +set +x diff --git a/bash/usr-local-bin/yay b/bash/usr-local-bin/yay new file mode 120000 index 0000000..2b3565b --- /dev/null +++ b/bash/usr-local-bin/yay @@ -0,0 +1 @@ +pacman \ No newline at end of file