mirror of
https://github.com/robbyrussell/oh-my-zsh.git
synced 2025-12-06 07:20:40 +01:00
installer: use timestamped backups to preserve all old zshrcs
This commit is contained in:
committed by
Marc Cornellà
parent
153f5e11ed
commit
43b3126b5c
@@ -10,16 +10,17 @@ if [ -d ~/.oh-my-zsh ]; then
|
||||
fi
|
||||
|
||||
echo "Looking for original zsh config..."
|
||||
if [ -f ~/.zshrc.pre-oh-my-zsh ] || [ -h ~/.zshrc.pre-oh-my-zsh ]; then
|
||||
echo "Found ~/.zshrc.pre-oh-my-zsh -- Restoring to ~/.zshrc";
|
||||
ZSHRC_ORIG=~/.zshrc.pre-oh-my-zsh
|
||||
if [ -e "$ZSHRC_ORIG" ]; then
|
||||
echo "Found $ZSHRC_ORIG -- Restoring to ~/.zshrc"
|
||||
|
||||
if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then
|
||||
ZSHRC_SAVE=".zshrc.omz-uninstalled-$(date +%Y%m%d%H%M%S)";
|
||||
echo "Found ~/.zshrc -- Renaming to ~/${ZSHRC_SAVE}";
|
||||
mv ~/.zshrc ~/"${ZSHRC_SAVE}";
|
||||
if [ -e ~/.zshrc ]; then
|
||||
ZSHRC_SAVE=~/.zshrc.omz-uninstalled-$(date +%Y-%m-%d_%H-%M-%S)
|
||||
echo "Found ~/.zshrc -- Renaming to ${ZSHRC_SAVE}"
|
||||
mv ~/.zshrc "${ZSHRC_SAVE}"
|
||||
fi
|
||||
|
||||
mv ~/.zshrc.pre-oh-my-zsh ~/.zshrc;
|
||||
mv "$ZSHRC_ORIG" ~/.zshrc
|
||||
|
||||
echo "Your original zsh config was restored. Please restart your session."
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user