ABSPATH=$(cd "$(dirname "$0")/.."; pwd) echo $ABSPATH while getopts ":hbsdpcw" 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 " -p Syncs computer with pip applications in pip.txt" echo " -c Syncs other configuration files" echo " -w Installs wemux [requires vim]" fi if [ "$VALUE" = "b" ] ; then trash ~/.vimrc || rm ~/.vimrc ln -s $ABSPATH/vim/vimrc ~/.vimrc vim +"silent! call Initialize()" +q fi if [ "$VALUE" = "s" ] ; then if [ "$(uname)" != "Darwin" ]; then echo "Installing server applications:" echo $(grep -vE "^\s*#" $ABSPATH/scripts/server.txt | tr "\n" " ") sudo apt-get install $(grep -vE "^\s*#" $ABSPATH/scripts/server.txt | tr "\n" " ") else if [ -d "/usr/local/Library/Taps/phinze/homebrew-cask" ] ; then brew install caskroom/cask/brew-cask brew cask fi brew cask install gimp inkscape adium vlc iterm2 steam adobe-reader spectacle xquartz fi fi if [ "$VALUE" = "d" ] ; then echo "Installing desktop applications" if [ "$(uname)" != "Darwin" ]; then echo $(grep -vE "^\s*#" $ABSPATH/scripts/server.txt | tr "\n" " ") $(grep -vE "^\s*#" $ABSPATH/scripts/desktop.txt | tr "\n" " ") sudo apt-get install $(grep -vE "^\s*#" $ABSPATH/scripts/server.txt | tr "\n" " ") $(grep -vE "^\s*#" $ABSPATH/scripts/desktop.txt | tr "\n" " ") else brew install macvim --with-cscope --with-lua --HEAD brew install vim --with-lua brew install ncdu htop youtube-dl tree sshfs ircii imagemagick node ffmpeg wget lua libconfig readline meld fi fi if [ "$VALUE" = "p" ] ; then echo "Installing pip applications" echo $(grep -vE "^\s*#" $ABSPATH/scripts/pip.txt | tr "\n" " ") sudo pip install $(grep -vE "^\s*#" $ABSPATH/scripts/pip.txt | tr "\n" " ") fi if [ "$VALUE" = "c" ] ; then if [ "$2" = "-f" ] ; then # Reinstall antigen rm -rf ~/.antigen fi echo "Syncing config files" if command -v trash 2>&1 /dev/null; then trash ~/.gitconfig ~/.vimperatorrc ~/.vimperator/colors/vimPgray.vimp ~/.bashrc ~/.pylintrc ~/.zsh ~/.zshrc ~/.tmux.conf ~/.config/liquidpromptrc else rm ~/.gitconfig ~/.vimperatorrc ~/.vimperator/colors/vimPgray.vimp ~/.bashrc ~/.pylintrc ~/.zsh ~/.zshrc ~/.tmux.conf ~/.config/liquidpromptrc fi # Install on all systems ln -s $ABSPATH/tmux/tmux.conf ~/.tmux.conf ln -s $ABSPATH/python/pylintrc ~/.pylintrc ln -s $ABSPATH/vimperator/vimperatorrc ~/.vimperatorrc mkdir -p ~/.vimperator/colors ln -s $ABSPATH/vimperator/vimPgray.vimp ~/.vimperator/colors/vimPgray.vimp ln -s $ABSPATH/git/gitconfig ~/.gitconfig ln -s $ABSPATH/shells/bashrc ~/.bashrc ln -s $ABSPATH/zsh ~/.zsh if command -v git 2>&1 >/dev/null; then if command -v zsh 2>&1 >/dev/null; then ln -s $ABSPATH/shells/zshrc ~/.zshrc if [ ! -d ~/.antigen ] ; then git clone https://github.com/zsh-users/antigen ~/.antigen fi # Install antigen bundles zsh -c "source ~/.zshrc;exit" fi if [ ! -d ~/.fzf ] ; then git clone https://github.com/stonewareslord/fzf.git ~/.fzf else \cd ~/.fzf git pull origin master \cd - fi ~/.fzf/install -y else echo "No git! Not installing fzf or antigen" fi mkdir -p ~/.config ln -s $ABSPATH/shells/liquidpromptrc ~/.config/liquidpromptrc if [ "$(uname)" != "Darwin" ]; then if command -v trash 2>&1 >/dev/null; then trash ~/.i3/{config,i3status.conf,run.sh} ~/.Xmodmap ~/.xsession ~/.config/synapse/gtkrc ~/.Xresources else rm ~/.i3/{config,i3status.conf,run.sh} ~/.Xmodmap ~/.xsession ~/.config/synapse/gtkrc ~/.Xresources fi # Don't install these on Mac mkdir -p ~/.i3 ln -s $ABSPATH/i3/config ~/.i3/config ln -s $ABSPATH/i3/$(hostname)-status.conf ~/.i3/i3status.conf 2>/dev/null ln -s $ABSPATH/i3/run.sh ~/.i3/run.sh ln -s $ABSPATH/i3/Xmodmap ~/.Xmodmap ln -s $ABSPATH/i3/xsession ~/.xsession mkdir -p ~/.config/synapse ln -s $ABSPATH/i3/gtkrc ~/.config/synapse/gtkrc ln -s $ABSPATH/shells/Xresources ~/.Xresources xrdb ~/.Xresources fi fi if [ "$VALUE" = "w" ] ; then echo "Installing wemux..." sudo git clone git://github.com/zolrath/wemux.git /usr/local/share/wemux sudo rm -r /usr/local/bin/wemux sudo rm -r /usr/local/etc/wemux.conf 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 vim `which wemux` +"execute \"normal gg/tmux\nnnea -2\nea -2\ggZZ\"" sudo vim /usr/local/etc/wemux.conf +":execute \"normal gg/host_list\nnww\"" fi done echo "Done syncing"