Commit graph

219 commits

Author SHA1 Message Date
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
Andrew Janke
6cddf7202b Merge branch 'master' into installer-portable-colors 2015-09-19 15:07:36 -04:00
Robby Russell
56cdec7534 Merge pull request #3889 from leycec/compaudit
Repair `zsh` Path Permissions on `oh-my-zsh` Startup under Cygwin
2015-09-19 08:40:34 -07:00
Andrew Janke
82c76f6b5c Merge changes from #4241 into installer-portable-colors
Conflicts:
	tools/install.sh
	tools/upgrade.sh
2015-09-03 12:50:55 -04: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
Robby Russell
ccaaa992c7 Merge pull request #4241 from heartinpiece/master
Check if Zsh is installed prior to installing Oh My Zsh
2015-08-30 21:44:38 -07:00
Robby Russell
a228604e69 Merge pull request #4249 from KrauseFx/patch-1
Use https instead of http
2015-08-30 21:38:33 -07:00
Robby Russell
b3f167d998 Merge pull request #3613 from apjanke/remove-sed-i
Installer: Remove "sed -i" for portability and hygiene
2015-08-30 09:13:04 -07:00
Andrew Janke
fe92ea98e0 installer: switch twitter link to https 2015-08-27 17:17:43 -04:00
Felix Krause
de47e2df69 Use https instead of http 2015-08-16 19:29:58 +02:00
Chang Hyun Park
58d2f9335d Check if Zsh is installed prior to installing Oh My Zsh
Check if Zsh is installed before installing anything else.
New-commers, or people who don't read the disclaimers(ex. me) will go
straight to stack overflow if chsh -s returns an error.
2015-08-12 16:47:37 +09:00
Marc Scholten
d351c76b04 Also accept any forms of yes as an answer to the "do you want to update?" prompt 2015-08-03 14:50:57 +02:00
leycec
e8caf22beb Cygwin-specific "chsh" installation issue fixed.
Installation previously assumed the existence of a "chsh" command in the current
${PATH}. Since Cygwin does *NOT* provide this command, installation now tests
for the existence of this command before attempting to run it.
2015-07-20 00:56:19 -04:00
leycec
da395c5837 Secure umask enforced during installation.
For safety, a umask of 022 prohibiting both group and other writability is now
enforced during OMZ installation. In theory, this should reduce the likelihood
of subsequent compinit() failures due to insecure directory permissions under
all platforms except for default Cygwin installations (in which Windows ACLs
override POSIX umasks).
2015-07-20 00:56:19 -04:00
Andrew Janke
8cf610089d installer: use terminfo for portable escape sequences
Do not use terminal visual effects if not connected to a terminal.
2015-07-06 20:18:32 -04:00
Andrew Janke
19ea867a3a install.sh: use portable printf instead of echo 2015-07-06 19:44:59 -04:00
HeroCC
6a1b8320fe No input for Update Check defaults to Yes 2015-06-10 14:36:52 +02:00
Pablo Tamarit
03b8c199e5 Fix 'chsh' by checking '/etc/shells' instead of using 'which'
fix test for chsh in install
in case $SHELL is zsh but not the last one in /etc/shells
fixes #3026 fixes #3779 fixes #3780
2015-05-05 19:49:19 +02:00
Andrew Janke
1246c3e08b install.sh: Replace nonstandard "sed -i" with sed + mv commands. Makes portable to systems whose sed lacks "-i", like OpenBSD. 2015-02-20 02:34:54 -05:00
Robby Russell
d2667bd0a2 Merge pull request #3353 from mizabrik/master
Save ZSH path in newly created .zshrc
2015-02-10 11:21:15 -08:00
Nicholas T.
5cb0ed98d1 Fast installation time by shallow copying git repo
Use `--depth=1` to clone just the lastest version rather than every version in git.
2015-01-15 09:09:41 +10:00
Mark Feltner
83553597a1 fix(tools/check_for_upgrade): Don't source profile
Reverts #2296, but mostly #1883.

There is no need to source ~/.profile when this script is read. oh-my-zsh writes no configuration data in ~/.profile.

If the user wishes to use data within ~/.profile, then they should source it in another place.

