Commit graph

16 commits

Author SHA1 Message Date
Paul Frederiksen
4bcd3b5757 fix: prevent .zshrc deletion during uninstall when no backup exists
Fixes #13156

- Enhanced uninstall script to automatically restore .zshrc from uninstall backup
  when no original backup (.zshrc.pre-oh-my-zsh) exists
- Improved install script to create backup even when KEEP_ZSHRC=yes
- Added better user feedback and error handling
- Prevents data loss for users who installed with --keep-zshrc option

The issue occurred when users installed oh-my-zsh with KEEP_ZSHRC=yes
(keeping their existing .zshrc), which didn't create a backup. During
uninstall, their .zshrc would be deleted with no backup to restore.

Now the uninstall process:
1. Creates a timestamped backup of current .zshrc
2. Looks for original backup (.zshrc.pre-oh-my-zsh)
3. If found, restores the original
4. If not found, automatically restores from the uninstall backup
5. Provides clear feedback to the user

This ensures users never lose their .zshrc configuration during uninstall.
2025-09-10 12:37:18 -04:00
Michele Bologna
c08b925d28
fix(uninstall): abort uninstall if unable to change shell (#10357) 2023-03-23 14:34:43 +01:00
Marc Cornellà
e8716cb570
fix(uninstall): fix renaming .zshrc when no original rc file found
Fixes #9629
Fixes #9700
2021-03-15 19:51:31 +01:00
Giuseppe
4deafdff96 Fix change to old shell on uninstall (#8430)
If there's no `~/.shell.pre-oh-my-zsh`, don't assume the default choice
is Bash.  In fact Zsh is the default shell for macOS since Catalina
(10.15) [1], yet users of other OSes have likely to have Bash as their
default.

This commit fix issue #8252

[1] https://support.apple.com/en-us/HT208050
2019-11-25 16:36:33 +01:00
Zach Whitten
2e54ba2dfb installer: restore previous default shell with uninstall
Co-authored-by: Antonio QUINTAVALLE <antonio.quintavalle@amadeus.com>
Co-authored-by: Marc Cornellà <marc.cornella@live.com>
2019-06-03 17:18:25 +02:00
Andrew Janke
43b3126b5c installer: use timestamped backups to preserve all old zshrcs 2019-06-03 17:18:24 +02:00
LE Manh Cuong
c25002a13f Removing source command 2015-11-04 20:36:53 +07:00
LE Manh Cuong
53a63355be Change coding style 2015-10-23 14:15:03 +07:00
LE Manh Cuong
45cd2df31f Update uninstall.sh
- Need dot `.` for POSIX compliant instead of `source`
 - Use modern syntax for command substitution
 - Fix missing double quotes
2015-10-23 09:03:24 +07:00
Marc Cornellà
d06f4d0893 Fix backwards logic in uninstaller once and for all
Really this time :P

Fixes #4533
2015-10-21 16:46:38 +02:00
Marc Cornellà
4e42e1f7e1 Fix conditional in uninstall prompt 2015-10-21 11:28:12 +02:00
Marc Cornellà
b2010a0ae6 Fix syntax error in confirmation prompt of uninstall.sh
We need to use POSIX syntax. This file is no longer executed with zsh.

Fixes #4483.
2015-10-21 11:24:12 +02:00
Rodrigo Chiossi
6b73f5ec75 Ask for confirmation before uninstall
Prompt the user before removing oh-my-zsh from the system
2015-10-05 18:32:42 -03:00
Andrew Janke
502f08b5e1 Add Cygwin support to installer.
* Balk at incompatible Windows/MSYS git
* Test for chsh presence before trying to use it
* Replace non-portable `[[ ... ]]` and `[ x = *pattern* ]` constructs
2015-09-03 12:47:02 -04:00
Probably Not
dfbafe6d58 Fixing conflict in install scripts 2012-12-02 13:08:06 -08:00
Robby Russell
e1f5c0c703 Adding an uninstaller tool 2009-08-31 15:00:38 -07:00