From bf148ab1401cbecc6f5751cb79bf67c96e9f368a Mon Sep 17 00:00:00 2001 From: dhvcc Date: Tue, 2 Jul 2024 01:00:51 +0300 Subject: [PATCH] Update backup mechanism --- .cfg/Dockerfile.test.brew | 1 - .cfg/install.sh | 15 +++++---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/.cfg/Dockerfile.test.brew b/.cfg/Dockerfile.test.brew index 7c0a69c..73cbd5d 100644 --- a/.cfg/Dockerfile.test.brew +++ b/.cfg/Dockerfile.test.brew @@ -26,7 +26,6 @@ RUN brew install starship neofetch fzf btop wget \ RUN curl -fLo '~/.vim/autoload/plug.vim' --create-dirs \ 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' -ENV E=123 RUN rm -rf .bashrc .zshrc && curl -Lks https://raw.githubusercontent.com/dhvcc/configs/master/.cfg/install.sh | /bin/sh # Install manually or in script diff --git a/.cfg/install.sh b/.cfg/install.sh index dba2b44..f8a9202 100755 --- a/.cfg/install.sh +++ b/.cfg/install.sh @@ -1,21 +1,16 @@ #!/bin/sh -# Origin https://bitbucket.org/durdn/cfg/src/master/.bin/install.sh +# Inspiration https://bitbucket.org/durdn/cfg/src/master/.bin/install.sh cd "$HOME" alias cfg="/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME" mkdir -p "$HOME/.config-backup" -git clone --bare https://github.com/dhvcc/configs.git $HOME/.cfg +git clone --no-checkout --bare https://github.com/dhvcc/configs.git $HOME/.cfg -cfg checkout +# Backup and remove repo files (if exist) +cfg ls-tree -r master --name-only | xargs -I {} mv {} ./.config-backup/{} -if [ $? = 0 ]; then - echo "Checked out config."; - else - echo "Backing up pre-existing dot files."; - cfg checkout 2>&1 | egrep "\s+\." | awk {'print $1'} | xargs -I{} mv {} .config-backup/{} - cfg checkout -fi; +cfg checkout cfg "config" status.showUntrackedFiles no cfg "config" commit.verbose true