Skip to content

Commit

Permalink
Update backup mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
dhvcc committed Jul 1, 2024
1 parent 0b46e41 commit bf148ab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
1 change: 0 additions & 1 deletion .cfg/Dockerfile.test.brew
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 5 additions & 10 deletions .cfg/install.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit bf148ab

Please sign in to comment.