#!/usr/bin/env bash #----------------------------------- # Name: config # Version: 1.0.0 # Author: Solomon Laing # Description: # Installs my dotfiles #----------------------------------- echo "This script is going to install my dotfiles." function config { /usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME $@ } if [ ! -d $HOME/.cfg ]; then git clone --bare https://gitlab.inkletblot.com/inkletblot/config.git $HOME/.cfg fi echo " The script will now attempt to install the configs, if configs have been installed using the method found here: https://www.atlassian.com/git/tutorials/dotfiles, there will be issues. " config checkout main if [ $? = 0 ]; then echo "Checked out config." else echo "Backing up pre-existing dot files." mkdir -p $HOME/.config-backup config checkout 2>&1 | egrep "\s+\." | awk {'print $1'} | xargs -I{} mv $HOME/{} $HOME/.config-backup/{} fi config checkout main config config status.showUntrackedFiles no config config --global credential.helper store read -r -p " My dotfiles contain aliases for 'config' however you may need to add them, see https://www.atlassian.com/git/tutorials/dotfiles. Remember to identify yourself to git with: config config user.name \"Your Name\" config config user.email \"Your Email\" Press [Enter] to continue."