Skip to content

Instantly share code, notes, and snippets.

@MggMuggins
Last active August 10, 2017 14:59
Show Gist options
  • Save MggMuggins/727ab93392dbd690c2b24f49d84398ca to your computer and use it in GitHub Desktop.
Save MggMuggins/727ab93392dbd690c2b24f49d84398ca to your computer and use it in GitHub Desktop.
My tool for installing packages from the AUR. Rename to "yam" and install in /usr/local/bin if you so desire for easy execution.
#!/usr/bin/fish
# Sources are placed in $HOME/.local/share/yam
# by default. I'll add better argument parsing
# and an option to change it later
set install false
set srcdir $HOME/.local/share/yam/
for arg in $argv
switch "$arg"
case "-i" "--install"
set install true
case "*"
set tarball_full "$arg"
end
end
echo $install
echo $tarball_full
if not test -f "$tarball_full"
echo "File does not exist"
exit 1
end
if not test -d "$srcdir"
mkdir "$srcdir"
end
set tarball (basename $tarball_full)
set filename (basename $tarball_full ".tar.gz")
echo $tarball
echo $filename
mv $tarball_full $srcdir
cd $srcdir
tar -xvf $tarball
rm $tarball
cd $filename
makepkg -s
if test $install = true
sudo pacman -U *.tar.xz
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment