Skip to content

Instantly share code, notes, and snippets.

@MggMuggins MggMuggins/yam.fish
Last active Aug 10, 2017

Embed
What would you like to do?
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
You can’t perform that action at this time.