Skip to content

Instantly share code, notes, and snippets.

@trevoreyre
Last active August 25, 2021 16:01
Show Gist options
  • Save trevoreyre/c4170c6023e94f86cac1d8025aa3176d to your computer and use it in GitHub Desktop.
Save trevoreyre/c4170c6023e94f86cac1d8025aa3176d to your computer and use it in GitHub Desktop.
Installation script for dotfiles repo
#!/bin/sh
# To run locally:
# curl -Lks https://gist.githubusercontent.com/trevoreyre/c4170c6023e94f86cac1d8025aa3176d/raw | /bin/bash
git clone --bare https://github.com/trevoreyre/dotfiles.git $HOME/.dotfiles
function dotfiles {
git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME $@
}
dotfiles checkout
if [ $? = 0 ]; then
echo "Checked out dotfiles!";
else
echo "Backing up pre-existing dot files.";
if [ -d $HOME/.dotfiles-backup ]; then
mkdir -p $HOME/.dotfiles-backup
fi
echo "Checking out dotfiles.";
dotfiles checkout 2>&1 | egrep "\s+\." | awk {'print $1'} | xargs -I{} mv $HOME/{} $HOME/.dotfiles-backup/{}
echo "Done!";
fi;
dotfiles checkout
dotfiles config status.showUntrackedFiles no
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment