public
Last active

Simple script to update vim-gtk package from Arch Linux Repository

  • Download Gist
vim-gtk-update.sh
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
#!/bin/sh
#
# vim-gtk updater
# Do What The Fuck You Want To Public License
#
# Worst piece of code what I ever wrote. Feel free to correct, fork, or ignore it.
# You can also shout at me, but I don't think that will help.
 
local=$(pacman -Q vim-gtk | sed 's/[^ ]* //')
topver=7.3
patchlevel=$(wget ftp://ftp.vim.org/pub/vim/patches/${topver}/ -q -O - | sed -n '/7.3./ s/.*7.3.\([0-9]\+\).*/\1/p' | tail -1)
pkgrel=$(wget -q -O - http://aur.archlinux.org/packages/vim-gtk/vim-gtk/PKGBUILD | grep pkgrel | sed -e "s/^.*\(.\)$/\1/")
current=${topver}.${patchlevel}-${pkgrel}
 
if [ $local = $current ]; then
echo "Your vim-gtk is up-to-date."
else
echo "Newest vim-gtk is $current. Update?"
read upd
if [ ${upd} = y ]; then
tempdir=$(mktemp -d)
cd $tempdir
wget http://aur.archlinux.org/packages/vim-gtk/vim-gtk/PKGBUILD
echo "Edit PKGBUILD?"
read editpkg
if [ ${editpkg} = y ]; then
if [ -z "$EDITOR" ]; then
echo "Variable \$EDITOR is empty. Skipping."
else
$EDITOR PKGBUILD
fi
fi
makepkg -si
rm -rf $tempdir
else
echo "Aborted."
fi
fi

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.