sync/scripts/sync.sh
2017-11-19 23:14:12 -05:00

85 lines
3.3 KiB
Bash
Executable File

ABSPATH=$(\cd "$(dirname "$0")/.."; pwd)
echo $ABSPATH
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"
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
trash ~/.vimrc || rm ~/.vimrc
ln -s $ABSPATH/vim/vimrc ~/.vimrc
vim +"silent! call Initialize()" +q
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 ~/.config/dunstrc
else
rm ~/.gitconfig ~/.vimperatorrc ~/.vimperator/colors/vimPgray.vimp ~/.bashrc ~/.pylintrc ~/.zsh ~/.zshrc ~/.tmux.conf ~/.config/liquidpromptrc ~/.config/dunstrc
fi
# Install on all systems
ln -s $ABSPATH/dunst/dunstrc ~/.config/dunstrc
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
for i in lpr oh-my-git-themes omg zsh-syntax-highlighting; do
if [ ! -d ~/.zsh-git/$i ]; then
git clone https://austenwares.com/gitea/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/gitea/stonewareslord/fzf.git ~/.fzf
~/.fzf/install -y
fi
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
if command -v xrdb 2>&1 >/dev/null; then
xrdb ~/.Xresources
fi
fi
fi
done
echo "Done syncing"