Skip to content
This repository has been archived by the owner on Feb 27, 2022. It is now read-only.

Commit

Permalink
a nice installer
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Nov 2, 2010
1 parent e16b477 commit d6cf8b5
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
all:install

install:
./install.sh
31 changes: 31 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

fail () {
echo "$@" >&2
exit 1
}
SCRIPT=$0
SCRIPTDIR=$(dirname -- "$SCRIPT")
for i in $HOME/.{g,}vim{rc,rc.local}; do
if [ -f "$i" ] || [ -d "$i" ]; then
echo "backing up $i to $i.bak"
mv $i{,.bak} || fail "failed backup"
fi
done
if ! [ "$SCRIPTDIR" == "$HOME/.vim" ]; then
if [ -d "$HOME/.vim" ]; then
mv -- "$HOME/.vim"{,.bak}
fi
echo "copying to $HOME/.vim"
cp -r -- $SCRIPTDIR $HOME/.vim || fail "failed copy"
cd $HOME/.vim
$HOME/.vim/install.sh || fail "failed install"
exit $?
fi

cd $HOME
ln -s .vim/vimrc .vimrc || fail ".vimrc"
ln -s .vim/vimrc.local .vimrc.local || fail ".vimrc.local"
ln -s .vim/gvimrc .gvimrc || fail ".gvimrc"
ln -s .vim/gvimrc.local .gvimrc.local || fail ".gvimrc.local"

0 comments on commit d6cf8b5

Please sign in to comment.