Skip to content

Commit

Permalink
fix: check for built binary before attempting pacman -U
Browse files Browse the repository at this point in the history
  • Loading branch information
gamemaker1 committed Jun 16, 2021
1 parent b4d377a commit 9359778
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions source/yeet
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
unalias -a
# Fail and exit when the first error occurs
set -e
# Enable globs
shopt -s nullglob
# For debbuging
#set -xv
# package-query colors
Expand Down Expand Up @@ -311,9 +313,17 @@ function install_packages {
else
# If not, install it with pacman -U and exit
cd "$package"
require_root $PACMAN_BIN -U *.pkg.tar.zst
printg "==> Installed $package successfully"
return $?
# Check if there is a .pkg.tar.zst file
if [[ -n $(echo *.pkg.tar.zst) ]]; then
# If there is, install it
require_root $PACMAN_BIN -U *.pkg.tar.zst
printg "==> Installed $package successfully"
return
else
# Else error out
printr "ERR Could not find prebuilt package! Try rebuilding the package."
return 1
fi
fi
else
# If it is not already built, clone it
Expand Down Expand Up @@ -396,9 +406,19 @@ function build_packages {
printb "==> Installing..."

# Install the package using pacman
require_root $PACMAN_BIN -U *.pkg.tar.zst

printg "==> Package installed successfully!"
# Check if there is a .pkg.tar.zst file
if [[ -n $(echo *.pkg.tar.zst) ]]; then
# If there is, install it
require_root $PACMAN_BIN -U *.pkg.tar.zst
printg "==> Package installed successfully!"
return
else
# Else attempt to rebuild and directly install it
printr "ERR Could not find prebuilt package! Attempting to rebuild package..."
makepkg -sfCci
printg "==> Package installed successfully!"
return
fi
else
printw "==> Package built; but not installed. Run \`yeet -B $1\` again if you want to install the package."
fi
Expand Down

0 comments on commit 9359778

Please sign in to comment.