2014-06-22 23:14:05 -04:00
|
|
|
while getopts ":hbsdtc" VALUE "$@"; do
|
|
|
|
if [ "$VALUE" = "h" ] ; then
|
|
|
|
echo "sync.sh syncs configuration files, applications, and Vim bundles between computers"
|
|
|
|
echo " -h Shows this help"
|
|
|
|
echo " -b Syncs Vim bundles"
|
|
|
|
echo " -s Syncs computer with server applications in server.txt"
|
|
|
|
echo " -d Syncs computer with desktop applications in desktop.txt"
|
|
|
|
echo " -t Syncs tmux configuration file"
|
|
|
|
echo " -c Syncs other configuration files"
|
|
|
|
fi
|
2014-06-16 23:13:57 -04:00
|
|
|
if [ "$VALUE" = "b" ] ; then
|
|
|
|
mkdir -p ~/.vim/plugin/
|
|
|
|
mkdir -p ~/.vim/backup/
|
|
|
|
mkdir -p ~/.vim/undo/
|
|
|
|
mkdir -p ~/.vim/tmp/
|
|
|
|
mkdir -p ~/.vim/bundle/
|
|
|
|
mkdir -p ~/.vim/bundle/
|
|
|
|
echo "Installing vim bundles"
|
|
|
|
if [ ! -f ~/.vim/plugin/sessionman.vim ]
|
|
|
|
then
|
|
|
|
echo "Installing sessionman in ~/.vim/plugin/"
|
|
|
|
wget -O ~/.vim/plugin/sessionman.vim http://www.vim.org/scripts/download_script.php?src_id=15599
|
|
|
|
fi
|
|
|
|
if [ ! -d ~/.vim/bundle/vundle/ ]
|
|
|
|
then
|
|
|
|
echo "Installing vundle"
|
|
|
|
git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
|
|
|
|
fi
|
|
|
|
vim +BundleInstall +qa
|
|
|
|
fi
|
|
|
|
if [ "$VALUE" = "s" ] ; then
|
|
|
|
echo "Installing server applications:"
|
|
|
|
echo $(grep -vE "^\s*#" server.txt | tr "\n" " ")
|
2014-06-23 00:09:29 -04:00
|
|
|
sudo apt-get install $(grep -vE "^\s*#" server.txt | tr "\n" " ")
|
2014-06-16 23:13:57 -04:00
|
|
|
fi
|
|
|
|
if [ "$VALUE" = "d" ] ; then
|
|
|
|
echo "Installing desktop applications"
|
2014-07-07 03:20:57 -04:00
|
|
|
if [ "$(uname)" != "Darwin" ]; then
|
|
|
|
echo $(grep -vE "^\s*#" desktop.txt | tr "\n" " ")
|
|
|
|
sudo apt-get install $(grep -vE "^\s*#" desktop.txt | tr "\n" " ")
|
|
|
|
else
|
|
|
|
brew install autojump ncdu htop vim youtube-dl tree sshfs ircii
|
|
|
|
fi
|
2014-06-16 23:13:57 -04:00
|
|
|
fi
|
|
|
|
if [ "$VALUE" = "t" ] ; then
|
|
|
|
echo "Syncing tmux"
|
2014-06-16 23:33:58 -04:00
|
|
|
rm ~/.tmux.conf
|
2014-06-16 23:13:57 -04:00
|
|
|
ln -s ${PWD}/tmux.conf ~/.tmux.conf
|
|
|
|
fi
|
2014-06-16 23:33:58 -04:00
|
|
|
if [ "$VALUE" = "c" ] ; then
|
|
|
|
echo "Syncing config files"
|
|
|
|
rm ~/.gitconfig ~/.vimrc ~/.vimperatorrc ~/.gitignore_global ~/.bashrc
|
|
|
|
ln -s ${PWD}/gitignore_global ~/.gitignore_global
|
|
|
|
ln -s ${PWD}/vimrc ~/.vimrc
|
|
|
|
ln -s ${PWD}/vimperatorrc ~/.vimperatorrc
|
|
|
|
ln -s ${PWD}/gitconfig ~/.gitconfig
|
|
|
|
ln -s ${PWD}/bashrc ~/.bashrc
|
2014-06-16 23:13:57 -04:00
|
|
|
fi
|
2014-06-13 14:27:12 -04:00
|
|
|
done
|
|
|
|
echo "Done syncing"
|