Skip to content

Instantly share code, notes, and snippets.

@ttonyh
Forked from macchaberrycream/install_yay.bash
Last active April 10, 2021 01:40
Show Gist options
  • Save ttonyh/644bd3d7ab982f00d53dce034ffce67f to your computer and use it in GitHub Desktop.
Save ttonyh/644bd3d7ab982f00d53dce034ffce67f to your computer and use it in GitHub Desktop.
[install yay shell script] #ArchLinux
#!/usr/bin/env bash
# Assume JQ is already installed
if ! builtin type -p 'yay' >/dev/null 2>&1; then
echo 'Install yay.'
TMPDIR="$(mktemp -d)"
cd "${TMPDIR}" || return 1
DLURL=$(curl https://api.github.com/repos/Jguer/yay/releases/latest | jq -r '.assets[] | select(.name|test(".*_x86_64.tar.gz")) | .browser_download_url')
# Download Binary
YAYTAR=./$(basename $DLURL)
YAYDIR=./$(basename -s .tar.gz $DLURL)
echo "$DLURL"
curl -fsSLO "$DLURL"
tar xzvf $YAYTAR
cd $YAYDIR || return 1
./yay -S --noconfirm yay-bin
cd ..
# Clean up
rm -rf $YAYDIR
rm -rf $TMPDIR
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment