Skip to content

Instantly share code, notes, and snippets.

@pinpox
Last active December 14, 2017 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pinpox/caa345c5d89fe9f4780bf3a4a4d5b072 to your computer and use it in GitHub Desktop.
Save pinpox/caa345c5d89fe9f4780bf3a4a4d5b072 to your computer and use it in GitHub Desktop.
Setup environment on a new system
#!/bin/bash
GIT_REPO="https://gitlab.com/binaryplease/dotfiles.git"
git clone --bare $GIT_REPO $HOME/.cfg
function config {
/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME $@
}
echo ".cfg" >> .gitignore
mkdir -p .config-backup
config checkout
if [ $? = 0 ]; then
echo "Checked out config2.";
else
echo "Backing up pre-existing dot files.";
config checkout 2>&1 | egrep "\s+\." | awk {'print $1'} | xargs -I{} mv {} .config-backup/{}
fi;
config checkout
config config status.showUntrackedFiles no
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment