✨ (install.sh): add backup and restore logic for .gitconfig to prevent loss during installation
This commit is contained in:
15
install.sh
15
install.sh
@@ -20,6 +20,13 @@ do
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -f ~/.gitconfig ]; then
|
||||
cp ~/.gitconfig ~/.gitconfig.backup
|
||||
echo "Backup of .gitconfig created."
|
||||
else
|
||||
echo ".gitconfig does not exist, no backup created."
|
||||
fi
|
||||
|
||||
if command -v zsh &> /dev/null && command -v git &> /dev/null && command -v wget &> /dev/null && command -v fc-cache &> /dev/null; then
|
||||
echo -e "ZSH, Git, wget, and fontconfig are already installed\n"
|
||||
else
|
||||
@@ -30,6 +37,14 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -f ~/.gitconfig.backup ]; then
|
||||
mv ~/.gitconfig.backup ~/.gitconfig
|
||||
echo "Restored .gitconfig from backup."
|
||||
else
|
||||
echo "No .gitconfig backup found to restore."
|
||||
fi
|
||||
|
||||
|
||||
ZSH="$HOME/.oh-my-zsh"
|
||||
|
||||
if mv -n ~/.zshrc ~/.zshrc-backup-$(date +"%Y-%m-%d"); then # backup .zshrc
|
||||
|
||||
Reference in New Issue
Block a user