#!/usr/bin/env bash
# $Id$
# Installer for default configurations

FILES=$(find . -type f ! -name 'install.sh' | grep -v .svn)

mkdir -p ${HOME}/.vim/{macros,plugin,tmp,templates}
mkdir -p ${HOME}/.subversion
mkdir -p ${HOME}/.gnupg
mkdir -p ${HOME}/.bazaar/plugins

mkdir -p ${HOME}/backuprc/vim/{macros,plugin,tmp,templates}
mkdir -p ${HOME}/backuprc/gnupg
mkdir -p ${HOME}/backuprc/subversion
mkdir -p ${HOME}/backuprc/bazaar/plugins

cp ${0} ${HOME}/backuprc

for each in ${FILES}
do
    TARGET=${each/.\//.}
    if [ -f ${HOME}/${TARGET} ]
    then
	cp ${HOME}/${TARGET} ${HOME}/backuprc/${TARGET/./}
    fi
    cp ${each} ${HOME}/${TARGET}
done

echo "New rc files installed. Old files are located in ${HOME}/backuprc."
echo "You can restore your old rc files by running ${0} in ${HOME}/backuprc."

# installer.sh
# vim:syntax=sh
# vim:sw=4:softtabstop=4:expandtab
