-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
installer: fix, refactor and add installer arguments #5169
Conversation
a15d621
to
cc44ad8
Compare
cc44ad8
to
612c561
Compare
c017808
to
d9f18a5
Compare
53fa153
to
5cf6022
Compare
5cf6022
to
0048e60
Compare
tools/install.sh
Outdated
TEST_CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)') | ||
if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then | ||
# If this platform provides a "chsh" command (not Cygwin), do it, man! | ||
if command_exists chsh; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assumes that /etc/shells
exists if chsh
exists, which is not the case on all systems (Android).
Could we also check for /etc/shells
here before running grep /zsh$ /etc/shells | tail -1
, and fall back to I can't change your shell automatically
otherwise?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#6398 should fix this
0048e60
to
9c1a94b
Compare
171453e
to
886e110
Compare
This replaces the currently running process with the new one using `exec` instead of creating a new process. This way, when the user `exit`s out of the new shell it will not pop them back into the shell from which ohmyzsh was installed from.
Otherwise we risk a situation where a full path to `zsh` is commented, i.e.: #/usr/local/bin/zsh
Guard clauses are if constructs that return early if there is an error that prevents continuing. This way there isn't a big nesting of if expressions.
Co-authored-by: Fredrik Fornwall <fredrik@fornwall.net>
This changes the behavior to default to the binary found first in $PATH, then checking it's actually in the shells file (/etc/shells). If that fails go back to the previous behavior, but actually check that the path obtained exists in the filesystem. Co-authored-by: Joel Kuzmarski <leoj3n@gmail.com>
This facilitates testing of changes to the core installation code: you'll be able to do a roundtrip test of install and uninstall using the working code on your branch. Controlled by passing $REPO and $BRANCH environment variables to install.sh.
Supposed to be POSIX-compatible. Proved to work in dash, yash and whatever alpine uses. See https://unix.stackexchange.com/a/371873
Co-authored-by: Marshall Ford <inbox@marshallford.me> Co-authored-by: Joel Kuzmarski <leoj3n@gmail.com>
Co-authored-by: Joel Kuzmarski <leoj3n@gmail.com>
Co-authored-by: Liquidsoul <liquidsoul@liquidsoul.fr> Co-authored-by: Alexander Polynomdivision <digitalmail555@googlemail.com> Co-authored-by: loket <loket@cruftlab.io> Co-authored-by: Connor Demille <subtlepseudonym@gmail.com>
Co-authored-by: Antonio QUINTAVALLE <antonio.quintavalle@amadeus.com> Co-authored-by: Marc Cornellà <marc.cornella@live.com>
tput may throw errors on invalid $TERM values, for example. This shorthand syntax allows for that as well as for if tput doesn't exist.
69f9ede
to
c8ac403
Compare
installer: fix, refactor and add installer arguments
For what it's worth: |
This lets installation run all the way through without running twice. Let's try it. See ohmyzsh/ohmyzsh#5169
Ready for testing
This is an all-encompassing PR to fix once and for all all issues related to the OMZ installer, as well as adding features requested many times.
Fixes
zshrc
file mangling.zshrc.pre-oh-my-zsh
Fixes #2499. Fixes #4390. Fixes #4391.
Change of default shell issues
/etc/shells
existsFixes #4131. Fixes #4564. Fixes #4818. Fixes #5277. Fixes #6569. Fixes #7254.
Restore default shell
Fixes #3447. Fixes #6119. Fixes #6299. Fixes #6356. Fixes #6608.
$PATH
managementPATH=
with no$PATH
inside #2586: install.sh:PATH=
with no$PATH
insideFixes #1359. Fixes #2586. Fixes #4925. Closes #2589. Closes #4317.
New features
Skip change of default shell
Fixes #4261. Fixes #7100. Fixes #7266. Fixes #7721. Fixes #7865.
The installer respects the environment variable
CHSH
. Set tono
, it will skip the chsh step. It also reads the flag--skip-chsh
which has the same effect. For instance, these two are equivalent:Don't run zsh after install
Fixes #4393. Fixes #5002. Fixes #5853. Fixes #5893. Fixes #6547. Fixes #7790.
As in the skip-chsh feature above, the installer respects the variable
RUNZSH
, which when set tono
will skip the zsh call when the install is done. The flag--unattended
also setsRUNZSH=no
, as well as settingCHSH=no
. So these two are equivalent:Forks
Fixes #3648. Fixes #5628. Fixes #7496.
The installer respects the following environment variables, that can be set up when calling it with
VAR=value sh install.sh
.REPO
: value in the form ofowner/project
. Useful for forks in GitHub (defaults to `robbyrussell/oh-my-zsh).BRANCH
: default branch to check out once the clone has finished (defaults to master).REMOTE
: full remote URL (supersedesREPO
if set). You could for example choose an ssh remote URL, likegit@github.com:user/oh-my-zsh
, or another fork from GitLab or Bitbucket.Other
Fixes #5320. Fixes #7007.
Closes #5194.