Last active
August 10, 2017 14:59
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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