Commit graph

159 commits

Author SHA1 Message Date
Marc Cornellà
62216aaa8f installer: use guard clauses in setup_shell for better readability
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.
2019-06-03 17:18:23 +02:00
Raf Czlonka
8e10ac4d73 installer: make sure shell in /etc/shells is not commented
Otherwise we risk a situation where a full path to `zsh` is commented, i.e.:

    #/usr/local/bin/zsh
2019-06-03 17:18:23 +02:00
Luca S
73f29087f9 installer: replace the current shell with the new ZSH instance
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.
2019-06-03 17:18:23 +02:00
Marc Cornellà
1fdd5351fb installer: abstract error messages 2019-06-03 17:18:23 +02:00
Marc Cornellà
576499a5ad installer: fix for failed chsh quitting the installation 2019-06-03 17:18:23 +02:00
Marc Cornellà
a7bd1f99ae installer: extract most code into functions 2019-06-03 17:18:23 +02:00
Marc Cornellà
f94443925d installer: reorganise and add comments 2019-06-03 17:18:23 +02:00
Marc Cornellà
73ef051aae installer: use tabs to allow future heredocs
This will allow us to use tab stripping heredocs with `<<-'.
See http://www.tldp.org/LDP/abs/html/here-docs.html#EX71A

Add editorconfig file to enforce this style.
See http://editorconfig.org for more information.
2019-06-03 17:18:22 +02:00
Marc Cornellà
9a832cccef installer: use exit-on-error from the beginning 2019-06-03 17:18:22 +02:00
Guillermo Azurdia
9b2410fbcf Remove dots from installer URLs (#7780) 2019-04-18 23:08:07 +02:00
Marc Cornellà
c23ab00990
upgrade: fix lock-out on first upgrade check
This early return made it so the lock wasn't removed, therefore locking out
the upgrade script from ever entering the upgrade routine.

Fixes #6138 

Note: the logic needs some rework.
2019-04-07 20:39:25 +02:00
Robby Russell
f319aa845d
Updating Oh My Zsh shop URLs (#7619)
* Updating Oh My Zsh shop URLs

Linking directly to the Oh My Zsh inventory vs the top-level store with non-OMZ items.

* Updating link to Oh My Zsh products in the install script

* Updating link to Oh My Zsh shop products in the upgrade script

* Getting rid of 't-' in shirts for now
2019-02-25 19:22:07 -06:00
Jackson Delahunt
026e4e499e installer: make TEST_CURRENT_SHELL use basename (#7514)
Fixes #7492
2019-01-15 19:01:34 +01:00
Janosch Schwalm
19b925e741 use https everywhere (#6574)
* use https everywhere

* use https links on the files that are left

Also, removed some broken links and updated redirections.
2018-08-07 20:42:01 +02:00
Joel Kuzmarski
8f95637e67 Login shell after install (#5314)
Otherwise these files are not sourced:
  1. /etc/zprofile
  2. ~/.zprofile
  3. /etc/zlogin
  4. ~/.zlogin
  5. ~/.zlogout
  6. /etc/zlogout
2018-07-01 18:39:30 +02:00
Chao Du
de8299d6c4 Fixed Issue #4550: Move ~/.zsh-update file to $ZSH_CACHE_DIR 2018-06-15 23:43:21 +02:00
Dan Wallis
fec0089cdd Quote $ZSH where necessary in install script (#6587)
Quote $ZSH where necessary in install script
2018-06-13 02:02:48 +02:00
Gert de Pagter
2b7a41b0d2 Update the update prompt (#6825)
`[Oh My Zsh] Would you like to check for updates? [Y/n]: ` does not make sense, 
since answering yes will download/apply the new updates instead of checking for them.
2018-05-15 11:26:59 +02:00
ningwei1993
8f0ff4bb63 fix bug for check zsh (#6798) 2018-05-07 00:39:28 +02:00
Marc Cornellà
c4981bae0a installer: check if zsh in path instead of /etc/shells
Fixes #4955

Closes #5931
Closes #6398

Co-authored-by: Void <vst4rbot@gmail.com>
Co-authored-by: Kaleb Elwert <belak@coded.io>
2018-05-05 22:03:57 +02:00
Marc Cornellà
4fec0a46e7
[installer] use command -v to check for git
Quick fix to the script not finding git due to hash.
Solves #6697.
2018-04-17 22:14:23 +02:00
Doug Yun
2526d71c56 Use HTTPS for Planet Argon links (#6326) 2017-11-01 06:21:07 -07:00
Fabian Wolff
1f64fa92f5 Convert "if then" statements to "if; then" one-liners 2016-10-03 12:05:10 +02:00
Fabian Wolff
4fa6be0230 Use rmdir instead of rm -r 2016-10-03 12:05:10 +02:00
Fabian Wolff
40bfe5a412 Implement a locking mechanism to avoid multiple update prompts (fixes #3766) 2016-10-03 12:05:10 +02:00
Fredrik Fornwall
9772f8e10d Replace /bin/sh with sh for portability (#5291)
This makes things work even on system lacking /bin/sh, such as on
non-rooted Android systems.
2016-08-09 02:39:11 +02:00
Felipe Vargas
551abfcbb4 Remove undesirable hardcoding of PATH into zshrc (#4925)
See robbyrussell@b67961d
2016-06-16 21:56:34 +02:00
Andrew Janke
483f1208a5 installer: fix ordering of cygwin msys git check (#4557) 2016-05-31 00:53:54 +02:00
Robin Hallabro
18ca953f12 Use consistent wording when updating
When the user is asked to update oh-my-zsh it says "[Oh My Zsh] Would
you like to check for updates? [Y/n]:". When the user agreed to update
the next text would say "Upgrading Oh My Zsh" which is inconsistent
with the question.
2015-12-15 03:46:46 +01:00
Marc Cornellà
ef031dfe8f Merge pull request #4207 from mpscholten/master
Also accept any forms of yes as an answer to the "do you want to update?" prompt
2015-11-29 14:34:14 +01: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
Marc Cornellà
ca5632bce1 Fix syntax error in #4515 on certain shells
Drops the `function` keyword and uses only `func(){}` syntax as per the
POSIX specification:

http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_09_05

Related: #4531
2015-10-21 10:48:02 +02:00
Marc Cornellà
78dc858396 Revert "Make install script safer"
This reverts commit c9d93757e8, which
makes it fail with a syntax error:

  sh: 1: Syntax error: "(" unexpected
2015-10-21 10:36:40 +02:00
Marc Cornellà
fdb0e239d4 Merge pull request #4507 from WhyEee/fix-no-tput
Fix install.sh/upgrade.sh for tput-less systems
2015-10-20 23:30:29 +02:00
Marc Cornellà
b3c10b925e Merge pull request #4505 from arvindch/checked-upgrade
Check for git before trying to upgrade OMZ
2015-10-20 23:29:00 +02:00
Brian J Brennan
c9d93757e8 Make install script safer
This changeset wraps all of the commands in tools/install.sh in a
function and then calls that function as the last line of the
script.

The current install instructions ask the user to download the install
script using `curl` and pass the result to `sh`. This is totally
fine (as long as both the instructions and the script itself are served
using HTTPS), but the script should be written in a way such that it
doesn't start trying to actually *do* anything until the very last line.

The reason is due to the way `curl` work: if the socket drops before the
request is complete (server abruptly hangs up, client's internet flakes
out, etc.), `curl` will return the partial data that it received. Here
is an example of that:

![partial file execution](https://cldup.com/qU_Mnh2GmT.png)

A way this might cause issues for tools/install.sh is if the connection drops
after cloning but before the repository (L53-56). The .zshrc
configuration will not be copied and the shell will not be changed, but
if the user tries to run the install script again it will claim
oh-my-zsh is already installed (L31-39).

While this is not a particularly dangerous error condition (the user can
just delete .oh-my-zsh and re-run), it can certainly be confusing for
new users. This also helps future-proof the script for a time when it
might need to use a "dangerous" command, e.g. `rm`, and we want to make
sure it happens in the most transactional way possible.
2015-10-20 14:18:22 -04:00
Marc Cornellà
8c73eb4f44 Merge pull request #4419 from apjanke/installer-termcap-hack
installer: ignore errors in color setup, for FreeBSD portability
2015-10-20 08:30:14 +02:00
Yannick Eckey
75e619b724 Fix install.sh/upgrade.sh for tput-less systems
@fcrozat's original fix assumes `which` not to output anything to STDOUT
in case the command is not found. That is not necessarily true on all
systems. A better solution is to check the return value instead.

Fixes #4376
2015-10-16 22:27:46 +02:00
Arvind Chembarpu
e59e1c8417 Check for git before trying to upgrade, as per #4504 2015-10-16 23:19:55 +05:30
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
f94fee5a7f installer: don't bail on errors in color setup
This is a hack to keep the installer working on systems without tput/terminfo.
2015-09-28 08:35:25 -04:00
Robby Russell
935948cf3b Merge pull request #3646 from apjanke/installer-cygwin-support-3
Add Cygwin support to installer.
2015-09-26 09:35:39 -07:00
Andrew Janke
96ff86142e Merge branch 'master' into installer-cygwin-support-3
Conflicts:
	tools/install.sh
2015-09-23 18:53:05 -04:00
Frederic Crozat
95296bb0c5 also handle missing tput in upgrade script. 2015-09-22 16:46:22 +02:00
Frederic Crozat
884a879562 Do not fail if tput is not available
Fixes issue #4376
2015-09-21 20:02:57 +02:00