diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-01-28 18:06:56 +1100 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-01-28 18:06:56 +1100 |
| commit | 303a33797992c93fe4f6e17481670e06ef84a4e7 (patch) | |
| tree | 04f0f8a73459024ea3cb3221e157fb1afd16f7ef /install | |
| parent | install: fix dependency installation (diff) | |
| download | caelestia-cli-303a33797992c93fe4f6e17481670e06ef84a4e7.tar.gz caelestia-cli-303a33797992c93fe4f6e17481670e06ef84a4e7.tar.bz2 caelestia-cli-303a33797992c93fe4f6e17481670e06ef84a4e7.zip | |
install: better dependency installation
Try not to use aur helper, also skip already installed packages
Diffstat (limited to 'install')
| -rw-r--r-- | install/util.fish | 56 |
1 files changed, 33 insertions, 23 deletions
diff --git a/install/util.fish b/install/util.fish index 140a586..8742db4 100644 --- a/install/util.fish +++ b/install/util.fish @@ -17,32 +17,42 @@ function install-deps # All dependencies already installed pacman -Q $argv &> /dev/null && return - # Get AUR helper or install if none - which yay &> /dev/null && set -l helper yay || set -l helper paru - if ! which $helper &> /dev/null - warn 'No AUR helper found' - read -l -p "input 'Install yay? [Y/n] ' -n" confirm - if test "$confirm" = 'n' -o "$confirm" = 'N' - warn "Manually install yay or paru and try again." - warn "Alternatively, install the dependencies '$argv' manually and try again." - exit - else - sudo pacman -S --needed git base-devel - git clone https://aur.archlinux.org/yay.git - cd yay - makepkg -si - cd .. - rm -rf yay + for dep in $argv + # Skip if already installed + if ! pacman -Q $dep &> /dev/null + # If pacman can install it, use it, otherwise use an AUR helper + if pacman -Si $dep &> /dev/null + log "Installing dependency '$dep'" + sudo pacman -S --noconfirm $dep + else + # Get AUR helper or install if none + which yay &> /dev/null && set -l helper yay || set -l helper paru + if ! which $helper &> /dev/null + warn 'No AUR helper found' + read -l -p "input 'Install yay? [Y/n] ' -n" confirm + if test "$confirm" = 'n' -o "$confirm" = 'N' + warn "Manually install yay or paru and try again." + warn "Alternatively, install the dependencies '$argv' manually and try again." + exit + else + sudo pacman -S --needed git base-devel + git clone https://aur.archlinux.org/yay.git + cd yay + makepkg -si + cd .. + rm -rf yay + + # First use, see https://github.com/Jguer/yay?tab=readme-ov-file#first-use + yay -Y --gendb + yay -Y --devel --save + end + end - # First use, see https://github.com/Jguer/yay?tab=readme-ov-file#first-use - yay -Y --gendb - yay -Y --devel --save + log "Installing dependency '$dep'" + $helper -S --noconfirm $dep + end end end - - # Install - log "Installing dependencies '$argv'" - $helper -S --needed --noconfirm $argv end function install-optional-deps |