Create a gist now

Instantly share code, notes, and snippets.

Simple script to update vim-gtk package from Arch Linux Repository
#!/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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment