Last active
August 25, 2021 16:01
-
-
Save trevoreyre/c4170c6023e94f86cac1d8025aa3176d to your computer and use it in GitHub Desktop.
Installation script for dotfiles repo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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