Created
February 10, 2020 18:16
-
-
Save thomasgroch/49d346d4f21af59a8d5da96a31197442 to your computer and use it in GitHub Desktop.
Bootstrap https://gitlab.com/dwt1/dotfiles on your system
This file contains hidden or 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
| # where $BARE_DOTFILES directory is a git bare repository. | |
| BARE_DOTFILES=$HOME/.bare-dotfiles | |
| BARE_DOTFILES_BACKUP=$HOME/.bare-dotfiles-bkp | |
| BARE_DOTFILES_TMP=$HOME/.bare-dotfiles-tmp | |
| [[ ! -e .gitmodules ]] && git clone --depth 1 --branch bare --separate-git-dir=$BARE_DOTFILES https://gitlab.com/dwt1/dotfiles.git $BARE_DOTFILES_TMP && \ | |
| cp $BARE_DOTFILES_TMP/.gitmodules $HOME | |
| rm -rf $BARE_DOTFILES_TMP | |
| [[ ! -e $BARE_DOTFILES ]] && git clone --jobs 10 --branch bare --bare https://gitlab.com/dwt1/dotfiles.git $BARE_DOTFILES | |
| function dotfiles { | |
| /usr/bin/git --git-dir=$BARE_DOTFILES --work-tree=$HOME $@ | |
| } | |
| # dotfiles remote add origin https://gitlab.com/dwt1/dotfiles.git | |
| # dotfiles checkout --track bare/bare | |
| # dotfiles checkout bare | |
| # dotfiles branch --set-upstream-to=origin/bare bare | |
| # Reset current HEAD to the specified state | |
| dotfiles reset --hard | |
| # Init submodules | |
| dotfiles submodule update --init --recursive | |
| # Remove untracked files from the working tree | |
| # dotfiles clean -df # Caution | |
| dotfiles checkout | |
| if [ $? = 0 ]; then | |
| echo "Checked out dotfiles."; | |
| else | |
| echo "Backing up pre-existing dot files."; | |
| mkdir -p $BARE_DOTFILES_BACKUP | |
| dotfiles checkout 2>&1 | egrep "\s+\." | awk {'print $1'} | xargs -I{} mv {} $BARE_DOTFILES_BACKUP/{} | |
| fi; | |
| dotfiles checkout | |
| dotfiles config --local status.showUntrackedFiles no | |
| [[ ! -h .git ]] && ln -s $BARE_DOTFILES .git | |
| source ~/.profile | |
| bash ./new.sh | |
| # password-store-installer | |
| # rsync --recursive --verbose --exclude '.git' dotfiles-tmp/ $HOME/ | |
| # rm --recursive dotfiles-tmp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment