sync/scripts/sync.sh

84 lines
3.3 KiB
Bash
Raw Normal View History

2016-07-18 16:55:56 -04:00
ABSPATH=$(\cd "$(dirname "$0")/.."; pwd)
2015-01-14 22:27:59 -05:00
echo $ABSPATH
2016-07-26 23:06:22 -04:00
while getopts ":shbc" 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"
2016-07-26 23:06:22 -04:00
echo " -s Use this if you don't want custom stonewareslord settings (use after -s)"
echo " -c Sync configuration files"
fi
if [ "$VALUE" = "s" ] ; then
sed -i'' -e '/email = stonewareslord@gmail.com/d' -e '/user = Austen Adler/d' -e '/\[user\]/d' -e '/signingkey = CCDFE3F1/d' ~/.gitconfig
fi
if [ "$VALUE" = "b" ] ; then
2015-01-03 00:34:38 -05:00
trash ~/.vimrc || rm ~/.vimrc
ln -s $ABSPATH/vim/vimrc ~/.vimrc
vim +"silent! call Initialize()" +q
fi
if [ "$VALUE" = "c" ] ; then
2015-03-01 22:20:58 -05:00
if [ "$2" = "-f" ] ; then
# Reinstall antigen
rm -rf ~/.antigen
fi
echo "Syncing config files"
2015-08-24 17:43:29 -04:00
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
2014-08-19 14:58:19 -04:00
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
2015-08-24 17:43:29 -04:00
if command -v git 2>&1 >/dev/null; then
if command -v zsh 2>&1 >/dev/null; then
ln -s $ABSPATH/shells/zshrc ~/.zshrc
2016-07-18 16:55:56 -04:00
for i in lpr oh-my-git-themes omg zsh-syntax-highlighting; do
if [ ! -d ~/.zsh-git/$i ]; then
git clone https://austenwares.com/gogs/stonewareslord/$i.git ~/.zsh-git/$i
else
\cd ~/.zsh-git/$i
git pull
\cd -
fi
done
fi
if [ ! -d ~/.fzf ] ; then
git clone https://austenwares.com/gogs/stonewareslord/fzf.git ~/.fzf
2016-07-18 16:55:56 -04:00
~/.fzf/install -y
fi
2015-08-24 17:43:29 -04:00
else
echo "No git! Not installing fzf or antigen"
fi
mkdir -p ~/.config
2015-01-05 12:44:00 -05:00
ln -s $ABSPATH/shells/liquidpromptrc ~/.config/liquidpromptrc
if [ "$(uname)" != "Darwin" ]; then
2015-08-24 17:43:29 -04:00
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
2015-01-15 12:42:10 -05:00
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
2015-01-15 12:42:10 -05:00
ln -s $ABSPATH/shells/Xresources ~/.Xresources
2016-07-26 23:06:22 -04:00
if command -v xrdb 2>&1 >/dev/null; then
xrdb ~/.Xresources
fi
fi
fi
done
echo "Done syncing"