Skip to content

Instantly share code, notes, and snippets.

@crashbell
Last active April 21, 2022 05:52
Show Gist options
  • Save crashbell/c282e2a865cb615b200e1adc56e1989f to your computer and use it in GitHub Desktop.
Save crashbell/c282e2a865cb615b200e1adc56e1989f to your computer and use it in GitHub Desktop.
Install dotfile curl -Lks http://bit.do/crashbell-cfg-install | /bin/bash
rm -rf $HOME/.cfg
git clone --bare [email protected]:crashbell/dotfiles.git $HOME/.cfg
function config {
/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME $@
}
move_backup () {
echo "Moving backup files";
mkdir --parents "$(dirname "$1")";
mv -f "$1" "$2";
}
mkdir -p .config-backup
config fetch --all
config checkout
if [ $? = 0 ]; then
echo "Checked out config.";
else
echo "Backing up pre-existing dot files.";
config checkout 2>&1 | egrep "\s+\." | awk {'print $1'} | xargs -I{} sh -c 'mkdir -pv $(dirname .config-backup/{})'
config checkout 2>&1 | egrep "\s+\." | awk {'print $1'} | xargs -I{} mv -f {} .config-backup/{}
echo "Done backup";
fi;
config checkout
config config status.showUntrackedFiles no
echo "Installation has been completed";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment