sync/scripts/sync.sh

103 lines
4.2 KiB
Bash
Raw Normal View History

while getopts ":hbsdtclw" 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
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 +BundleClean +BundleInstall +qa
fi
if [ "$VALUE" = "s" ] ; then
if [ "$(uname)" != "Darwin" ]; then
echo "Installing server applications:"
echo $(grep -vE "^\s*#" server.txt | tr "\n" " ")
sudo apt-get install $(grep -vE "^\s*#" server.txt | tr "\n" " ")
else
if [ -d "/usr/local/Library/Taps/phinze/homebrew-cask" ] ; then
brew tap phinze/cask
2014-07-07 18:50:37 -04:00
brew install brew-cask
brew cask
fi
brew cask install textexpander controlplane gimp inkscape adium vlc iterm2 steam
fi
fi
if [ "$VALUE" = "d" ] ; then
echo "Installing desktop applications"
if [ "$(uname)" != "Darwin" ]; then
echo $(grep -vE "^\s*#" server.txt | tr "\n" " ") $(grep -vE "^\s*#" desktop.txt | tr "\n" " ")
sudo apt-get install $(grep -vE "^\s*#" server.txt | tr "\n" " ") $(grep -vE "^\s*#" desktop.txt | tr "\n" " ")
else
2014-08-06 01:13:59 -04:00
brew install autojump ncdu htop vim youtube-dl tree sshfs ircii imagemagick node ffmpeg wget lua libconfig readline meld
fi
fi
if [ "$VALUE" = "t" ] ; then
echo "Syncing tmux"
rm ~/.tmux.conf
2014-08-19 14:51:27 -04:00
ln -s ${PWD}../tmux/tmux.conf ~/.tmux.conf
fi
if [ "$VALUE" = "c" ] ; then
echo "Syncing config files"
if which trash >/dev/null; then
2014-08-19 15:34:09 -04:00
trash ~/.gitconfig ~/.vimrc ~/.vimperatorrc ~/.vimperator/colors/vimPgray.vimp ~/.vimperator/info/sync/quickmarks ~/.bashrc ~/.pylintrc ~/.zshrc ~/.i3/config ~/.i3/sleep.sh ~/.Xmodmap ~/.xsession
else
2014-08-19 15:34:09 -04:00
rm ~/.gitconfig ~/.vimrc ~/.vimperatorrc ~/.vimperator/colors/vimPgray.vimp ~/.vimperator/info/sync/quickmarks ~/.bashrc ~/.pylintrc ~/.zshrc ~/.i3/config ~/.i3/sleep.sh ~/.Xmodmap ~/.xsession
fi
2014-08-19 14:51:27 -04:00
ln -s ${PWD}/../python/pylintrc ~/.pylintrc
ln -s ${PWD}/../vim/vimrc ~/.vimrc
ln -s ${PWD}/../vimperator/vimperatorrc ~/.vimperatorrc
2014-08-19 14:58:19 -04:00
mkdir -p ~/.vimperator/colors
ln -s ${PWD}/../vimperator/vimPgray.vimp ~/.vimperator/colors/vimPgray.vimp
mkdir -p ~/.vimperator/info/sync/quickmarks
ln -s ${PWD}/../vimperator/quickmarks ~/.vimperator/info/sync/quickmarks
2014-08-19 14:51:27 -04:00
ln -s ${PWD}/../git/gitconfig ~/.gitconfig
ln -s ${PWD}/../shells/bashrc ~/.bashrc
ln -s ${PWD}/../shells/zshrc ~/.zshrc
2014-08-11 15:16:00 -04:00
mkdir -p ~/.i3
2014-08-19 14:51:27 -04:00
ln -s ${PWD}/../i3/i3config ~/.i3/config
2014-08-19 14:58:19 -04:00
ln -s ${PWD}/../i3/sleep.sh ~/.i3/sleep.sh
2014-08-19 15:34:09 -04:00
ln -s ${PWD}/../i3/Xmodmap ~/.Xmodmap
ln -s ${PWD}/../i3/xsession ~/.xsession
fi
if [ "$VALUE" = "l" ] ; then
echo "Linking standard directories..."
mkdir -p ~/Applications
ln -s ~/Applications ~/applications
ln -s ~/Desktop ~/desktop
ln -s ~/Documents ~/documents
ln -s ~/Downloads ~/downloads
ln -s ~/Music ~/music
ln -s ~/Pictures ~/pictures
ln -s ~/Videos ~/videos
echo "Done"
fi
if [ "$VALUE" = "w" ] ; then
sudo git clone git://github.com/zolrath/wemux.git /usr/local/share/wemux
sudo ln -s /usr/local/share/wemux/wemux /usr/local/bin/wemux
sudo cp /usr/local/share/wemux/wemux.conf.example /usr/local/etc/wemux.conf
sudo vi `which wemux` +"execute \"normal gg/tmux\<CR>nnnea -2\<Esc>nea -2\<Esc>ggZZ\""
sudo vi /usr/local/etc/wemux.conf +":execute \"normal gg/host_list\<CR>nnww\""
fi
done
echo "Done syncing"