Fixes #2315
2014-12-15 18:45:50 +01:00
mizabrik
c6a8b2ea6d Save ZSH path in newly created .zshrc 2014-11-28 19:40:56 +03:00
Robby Russell
57ff83db59 Merge pull request #2946 from moinakg/master
Solaris portability tweaks.
2014-11-06 09:26:48 -08:00
Moinak Ghosh
3a39732845 Change to epoch target in days instead of seconds. 2014-10-14 12:05:01 +05:30
Moinak Ghosh
90762eee49 Convert epoch_target from days to seconds. 2014-09-17 11:11:48 +05:30
Moinak Ghosh
5f38a537ce Update Solaris changes to use OSTYPE and zsh datetime module. 2014-09-16 22:29:52 +05:30
Robby Russell
c1cd9cb126 Merge pull request #3049 from strycore/master
Prevent chsh from running when $SHELL is already zsh
2014-08-31 11:42:40 -07:00
Robby Russell
671bd0cf4f Link to swag in installer... shameless profiting 2014-08-31 11:32:07 -07:00
Robby Russell
9f8d7d85c2 Adding link to the store for swag in upgrade process 2014-08-31 11:30:30 -07:00
Mathieu Comandon
91ba6d9887 Don't try running chsh if user already runs zsh 2014-08-21 12:47:48 +02:00
Fredrik Fornwall
dac2a6e27a Replace /usr/bin/env with env
Some environments (such as Android) does not have /usr/bin.
2014-08-20 23:52:05 +02:00
Moinak Ghosh
5e328e3a9c Solaris portability tweaks. 2014-07-11 18:41:49 +05:30
n.st
a9e1d9aa89 Cancel upgrade if $ZSH is not writable
from #2360
2014-06-04 19:37:14 +02:00
Mark Feltner
8d976e02b1 fix(tools/check_for_upgrade): Don't source profile
Reverts #2296, but mostly #1883.

There is no need to source ~/.profile when this script is read. oh-my-zsh writes no configuration data in ~/.profile.

If the user wishes to use data within ~/.profile, then they should source it in another place.

Fixes #2315
2014-05-24 19:51:08 +02:00
Adam Luikart
9590b96b3f Write the update file even if CLOBBER is unset. 2014-05-24 19:40:30 +02:00
Henrik Holm
f46d06dae1 Correct redirection of output from 'hash'
The intention of the redirection to /dev/null is to hide the output
'hash: no such command: git' since we rely on the exit status.

However, the output goes to stderr, so it's stderr that needs to be
redirected. For completeness, we redirect both stderr and stdout using
'2>&1'.

Example:

  [~]$ hash git > /dev/null
  [~]$ PATH=''
  [~]$ hash git > /dev/null
  hash: no such command: git
  [~]$ hash git > /dev/null 2>&1
  [~]$
2014-03-30 10:34:13 -04:00
Robby Russell
47b0d754ae Fixing a few quirks in the latest installer updates (quoting /Users/robbyrussell/.oh-my-zsh and such). Also mentioining our twitter account after install 2014-03-13 10:15:18 -07:00
Andrew Vit
da1fa3b06a Abort installer on errors 2014-03-08 13:17:16 -08:00
Andrew Vit
2e11e2ab5a Write install path into .zshrc 2014-03-08 13:16:46 -08:00
Andrew Vit
5bd590ceb3 Reference default install path from ZSH variable 2014-03-08 13:13:52 -08:00
Robby Russell
6a2e65f4c8 Merge pull request #1402 from sergeylukin/master
Fix install.sh compatibility with /bin/sh
2014-03-08 08:39:34 -08:00
Robby Russell
a38af27991 Revert "Cancel update if the current user doesn't have write permissions for the oh-my-zsh directory."
This reverts commit 152e1e07e0.
2013-12-18 17:03:33 -08:00
n.st
152e1e07e0 Cancel update if the current user doesn't have write permissions for the oh-my-zsh directory. 2013-12-18 18:27:20 +01:00
Patrick Stadler
858c515df2 source ~/.profile only if it exists 2013-12-03 09:52:51 +01:00
Robby Russell
0d352109e9 Merge pull request #1087 from avit/install-template
Add configuration placeholders to installer template
2013-12-02 23:49:00 -08:00
Robby Russell
f48d6759e6 Merge pull request #1883 from Stibbons/gsemet_push_source_profile_for_upgrade
source ~/.profile for upgrading (to source the proxy configuration)
2013-12-02 23:43:43 -08:00
Robby Russell
f574849c0a Merge pull request #1927 from dongweiming/modify
Modify determine the oh-my-zsh installed in non-default path of the installed
2013-12-02 23:37:49 -08:00
Valentin Shevko
7c56364dc4 Add update statistics
After the upgrade is interesting to know what's new.
2013-11-22 02:34:33 +03:00
Andrew Vit
1e9f55f09d Add configuration placeholders to installer template
Although the zshrc template adds a PATH= string, this is overwritten by the installer script.
This allows it to be placed anywhere in the file instead of having to append at the end.
2013-10-25 14:50:27 -07:00
Gaetan Semet
0fcb7dd55e Display right prompt in theme chooser
I didn't found the way to right-align the right prompt
properly.

