Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
github
oh-my-zsh
Commits
43b3126b
Commit
43b3126b
authored
Sep 23, 2015
by
Andrew Janke
Committed by
Marc Cornellà
Jun 03, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
installer: use timestamped backups to preserve all old zshrcs
parent
153f5e11
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
9 deletions
+28
-9
install.sh
tools/install.sh
+20
-2
uninstall.sh
tools/uninstall.sh
+8
-7
No files found.
tools/install.sh
View file @
43b3126b
...
...
@@ -84,10 +84,28 @@ setup_ohmyzsh() {
}
setup_zshrc
()
{
# Keep most recent old .zshrc at .zshrc.pre-oh-my-zsh, and older ones
# with datestamp of installation that moved them aside, so we never actually
# destroy a user's original zshrc
echo
"
${
BLUE
}
Looking for an existing zsh config...
${
RESET
}
"
# Must use this exact name so uninstall.sh can find it
OLD_ZSHRC
=
~/.zshrc.pre-oh-my-zsh
if
[
-f
~/.zshrc
]
||
[
-h
~/.zshrc
]
;
then
echo
"
${
YELLOW
}
Found ~/.zshrc.
${
GREEN
}
Backing up to ~/.zshrc.pre-oh-my-zsh.
${
RESET
}
"
mv
~/.zshrc ~/.zshrc.pre-oh-my-zsh
if
[
-e
"
$OLD_ZSHRC
"
]
;
then
OLD_OLD_ZSHRC
=
"
${
OLD_ZSHRC
}
-
$(
date
+%Y-%m-%d_%H-%M-%S
)
"
if
[
-e
"
$OLD_OLD_ZSHRC
"
]
;
then
error
"
$OLD_OLD_ZSHRC
exists. Can't back up
${
OLD_ZSHRC
}
"
error
"re-run the installer again in a couple of seconds"
exit
1
fi
mv
"
$OLD_ZSHRC
"
"
${
OLD_OLD_ZSHRC
}
"
echo
"
${
YELLOW
}
Found old ~/.zshrc.pre-oh-my-zsh."
\
"
${
GREEN
}
Backing up to
${
OLD_OLD_ZSHRC
}${
RESET
}
"
fi
echo
"
${
YELLOW
}
Found ~/.zshrc.
${
RESET
}
${
GREEN
}
Backing up to
${
OLD_ZSHRC
}${
RESET
}
"
mv
~/.zshrc
"
$OLD_ZSHRC
"
fi
echo
"
${
BLUE
}
Using the Oh My Zsh template file and adding it to ~/.zshrc.
${
RESET
}
"
...
...
tools/uninstall.sh
View file @
43b3126b
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment