/ de-omarchy / bin / omarchy-pkg-add
swadhinbiswas Initial de-omarchy: Omarchy UI layer for Arch-based distros · 8/22/2026
9f393b2
25 lines · 607 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash

# omarchy:summary=Install Arch packages if they are missing
# omarchy:args=<packages...>
# omarchy:examples=omarchy pkg add jq ripgrep
# omarchy:requires-sudo=true

if omarchy-pkg-missing "$@"; then
  if (( EUID == 0 )); then
    pacman -S --noconfirm --needed "$@" || exit 1
  else
    sudo pacman -S --noconfirm --needed "$@" || exit 1
  fi
fi

for pkg in "$@"; do
  # Secondary check to handle states where pacman doesn't actually register an error
  if ! pacman -Q "$pkg" &>/dev/null; then
    echo -e "\033[31mError: Package '$pkg' did not install\033[0m" >&2
    exit 1
  fi
done

exit 0