Signed-off-by: Gaetan Semet <gaetan@xeberon.net>
2013-09-10 11:28:31 +02:00
dongweiming
d4a9467f89 Modify determine the oh-my-zsh installed in non-default path of the installed 2013-06-30 18:08:48 +08:00
UncleBill
87a1d8a02d git-pull add --rebase option 2013-06-25 12:08:02 +08:00
Gaetan Semet
3f44f51e9c source ~/.profile for upgrading (to source the proxy configuration)
Signed-off-by: Gaetan Semet <gaetan@xeberon.net>
2013-06-11 14:51:26 +02:00
Marcus Müller
39b46f526c eliminated unnecessary cd and failing substitution
Changing the working directory in a sub-subshell
does not change the working directory of the executing
shell.

The substitution was broken for me on _all_ my machines,
so I started looking into the business.
2013-04-29 09:51:21 +02:00
Robby Russell
d8e700c1b6 Merge pull request #1651 from deepusudhakar/master
Escape $ZSH path in upgrade_oh_my_zsh
2013-04-12 05:56:50 -07:00
Robby Russell
f2a927f9b2 Merge pull request #1696 from henryyan/master
Added $PATH to PATH in install shell
2013-04-12 05:56:24 -07:00
Gaurav Misra
32a42f27b6 Escape spaces in folder name so script won't fail
If the current directory has spaces, the script fails to change paths and fails.
2013-04-09 11:45:16 -07:00
Henry Yan
d55262b6a1 Added $PATH to PATH in install shell 2013-04-07 20:59:01 +08:00
Deepu Sudhakar
9991401aaa Escape /Users/desudhak/.oh-my-zsh path (previously broke spaces in path) 2013-03-10 14:36:39 -05:00
Probably Not
dfbafe6d58 Fixing conflict in install scripts 2012-12-02 13:08:06 -08:00
Robby Russell
9a88e76823 Merge pull request #1370 from ericmathison/syntax-fix
Fix color syntax
2012-12-01 11:58:21 -08:00
Eric Danielson
200a25818a Add UPDATE_ZSH_DAYS setting 2012-11-26 11:35:16 -08:00
Sergey Lukin
ebeae4abe9 Fix /bin/sh compatibility issue in install.sh 2012-11-09 23:53:22 +02:00
Eric Mathison
b0cf0674ef Fix color syntax 2012-10-21 02:19:56 -07:00
Robby Russell
1c23a52f57 auto-upadate feature will now reset the epoch so that if a user doesn't say yes, it won't ask them again for a while. fixes #1240 2012-07-20 15:07:51 -07:00
Renan Cakirerk
a39c9ffe5b Fix finding git issue. http://stackoverflow.com/questions/592620/check-if-a-program-exists-from-a-bash-script 2012-06-23 14:58:04 +03:00
Robby Russell
7d9ae4cdb1 Merge pull request #1055 from daniellockard/patch-1
Added an if-statement to see if git is installed
2012-06-13 13:17:24 -07:00
Robby Russell
91b4758d8f Now with 50% less auto-updates. 2012-05-31 09:52:53 -07:00
Daniel Lockard
12e181c6f6 Added an if-statement to see if git is installed 2012-04-04 13:04:00 -05:00
backspace
0d99759cc3 Don’t report that Oh My Zsh has been updated when it hasn’t. 2012-01-15 08:49:52 +02:00
Robby Russell
82568cc7e6 Merge pull request #708 from eatnumber1/update-print
Use printf rather than echo -e in update.sh
2011-12-16 11:04:34 -08:00
Russell Harmon
7ec2dd984a Use printf rather than echo -e in update.sh
update.sh is an "sh" script, not a zsh or bash script. On platforms
which have real sh, echo does not have the -e option.
2011-11-16 04:32:05 -05:00
Graham McMillan
4173ba1e95 Added option to disable the update prompt. Set DISABLE_UPDATE_PROMPT to true to enable. 2011-11-15 13:46:14 -05:00
Robby Russell
0fe2462af8 Merge pull request #554 from toolbear/549-fix-auto-upgrade
Fix auto upgrade failure from non-exported ZSH env var
2011-10-10 05:40:38 -07:00
Robby Russell
84c20ce6dd Merge pull request #482 from volpino/master
Theme chooser + fox's theme
2011-10-10 05:17:21 -07:00
Robby Russell
1ab0054dc6 Merge pull request #275 from tristan0x/require_tool
New script $ZSH/tools/require_tool.sh to ensure version of tool
2011-10-10 05:08:38 -07:00
Tim Taylor
c113e88c45 Fix auto upgrade failure from non-exported ZSH env var
Fixes #549. Specify ZSH=$ZSH explicitly when invoking
the auto update scripts.
2011-08-17 00:36:27 -04:00
fox
cbf662744f fixed theme chooser + options + list available themes + show all themes 2011-08-03 09:42:16 +02:00
Ilya Chesnokov
b160ee6512 'echo' did not show colors without -e in upgrade.sh 2011-08-01 10:58:05 +04:00
fox
d15d3a5b01 global zsh config 2011-07-24 20:51:27 +02:00
fox
76dd2d8b05 mac os fix 2011-07-24 11:58:41 +02:00
fox
5d5d2f94be fox's theme + theme chooser fixes 2011-07-19 22:02:34 +02:00
fox
fea4e54b10 added theme chooser 2011-07-19 21:47:26 +02:00
Jake Bell
edcd4f7eea Adding quotes to deal with paths that have spaces. 2011-07-17 13:01:48 -05:00
vguerci
7c9474508c [upgrade] before init (no reload needed unless oh-my-zsh.sh has been modified) 2011-06-04 11:52:13 +02:00
Andrew Hodges
0c41b1cdc3 Colorize Install & Upgrade Scripts
Make tools/install.sh and tools/upgrade.sh pretty.
2011-06-03 14:05:25 -04:00
nebirhos
626fa5b1d8 fixed autoupdate 2011-04-29 17:12:40 +02:00
Arthur Kalmenson
1354eb1248 Changed to use which. 2011-04-18 22:51:28 -04:00
Arthur Kalmenson
5f415c465a Change URL to https since most corporate environments block git port. 2011-04-18 07:50:14 -04:00
Arthur Kalmenson
1e2152fcf3 Make the chsh more reliable. 2011-04-18 07:48:35 -04:00
Tristan Carel
bbf1f87ee6 Fix version parsing. Now working with command $ zsh --version 2011-04-13 17:24:44 +02:00
Tristan Carel
ca4dabb45e New tool require_tool.sh 2011-04-13 17:23:25 +02:00
Christopher Chow
cc90e3aa06 Fixed auto update.
Paramater substitution instead of command subsitution was being used
causing the calculation of time since last check to be incorrect.
2011-02-04 11:33:20 +11:00
Robby Russell
aeabc3f616 Switching to /usr/bin/env zsh instead of /bin/zsh in the installer 2010-08-19 08:04:18 -07:00
Robby Russell
59bfd87e08 Adding some candy to the upgrade script 2010-06-03 13:01:41 -07:00
Robby Russell
5a3bde78d8 Sprinkling some candy on this muffin. 2010-05-07 15:35:03 -07:00
Robby Russell
41f13ccb0a Updating check_for_upgrade script to fix issue when the LAST_EPOCH file/value got corrupted. Closes #32 2009-12-12 13:45:30 -08:00
Toon Claes
886d97f41e Removed useless else 2009-10-16 23:03:50 +02:00
Gerhard Lazu
fafa15676a Replaced source with . 2009-10-11 09:50:08 +01:00
Robby Russell
00a190bc01 Oh My Zsh gets a weekly auto-updater... the future is now! 2009-09-23 17:12:19 -07:00
Robby Russell
700a3f0bad Adding a script to check for upgrades 2009-09-23 17:11:45 -07:00
Robby Russell
b67961d812 Updating install process to copy your current environments PATH and adding it to the bottom of ~/.zshrc. 2009-09-07 09:11:34 -07:00
Robby Russell
fcc1cde56c Updating installer to use the new template file. ~/.zshrc will now be outside of the repository 2009-09-01 07:50:45 -07:00
Robby Russell
1ec8a8848e Adding an upgrade_oh_my_zsh function to... well, upgrade Oh My Zsh 2009-08-31 15:48:09 -07:00
Robby Russell
e1f5c0c703 Adding an uninstaller tool 2009-08-31 15:00:38 -07:00
Robby Russell
13ca4fab1a Changing order of loading zsh at end of install 2009-08-30 18:51:41 -07:00
Robby Russell
684eae38af Attempting to load zsh properly after auto-install 2009-08-30 18:50:09 -07:00
Robby Russell
3ec52a1353 Checking if .zshrc is a file or a symlink. 2009-08-30 18:44:14 -07:00
Robby Russell
71769107db Adding an installer tool 2009-08-30 18:36:11 -07:00