forked from Shinonome/caelestia-cli
install: better dependency installation
Try not to use aur helper, also skip already installed packages
This commit is contained in:
+33
-23
@@ -17,32 +17,42 @@ function install-deps
|
|||||||
# All dependencies already installed
|
# All dependencies already installed
|
||||||
pacman -Q $argv &> /dev/null && return
|
pacman -Q $argv &> /dev/null && return
|
||||||
|
|
||||||
# Get AUR helper or install if none
|
for dep in $argv
|
||||||
which yay &> /dev/null && set -l helper yay || set -l helper paru
|
# Skip if already installed
|
||||||
if ! which $helper &> /dev/null
|
if ! pacman -Q $dep &> /dev/null
|
||||||
warn 'No AUR helper found'
|
# If pacman can install it, use it, otherwise use an AUR helper
|
||||||
read -l -p "input 'Install yay? [Y/n] ' -n" confirm
|
if pacman -Si $dep &> /dev/null
|
||||||
if test "$confirm" = 'n' -o "$confirm" = 'N'
|
log "Installing dependency '$dep'"
|
||||||
warn "Manually install yay or paru and try again."
|
sudo pacman -S --noconfirm $dep
|
||||||
warn "Alternatively, install the dependencies '$argv' manually and try again."
|
else
|
||||||
exit
|
# Get AUR helper or install if none
|
||||||
else
|
which yay &> /dev/null && set -l helper yay || set -l helper paru
|
||||||
sudo pacman -S --needed git base-devel
|
if ! which $helper &> /dev/null
|
||||||
git clone https://aur.archlinux.org/yay.git
|
warn 'No AUR helper found'
|
||||||
cd yay
|
read -l -p "input 'Install yay? [Y/n] ' -n" confirm
|
||||||
makepkg -si
|
if test "$confirm" = 'n' -o "$confirm" = 'N'
|
||||||
cd ..
|
warn "Manually install yay or paru and try again."
|
||||||
rm -rf yay
|
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
|
# First use, see https://github.com/Jguer/yay?tab=readme-ov-file#first-use
|
||||||
yay -Y --gendb
|
yay -Y --gendb
|
||||||
yay -Y --devel --save
|
yay -Y --devel --save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
log "Installing dependency '$dep'"
|
||||||
|
$helper -S --noconfirm $dep
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Install
|
|
||||||
log "Installing dependencies '$argv'"
|
|
||||||
$helper -S --needed --noconfirm $argv
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function install-optional-deps
|
function install-optional-deps
|
||||||
|
|||||||
Reference in New Issue
Block a user