From b1855d243e4aef38adc0db939f25cc12cdc0231e Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 14 Jan 2015 02:33:38 -0700 Subject: [PATCH 01/71] Initial commit --- .gitignore | 28 ++++++++ LICENSE | 202 +++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 2 + 3 files changed, 232 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..59d842b --- /dev/null +++ b/.gitignore @@ -0,0 +1,28 @@ +# Logs +logs +*.log + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directory +# Commenting this out is preferred by some people, see +# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- +node_modules + +# Users Environment Variables +.lock-wscript diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e06d208 --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/README.md b/README.md new file mode 100644 index 0000000..fe55a6b --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# iojs-install-script +A script to install basic development tools for iojs (git, node, gcc, pkg-config, etc) From 1ed3b1934b9711a246fc4d851f40f4ebc5af45f7 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 14 Jan 2015 02:54:25 -0700 Subject: [PATCH 02/71] ChangeLog -> CHANGELOG.md --- setup-ubuntu.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup-ubuntu.bash b/setup-ubuntu.bash index 2a2780a..633e36b 100644 --- a/setup-ubuntu.bash +++ b/setup-ubuntu.bash @@ -50,7 +50,7 @@ if [ -n "${IOJS_VER}" ]; then -o "/tmp/iojs-${IOJS_VER}-linux-${ARCH}.tar.gz" pushd /tmp tar xf /tmp/iojs-${IOJS_VER}-linux-${ARCH}.tar.gz - rm iojs-${IOJS_VER}-linux-x64/{LICENSE,ChangeLog,README.md} + rm iojs-${IOJS_VER}-linux-x64/{LICENSE,CHANGELOG.md,README.md} sudo rsync -a "/tmp/iojs-${IOJS_VER}-linux-${ARCH}/" /usr/local/ sudo chown -R $(whoami) /usr/local fi From aceb40476da07075b2cc0a04cf2010490c1e8564 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 14 Jan 2015 02:57:45 -0700 Subject: [PATCH 03/71] added friendly comment --- setup.bash | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/setup.bash b/setup.bash index 2a5c1e4..ed23560 100644 --- a/setup.bash +++ b/setup.bash @@ -1,5 +1,11 @@ #!/bin/bash +# Installs iojs + dependencies for both Ubuntu and OS X + +# +# See https://github.com/coolaj86/iojs-install-script +# + # curl -fsSL https://example.com/setup.bash | bash # wget -nv https://example.com/setup.bash -O - | bash From 14d64876cce9a61012dbc7b5220abc479783dd0e Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 15 Jan 2015 14:32:21 -0700 Subject: [PATCH 04/71] make fail2ban optional A lot of people are, understandably, under the opinion that it's not *directly* related to io.js / node.js development. I argue that it is since io.js / node.js --- setup-mavericks.bash | 55 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 7 deletions(-) diff --git a/setup-mavericks.bash b/setup-mavericks.bash index 6266c97..482f418 100644 --- a/setup-mavericks.bash +++ b/setup-mavericks.bash @@ -54,12 +54,44 @@ fi # http://www.fail2ban.org/wiki/index.php/HOWTO_Mac_OS_X_Server_(10.5) if [ -z "$(which fail2ban-server | grep fail2ban)" ]; then - echo "installing fail2ban..." - brew install fail2ban - sudo cp -fv /usr/local/opt/fail2ban/*.plist /Library/LaunchDaemons - sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.fail2ban.plist -else - echo "fail2ban already installed" + clear + echo "" + echo "Your server didn't come with fail2ban preinstalled!!!" + echo "Among other things, fail2ban secures ssh so that your server isn't reaped by botnets." + echo "" + echo "Since you're obviosly connecting this computer to a network, you should install fail2ban before continuing" + echo "" + echo "Install fail2ban? [Y/n]" + echo "(if unsure, just hit [enter])" + read INSTALL_FAIL2BAN + if [ "n" == "${INSTALL_FAIL2BAN}" ] || [ "no" == "${INSTALL_FAIL2BAN}" ] || [ "N" == "${INSTALL_FAIL2BAN}" ] || [ "NO" == "${INSTALL_FAIL2BAN}" ]; then + clear + echo "" + echo "I don't think you understand. This is important." + echo "" + echo "Your server will be under constant attack by botnets via ssh." + echo "It only takes a few extra seconds to install and the defaults are adequate for protecting you." + echo "" + echo "Change your mind?" + echo "Ready to install fail2ban? [Y/n]" + read INSTALL_FAIL2BAN + if [ "n" == "${INSTALL_FAIL2BAN}" ] || [ "no" == "${INSTALL_FAIL2BAN}" ] || [ "N" == "${INSTALL_FAIL2BAN}" ] || [ "NO" == "${INSTALL_FAIL2BAN}" ]; then + clear + echo "you make me sad :-(" + sleep 0.5 + echo "but whatever, it's your funeral..." + sleep 1 + else + echo "Phew, dodged the bullet on that one... Installing fail2ban.. :-)" + brew install fail2ban + sudo cp -fv /usr/local/opt/fail2ban/*.plist /Library/LaunchDaemons + sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.fail2ban.plist + fi + else + brew install fail2ban + sudo cp -fv /usr/local/opt/fail2ban/*.plist /Library/LaunchDaemons + sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.fail2ban.plist + fi fi if [ -z "$(which pkg-config | grep pkg-config)" ]; then @@ -70,12 +102,21 @@ else fi # iojs -if [ -n "$(which iojs | grep iojs 2>/dev/null)" ]; then +if [ -n "$(which node | grep node 2>/dev/null)" ]; then IOJS_VER="" + if [ "$(node -v 2>/dev/null)" != "$(iojs -v 2>/dev/null)" ]; then + echo "You have node.js installed. Backing up $(which node) as $(which node).joyent" + echo "(you can move it back after the install if you want separate node.js and io.js installations)" + echo "" + echo sudo mv "$(which node)" "$(which node).joyent" + sudo mv "$(which node)" "$(which node).joyent" + fi + if [ "${IOJS_VER}" == "$(iojs -v 2>/dev/null)" ]; then echo iojs ${IOJS_VER} already installed else + clear echo "" echo "HEY, LISTEN:" echo "io.js is already installed as iojs $(iojs -v | grep v)" From 6433047dabdc266fcbe8717eb87765b474491ff8 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 15 Jan 2015 14:34:11 -0700 Subject: [PATCH 05/71] Update setup-ubuntu.bash --- setup-ubuntu.bash | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/setup-ubuntu.bash b/setup-ubuntu.bash index 633e36b..70c25f7 100644 --- a/setup-ubuntu.bash +++ b/setup-ubuntu.bash @@ -24,12 +24,21 @@ then fi # iojs -if [ -n "$(which iojs | grep iojs 2>/dev/null)" ]; then +if [ -n "$(which node | grep node 2>/dev/null)" ]; then IOJS_VER="" - + + if [ "$(node -v 2>/dev/null)" != "$(iojs -v 2>/dev/null)" ]; then + echo "You have node.js installed. Backing up $(which node) as $(which node).joyent" + echo "(you can move it back after the install if you want separate node.js and io.js installations)" + echo "" + echo sudo mv "$(which node)" "$(which node).joyent" + sudo mv "$(which node)" "$(which node).joyent" + fi + if [ "${IOJS_VER}" == "$(iojs -v 2>/dev/null)" ]; then echo iojs ${IOJS_VER} already installed else + clear echo "" echo "HEY, LISTEN:" echo "io.js is already installed as iojs $(iojs -v | grep v)" From 220530a675c1f56c5cfaec022c7728d97f02c12c Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 15 Jan 2015 14:39:53 -0700 Subject: [PATCH 06/71] Update setup-ubuntu.bash --- setup-ubuntu.bash | 2 -- 1 file changed, 2 deletions(-) diff --git a/setup-ubuntu.bash b/setup-ubuntu.bash index 70c25f7..66b48c3 100644 --- a/setup-ubuntu.bash +++ b/setup-ubuntu.bash @@ -25,8 +25,6 @@ fi # iojs if [ -n "$(which node | grep node 2>/dev/null)" ]; then - IOJS_VER="" - if [ "$(node -v 2>/dev/null)" != "$(iojs -v 2>/dev/null)" ]; then echo "You have node.js installed. Backing up $(which node) as $(which node).joyent" echo "(you can move it back after the install if you want separate node.js and io.js installations)" From 5f316be072215d5b06f2ac712b6c5aacf2f0db5b Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 15 Jan 2015 14:42:39 -0700 Subject: [PATCH 07/71] handle node + iojs --- setup-ubuntu.bash | 1 + 1 file changed, 1 insertion(+) diff --git a/setup-ubuntu.bash b/setup-ubuntu.bash index 66b48c3..867b6c1 100644 --- a/setup-ubuntu.bash +++ b/setup-ubuntu.bash @@ -43,6 +43,7 @@ if [ -n "$(which node | grep node 2>/dev/null)" ]; then echo "" echo "to reinstall please first run: rm $(which iojs)" echo "" + IOJS_VER="" fi fi From 1928941c1bd00ead77f02f8a0a1f3de90b9ed0ea Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 15 Jan 2015 14:43:34 -0700 Subject: [PATCH 08/71] handle node + iojs --- setup-ubuntu.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup-ubuntu.bash b/setup-ubuntu.bash index 867b6c1..7f9bb10 100644 --- a/setup-ubuntu.bash +++ b/setup-ubuntu.bash @@ -35,6 +35,7 @@ if [ -n "$(which node | grep node 2>/dev/null)" ]; then if [ "${IOJS_VER}" == "$(iojs -v 2>/dev/null)" ]; then echo iojs ${IOJS_VER} already installed + IOJS_VER="" else clear echo "" @@ -43,7 +44,6 @@ if [ -n "$(which node | grep node 2>/dev/null)" ]; then echo "" echo "to reinstall please first run: rm $(which iojs)" echo "" - IOJS_VER="" fi fi From 9aba23aec21dc191531ddd468283c1b76daf4043 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 15 Jan 2015 14:50:53 -0700 Subject: [PATCH 09/71] show user that node is already installed --- setup-ubuntu.bash | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/setup-ubuntu.bash b/setup-ubuntu.bash index 7f9bb10..8f9f571 100644 --- a/setup-ubuntu.bash +++ b/setup-ubuntu.bash @@ -26,11 +26,15 @@ fi # iojs if [ -n "$(which node | grep node 2>/dev/null)" ]; then if [ "$(node -v 2>/dev/null)" != "$(iojs -v 2>/dev/null)" ]; then - echo "You have node.js installed. Backing up $(which node) as $(which node).joyent" + clear + echo "HEY, LISTEN!" + echo "" + echo "You have node.js installed. Backing up $(which node) as $(which node).$(node -v)" echo "(you can move it back after the install if you want separate node.js and io.js installations)" echo "" - echo sudo mv "$(which node)" "$(which node).joyent" - sudo mv "$(which node)" "$(which node).joyent" + sleep 3 + echo sudo mv "$(which node)" "$(which node).$(node -v)" + sudo mv "$(which node)" "$(which node).$(node -v)" fi if [ "${IOJS_VER}" == "$(iojs -v 2>/dev/null)" ]; then From 8916e4501ada4b4b6abd6917d733fdcb7ba20fa6 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 15 Jan 2015 15:01:58 -0700 Subject: [PATCH 10/71] handle node + iojs --- setup-ubuntu.bash | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/setup-ubuntu.bash b/setup-ubuntu.bash index 8f9f571..8067add 100644 --- a/setup-ubuntu.bash +++ b/setup-ubuntu.bash @@ -23,32 +23,38 @@ then sudo bash -c "apt-get install -qq -y git wget curl build-essential rsync pkg-config < /dev/null" > /dev/null 2>/dev/null fi -# iojs -if [ -n "$(which node | grep node 2>/dev/null)" ]; then - if [ "$(node -v 2>/dev/null)" != "$(iojs -v 2>/dev/null)" ]; then - clear - echo "HEY, LISTEN!" - echo "" - echo "You have node.js installed. Backing up $(which node) as $(which node).$(node -v)" - echo "(you can move it back after the install if you want separate node.js and io.js installations)" - echo "" - sleep 3 - echo sudo mv "$(which node)" "$(which node).$(node -v)" - sudo mv "$(which node)" "$(which node).$(node -v)" - fi - +# +# iojs +# +if [ -n "$(which iojs | grep iojs 2>/dev/null)" ]; then +# iojs of some version is already installed if [ "${IOJS_VER}" == "$(iojs -v 2>/dev/null)" ]; then echo iojs ${IOJS_VER} already installed IOJS_VER="" else - clear - echo "" echo "HEY, LISTEN:" + echo "" echo "io.js is already installed as iojs $(iojs -v | grep v)" echo "" echo "to reinstall please first run: rm $(which iojs)" echo "" fi +elif [ "$(node -v 2>/dev/null)" != "$(iojs -v 2>/dev/null)" ]; then +# node of some version is already installed + echo "" + echo "################################################################################" + echo "" + echo "HEY, LISTEN!" + echo "" + echo "You have node.js installed." + echo "Backing up $(which node) as $(which node).$(node -v)" + echo "(copy it back after the install if to maintain node.js and io.js separately)" + echo "" + echo sudo mv "$(which node)" "$(which node).$(node -v)" + sudo mv "$(which node)" "$(which node).$(node -v)" + sleep 3 + echo "################################################################################" + echo "" fi if [ -n "${IOJS_VER}" ]; then From b44332e44db7731f4fe5e6383e6b28dca1fc8028 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 15 Jan 2015 15:04:14 -0700 Subject: [PATCH 11/71] handle node + iojs --- setup-ubuntu.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup-ubuntu.bash b/setup-ubuntu.bash index 8067add..6dddd56 100644 --- a/setup-ubuntu.bash +++ b/setup-ubuntu.bash @@ -51,8 +51,8 @@ elif [ "$(node -v 2>/dev/null)" != "$(iojs -v 2>/dev/null)" ]; then echo "(copy it back after the install if to maintain node.js and io.js separately)" echo "" echo sudo mv "$(which node)" "$(which node).$(node -v)" - sudo mv "$(which node)" "$(which node).$(node -v)" sleep 3 + sudo mv "$(which node)" "$(which node).$(node -v)" echo "################################################################################" echo "" fi From e013693961bffeac61104163ae62833f628e63ee Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 15 Jan 2015 15:41:04 -0700 Subject: [PATCH 12/71] refactor --- setup-deps-mavericks.bash | 69 +++++++++++++++ setup-deps-ubuntu.bash | 26 ++++++ setup-iojs-mavericks.bash | 10 +++ setup-iojs-ubuntu.bash | 20 +++++ setup-mavericks.bash | 134 ---------------------------- setup-ubuntu.bash | 74 ---------------- setup.bash | 180 +++++++++++++++++++++++++++++++------- 7 files changed, 272 insertions(+), 241 deletions(-) create mode 100644 setup-deps-mavericks.bash create mode 100644 setup-deps-ubuntu.bash create mode 100644 setup-iojs-mavericks.bash create mode 100644 setup-iojs-ubuntu.bash delete mode 100644 setup-mavericks.bash delete mode 100644 setup-ubuntu.bash diff --git a/setup-deps-mavericks.bash b/setup-deps-mavericks.bash new file mode 100644 index 0000000..7415946 --- /dev/null +++ b/setup-deps-mavericks.bash @@ -0,0 +1,69 @@ +#!/bin/bash + +# curl -fsSL https://ldsconnect.org/setup-osx.bash | bash -c +NO_FAIL2BAN=${1} + +echo "" +echo "" + +# XCode +# testing for which git, gcc, etc will not work because the tools are aliased to the install script +if [ -z "$(xcode-select --print-path 2>/dev/null)" ] || [ -z "$(git --version 2>/dev/null)" ]; then + echo "Hey You!!!" + echo "" + echo "A thingy is going to pop up and ask you to install 'command line developer tools' for 'xcode-select'" + echo "" + echo "You need to click Install. This installation should begin when that finishes." + echo "(if that box doesn't pop up in a second or two, something went wrong)" + echo "(note that it may pop up underneath this window, so check for it in the dock too)" + echo "" + + xcode-select --install 2>/dev/null + + while true; do + sleep 5 + + if [ -n "$(git --version 2>/dev/null)" ] && [ -n "$(xcode-select --print-path 2>/dev/null)" ]; then + break; + fi + done + + echo "It looks like the other install is finishing up." + echo "This installation will begin in one minute." + sleep 60 +else + echo "XCode Command Line Tools already installed" +fi + +# homebrew +if [ -z "$(which brew | grep brew)" ]; then + echo "installing brew (homebrew)..." + ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" + brew doctor +else + echo "updating brew..." + brew update >/dev/null 2>/dev/null +fi + +if [ -z "$(which wget | grep wget)" ]; then + echo "installing wget..." + brew install wget +else + echo "wget already installed" +fi + +# http://www.fail2ban.org/wiki/index.php/HOWTO_Mac_OS_X_Server_(10.5) +if [ -z "$(which fail2ban-server | grep fail2ban)" ]; then + if [ -z "${NO_FAIL2BAN}" ]; then + brew install fail2ban + sudo cp -fv /usr/local/opt/fail2ban/*.plist /Library/LaunchDaemons + sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.fail2ban.plist + fi +fi + +if [ -z "$(which pkg-config | grep pkg-config)" ]; then + echo "installing pkg-config..." + brew install pkg-config +else + echo "pkg-config already installed" +fi diff --git a/setup-deps-ubuntu.bash b/setup-deps-ubuntu.bash new file mode 100644 index 0000000..cd68b75 --- /dev/null +++ b/setup-deps-ubuntu.bash @@ -0,0 +1,26 @@ +#!/bin/bash + +# curl -fsSL https://ldsconnect.org/setup-linux.bash | bash -c + +NO_FAIL2BAN=${1} + +echo "" +echo "" + +echo "updating apt-get..." +sudo bash -c "apt-get update -qq -y < /dev/null" > /dev/null + +# fail2ban +if [ -z "$(which fail2ban-server | grep fail2ban)" ]; then + if [ -z "${NO_FAIL2BAN}" ]; then + echo "installing fail2ban..." + sudo bash -c "apt-get install -qq -y fail2ban < /dev/null" > /dev/null + fi +fi + +# git, wget, curl, build-essential +if [ -z "$(which pkg-config | grep pkg-config)" ] || [ -z "$(which git | grep git)" ] || [ -z "$(which wget | grep wget)" ] || [ -z "$(which curl | grep curl)" ] || [ -z "$(which gcc | grep gcc)" ] || [ -z "$(which rsync | grep rsync)" ] +then + echo "installing git, wget, curl, build-essential, rsync, pkg-config..." + sudo bash -c "apt-get install -qq -y git wget curl build-essential rsync pkg-config < /dev/null" > /dev/null 2>/dev/null +fi diff --git a/setup-iojs-mavericks.bash b/setup-iojs-mavericks.bash new file mode 100644 index 0000000..0770fd9 --- /dev/null +++ b/setup-iojs-mavericks.bash @@ -0,0 +1,10 @@ +IOJS_VER=${1} + +if [ -n "${IOJS_VER}" ]; then + echo "installing io.js as iojs ${IOJS_VER}..." + curl -fsSL "http://iojs.org/dist/${IOJS_VER}/iojs-${IOJS_VER}.pkg" -o "/tmp/iojs-${IOJS_VER}.pkg" + sudo /usr/sbin/installer -pkg "/tmp/iojs-${IOJS_VER}.pkg" -target / + + + sudo chown -R $(whoami) /usr/local 2>/dev/null +fi diff --git a/setup-iojs-ubuntu.bash b/setup-iojs-ubuntu.bash new file mode 100644 index 0000000..baa3f62 --- /dev/null +++ b/setup-iojs-ubuntu.bash @@ -0,0 +1,20 @@ +IOJS_VER=${1} + +if [ -n "$(arch | grep 64)" ]; then + ARCH="x64" +else + ARCH="x86" +fi + +if [ -n "${IOJS_VER}" ]; then + echo "installing io.js as iojs ${IOJS_VER}..." + curl -fsSL "http://iojs.org/dist/${IOJS_VER}/iojs-${IOJS_VER}-linux-${ARCH}.tar.gz" \ + -o "/tmp/iojs-${IOJS_VER}-linux-${ARCH}.tar.gz" + pushd /tmp + tar xf /tmp/iojs-${IOJS_VER}-linux-${ARCH}.tar.gz + rm iojs-${IOJS_VER}-linux-x64/{LICENSE,CHANGELOG.md,README.md} + sudo rsync -a "/tmp/iojs-${IOJS_VER}-linux-${ARCH}/" /usr/local/ + + + sudo chown -R $(whoami) /usr/local +fi diff --git a/setup-mavericks.bash b/setup-mavericks.bash deleted file mode 100644 index 482f418..0000000 --- a/setup-mavericks.bash +++ /dev/null @@ -1,134 +0,0 @@ -#!/bin/bash - -# curl -fsSL https://ldsconnect.org/setup-osx.bash | bash -c -IOJS_VER=${1} - -echo "" -echo "" - -# XCode -# testing for which git, gcc, etc will not work because the tools are aliased to the install script -if [ -z "$(xcode-select --print-path 2>/dev/null)" ] || [ -z "$(git --version 2>/dev/null)" ]; then - echo "Hey You!!!" - echo "" - echo "A thingy is going to pop up and ask you to install 'command line developer tools' for 'xcode-select'" - echo "" - echo "You need to click Install. This installation should begin when that finishes." - echo "(if that box doesn't pop up in a second or two, something went wrong)" - echo "(note that it may pop up underneath this window, so check for it in the dock too)" - echo "" - - xcode-select --install 2>/dev/null - - while true; do - sleep 5 - - if [ -n "$(git --version 2>/dev/null)" ] && [ -n "$(xcode-select --print-path 2>/dev/null)" ]; then - break; - fi - done - - echo "It looks like the other install is finishing up." - echo "This installation will begin in one minute." - sleep 60 -else - echo "XCode Command Line Tools already installed" -fi - -# homebrew -if [ -z "$(which brew | grep brew)" ]; then - echo "installing brew (homebrew)..." - ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" - brew doctor -else - echo "updating brew..." - brew update >/dev/null 2>/dev/null -fi - -if [ -z "$(which wget | grep wget)" ]; then - echo "installing wget..." - brew install wget -else - echo "wget already installed" -fi - -# http://www.fail2ban.org/wiki/index.php/HOWTO_Mac_OS_X_Server_(10.5) -if [ -z "$(which fail2ban-server | grep fail2ban)" ]; then - clear - echo "" - echo "Your server didn't come with fail2ban preinstalled!!!" - echo "Among other things, fail2ban secures ssh so that your server isn't reaped by botnets." - echo "" - echo "Since you're obviosly connecting this computer to a network, you should install fail2ban before continuing" - echo "" - echo "Install fail2ban? [Y/n]" - echo "(if unsure, just hit [enter])" - read INSTALL_FAIL2BAN - if [ "n" == "${INSTALL_FAIL2BAN}" ] || [ "no" == "${INSTALL_FAIL2BAN}" ] || [ "N" == "${INSTALL_FAIL2BAN}" ] || [ "NO" == "${INSTALL_FAIL2BAN}" ]; then - clear - echo "" - echo "I don't think you understand. This is important." - echo "" - echo "Your server will be under constant attack by botnets via ssh." - echo "It only takes a few extra seconds to install and the defaults are adequate for protecting you." - echo "" - echo "Change your mind?" - echo "Ready to install fail2ban? [Y/n]" - read INSTALL_FAIL2BAN - if [ "n" == "${INSTALL_FAIL2BAN}" ] || [ "no" == "${INSTALL_FAIL2BAN}" ] || [ "N" == "${INSTALL_FAIL2BAN}" ] || [ "NO" == "${INSTALL_FAIL2BAN}" ]; then - clear - echo "you make me sad :-(" - sleep 0.5 - echo "but whatever, it's your funeral..." - sleep 1 - else - echo "Phew, dodged the bullet on that one... Installing fail2ban.. :-)" - brew install fail2ban - sudo cp -fv /usr/local/opt/fail2ban/*.plist /Library/LaunchDaemons - sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.fail2ban.plist - fi - else - brew install fail2ban - sudo cp -fv /usr/local/opt/fail2ban/*.plist /Library/LaunchDaemons - sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.fail2ban.plist - fi -fi - -if [ -z "$(which pkg-config | grep pkg-config)" ]; then - echo "installing pkg-config..." - brew install pkg-config -else - echo "pkg-config already installed" -fi - -# iojs -if [ -n "$(which node | grep node 2>/dev/null)" ]; then - IOJS_VER="" - - if [ "$(node -v 2>/dev/null)" != "$(iojs -v 2>/dev/null)" ]; then - echo "You have node.js installed. Backing up $(which node) as $(which node).joyent" - echo "(you can move it back after the install if you want separate node.js and io.js installations)" - echo "" - echo sudo mv "$(which node)" "$(which node).joyent" - sudo mv "$(which node)" "$(which node).joyent" - fi - - if [ "${IOJS_VER}" == "$(iojs -v 2>/dev/null)" ]; then - echo iojs ${IOJS_VER} already installed - else - clear - echo "" - echo "HEY, LISTEN:" - echo "io.js is already installed as iojs $(iojs -v | grep v)" - echo "" - echo "to reinstall please first run: rm $(which iojs)" - echo "" - fi -fi - -if [ -n "${IOJS_VER}" ]; then - echo "installing io.js as iojs ${IOJS_VER}..." - curl -fsSL "http://iojs.org/dist/${IOJS_VER}/iojs-${IOJS_VER}.pkg" -o "/tmp/iojs-${IOJS_VER}.pkg" - sudo /usr/sbin/installer -pkg "/tmp/iojs-${IOJS_VER}.pkg" -target / - sudo chown -R $(whoami) /usr/local 2>/dev/null -fi diff --git a/setup-ubuntu.bash b/setup-ubuntu.bash deleted file mode 100644 index 6dddd56..0000000 --- a/setup-ubuntu.bash +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash - -# curl -fsSL https://ldsconnect.org/setup-linux.bash | bash -c - -IOJS_VER=${1} - -echo "" -echo "" - -echo "updating apt-get..." -sudo bash -c "apt-get update -qq -y < /dev/null" > /dev/null - -# fail2ban -if [ -z "$(which fail2ban-server | grep fail2ban)" ]; then - echo "installing fail2ban..." - sudo bash -c "apt-get install -qq -y fail2ban < /dev/null" > /dev/null -fi - -# git, wget, curl, build-essential -if [ -z "$(which pkg-config | grep pkg-config)" ] || [ -z "$(which git | grep git)" ] || [ -z "$(which wget | grep wget)" ] || [ -z "$(which curl | grep curl)" ] || [ -z "$(which gcc | grep gcc)" ] || [ -z "$(which rsync | grep rsync)" ] -then - echo "installing git, wget, curl, build-essential, rsync, pkg-config..." - sudo bash -c "apt-get install -qq -y git wget curl build-essential rsync pkg-config < /dev/null" > /dev/null 2>/dev/null -fi - -# -# iojs -# -if [ -n "$(which iojs | grep iojs 2>/dev/null)" ]; then -# iojs of some version is already installed - if [ "${IOJS_VER}" == "$(iojs -v 2>/dev/null)" ]; then - echo iojs ${IOJS_VER} already installed - IOJS_VER="" - else - echo "HEY, LISTEN:" - echo "" - echo "io.js is already installed as iojs $(iojs -v | grep v)" - echo "" - echo "to reinstall please first run: rm $(which iojs)" - echo "" - fi -elif [ "$(node -v 2>/dev/null)" != "$(iojs -v 2>/dev/null)" ]; then -# node of some version is already installed - echo "" - echo "################################################################################" - echo "" - echo "HEY, LISTEN!" - echo "" - echo "You have node.js installed." - echo "Backing up $(which node) as $(which node).$(node -v)" - echo "(copy it back after the install if to maintain node.js and io.js separately)" - echo "" - echo sudo mv "$(which node)" "$(which node).$(node -v)" - sleep 3 - sudo mv "$(which node)" "$(which node).$(node -v)" - echo "################################################################################" - echo "" -fi - -if [ -n "${IOJS_VER}" ]; then - if [ -n "$(arch | grep 64)" ]; then - ARCH="x64" - else - ARCH="x86" - fi - echo "installing io.js as iojs ${IOJS_VER}..." - curl -fsSL "http://iojs.org/dist/${IOJS_VER}/iojs-${IOJS_VER}-linux-${ARCH}.tar.gz" \ - -o "/tmp/iojs-${IOJS_VER}-linux-${ARCH}.tar.gz" - pushd /tmp - tar xf /tmp/iojs-${IOJS_VER}-linux-${ARCH}.tar.gz - rm iojs-${IOJS_VER}-linux-x64/{LICENSE,CHANGELOG.md,README.md} - sudo rsync -a "/tmp/iojs-${IOJS_VER}-linux-${ARCH}/" /usr/local/ - sudo chown -R $(whoami) /usr/local -fi diff --git a/setup.bash b/setup.bash index ed23560..f30d9e0 100644 --- a/setup.bash +++ b/setup.bash @@ -10,24 +10,19 @@ # wget -nv https://example.com/setup.bash -O - | bash BASE_URL="https://raw.githubusercontent.com/coolaj86/iojs-install-script/master" - -if [ -n "$(which iojs 2>/dev/null || false)" ]; then - echo "" - echo "HEY, LISTEN:" - echo "io.js is already install as iojs $(iojs -v | grep v)" - echo "" - echo "to reinstall please first run: rm $(which iojs)" - echo "" -fi - -if [ -f "/tmp/IOJS_VER" ]; then - IOJS_VER=$(cat /tmp/IOJS_VER | grep v) -fi -if [ -z "$IOJS_VER" ]; then - IOJS_VER="v1.0.1" -fi +NO_FAIL2BAN="" OS="unsupported" ARCH="" +IOJS_VER="" +SETUP_FILE="" + +clear + + + +######################### +# Which OS and version? # +######################### if [ "$(uname | grep -i 'Darwin')" ]; then OSX_VER="$(sw_vers | grep ProductVersion | cut -d':' -f2 | cut -f2)" @@ -81,9 +76,7 @@ if [ "$(uname | grep -i 'Darwin')" ]; then else ARCH="32" fi - elif [ "$(uname | grep -i 'Linux')" ]; then - if [ ! -f "/etc/issue" ]; then echo "unsupported linux os" exit 1 @@ -100,40 +93,37 @@ elif [ "$(uname | grep -i 'Linux')" ]; then elif [ "$(cat /etc/issue | grep -i 'Fedora')" ]; then OS='fedora' fi - else - echo "unsupported unknown os (non-mac, non-linux)" exit 1 - fi case "${OS}" in fedora) - echo "sudo yum" - echo "wget --quiet ${BASE_URL}/setup-fedora.bash -O /tmp/install-iojs.bash || echo 'error downloading os setup script'" + echo "FEDORA not yet supported (feel free to pull request)" + exit 1 ;; ubuntu) - wget --quiet "${BASE_URL}/setup-ubuntu.bash" -O /tmp/install-iojs.bash || echo 'error downloading os setup script' + SETUP_FILE="ubuntu" ;; yosemite) # mavericks - curl --silent "${BASE_URL}/setup-mavericks.bash" -o /tmp/install-iojs.bash || echo 'error downloading os setup script' + SETUP_FILE="mavericks" ;; mavericks) - curl --silent "${BASE_URL}/setup-mavericks.bash" -o /tmp/install-iojs.bash || echo 'error downloading os setup script' + SETUP_FILE="mavericks" ;; mountain) - echo "wget cltools" - echo "curl --silent ${BASE_URL}/setup-mountain.bash -o /tmp/install-iojs.bash || echo 'error downloading os setup script'" + echo "Mountain Lion not yet supported (feel free to pull request)" + exit 1 ;; lion) - echo "wget cltools" - echo "curl --silent ${BASE_URL}/setup-lion.bash -o /tmp/install-iojs.bash || echo 'error downloading os setup script'" + echo "Lion not yet supported (feel free to pull request)" + exit 1 ;; snow) - echo "wget gcc-0.6.pkg" - echo "curl --silent ${BASE_URL}/setup-snow.bash -o /tmp/install-iojs.bash || echo 'error downloading os setup script'" + echo "Snow Leopard not yet supported (feel free to pull request)" + exit 1 ;; *) echo "unsupported unknown os ${OS}" @@ -141,8 +131,132 @@ case "${OS}" in ;; esac + + + +####################### +# Download installers # +####################### + echo "${OS}" "${ARCH}" -bash /tmp/install-iojs.bash "${IOJS_VER}" + +if [ -n "$(which curl)" ]; then + curl --silent "${BASE_URL}/setup-deps-${SETUP_FILE}.bash" \ + -o /tmp/install-iojs-deps.bash || echo 'error downloading os setup script' + curl --silent "${BASE_URL}/setup-iojs-${SETUP_FILE}.bash" \ + -o /tmp/install-iojs.bash || echo 'error downloading os setup script' +elif [ -n "$(which wget)" ]; then + wget --quiet "${BASE_URL}/setup-deps-${SETUP_FILE}.bash" \ + -O /tmp/install-iojs-deps.bash || echo 'error downloading os setup script' + wget --quiet "${BASE_URL}/setup-iojs-${SETUP_FILE}.bash" \ + -O /tmp/install-iojs.bash || echo 'error downloading os setup script' +else + echo "Found neither 'curl' nor 'wget'. Can't Continue." + exit 1 +fi + + + + +################ +# DEPENDENCIES # +################ + +if [ -z "$(which fail2ban-server | grep fail2ban)" ]; then + echo "" + echo "Your server didn't come with fail2ban preinstalled!!!" + echo "Among other things, fail2ban secures ssh so that your server isn't reaped by botnets." + echo "" + echo "Since you're obviosly connecting this computer to a network, you should install fail2ban before continuing" + echo "" + echo "Install fail2ban? [Y/n]" + echo "(if unsure, just hit [enter])" + read INSTALL_FAIL2BAN + + if [ "n" == "${INSTALL_FAIL2BAN}" ] || [ "no" == "${INSTALL_FAIL2BAN}" ] || [ "N" == "${INSTALL_FAIL2BAN}" ] || [ "NO" == "${INSTALL_FAIL2BAN}" ]; then + echo "" + echo "I don't think you understand: This is important." + echo "" + echo "Your server will be under constant attack by botnets via ssh." + echo "It only takes a few extra seconds to install and the defaults are adequate for protecting you." + echo "" + echo "Change your mind?" + echo "Ready to install fail2ban? [Y/n]" + read INSTALL_FAIL2BAN + if [ "n" == "${INSTALL_FAIL2BAN}" ] || [ "no" == "${INSTALL_FAIL2BAN}" ] || [ "N" == "${INSTALL_FAIL2BAN}" ] || [ "NO" == "${INSTALL_FAIL2BAN}" ]; then + clear + echo "you make me sad :-(" + sleep 0.5 + echo "but whatever, it's your funeral..." + sleep 1 + NO_FAIL2BAN="nope" + else + echo "Phew, dodged the bullet on that one... Will install fail2ban.. :-)" + fi + fi +fi + +bash /tmp/install-iojs-deps.bash "${NO_FAIL2BAN}" + +######################### +# Which io.js VERSION ? # +######################### + +if [ -f "/tmp/IOJS_VER" ]; then + IOJS_VER=$(cat /tmp/IOJS_VER | grep v) +fi + +if [ -z "$IOJS_VER" ]; then + IOJS_VER="v1.0.1" +fi + +if [ -n "$(which iojs 2>/dev/null || false)" ]; then + echo "" + echo "HEY, LISTEN:" + echo "io.js is already install as iojs $(iojs -v | grep v)" + echo "" + echo "to reinstall please first run:" + echo "sudo mv '$(which iojs)' '$(which iojs).$(iojs -v)'" + echo "" +fi + +# +# iojs +# +if [ -n "$(which iojs | grep iojs 2>/dev/null)" ]; then +# iojs of some version is already installed + if [ "${IOJS_VER}" == "$(iojs -v 2>/dev/null)" ]; then + echo iojs ${IOJS_VER} already installed + else + echo "HEY, LISTEN:" + echo "" + echo "io.js is already installed as iojs $(iojs -v | grep v)" + echo "" + echo "to reinstall please first run: rm $(which iojs)" + echo "" + fi + IOJS_VER="" +elif [ "$(node -v 2>/dev/null)" != "$(iojs -v 2>/dev/null)" ]; then +# node of some version is already installed + echo "" + echo "################################################################################" + echo "" + echo "HEY, LISTEN!" + echo "" + echo "You have node.js installed." + echo "Backing up $(which node) as $(which node).$(node -v)" + echo "(copy it back after the install if to maintain node.js and io.js separately)" + echo "" + echo sudo mv "$(which node)" "$(which node).$(node -v)" + sleep 3 + sudo mv "$(which node)" "$(which node).$(node -v)" + echo "################################################################################" + echo "" +fi + +if [ -n "${IOJS_VER}" ]; then + bash /tmp/install-iojs.bash "${IOJS_VER}" +fi # jshint if [ -z "$(which jshint | grep jshint)" ]; then From 0ff11fbf72d614ee2189b8ba08e46445fa7ad849 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 15 Jan 2015 15:43:34 -0700 Subject: [PATCH 13/71] no output for pushd --- setup-iojs-ubuntu.bash | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup-iojs-ubuntu.bash b/setup-iojs-ubuntu.bash index baa3f62..f8b7911 100644 --- a/setup-iojs-ubuntu.bash +++ b/setup-iojs-ubuntu.bash @@ -8,9 +8,10 @@ fi if [ -n "${IOJS_VER}" ]; then echo "installing io.js as iojs ${IOJS_VER}..." + curl -fsSL "http://iojs.org/dist/${IOJS_VER}/iojs-${IOJS_VER}-linux-${ARCH}.tar.gz" \ -o "/tmp/iojs-${IOJS_VER}-linux-${ARCH}.tar.gz" - pushd /tmp + pushd /tmp >/dev/null tar xf /tmp/iojs-${IOJS_VER}-linux-${ARCH}.tar.gz rm iojs-${IOJS_VER}-linux-x64/{LICENSE,CHANGELOG.md,README.md} sudo rsync -a "/tmp/iojs-${IOJS_VER}-linux-${ARCH}/" /usr/local/ From 8a6a7ed83ad358afaea375d98b68b630ab1df829 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 15 Jan 2015 15:52:35 -0700 Subject: [PATCH 14/71] better output --- setup-deps-mavericks.bash | 13 +++++++------ setup-deps-ubuntu.bash | 9 +++++++++ setup.bash | 24 ++++++------------------ 3 files changed, 22 insertions(+), 24 deletions(-) diff --git a/setup-deps-mavericks.bash b/setup-deps-mavericks.bash index 7415946..b232b01 100644 --- a/setup-deps-mavericks.bash +++ b/setup-deps-mavericks.bash @@ -5,6 +5,13 @@ NO_FAIL2BAN=${1} echo "" echo "" +echo "Checking for" +echo "" +echo " * XCode Command Line Tools" +echo " * wget" +echo " * pkg-config" +echo " * jshint" +echo "" # XCode # testing for which git, gcc, etc will not work because the tools are aliased to the install script @@ -31,8 +38,6 @@ if [ -z "$(xcode-select --print-path 2>/dev/null)" ] || [ -z "$(git --version 2> echo "It looks like the other install is finishing up." echo "This installation will begin in one minute." sleep 60 -else - echo "XCode Command Line Tools already installed" fi # homebrew @@ -48,8 +53,6 @@ fi if [ -z "$(which wget | grep wget)" ]; then echo "installing wget..." brew install wget -else - echo "wget already installed" fi # http://www.fail2ban.org/wiki/index.php/HOWTO_Mac_OS_X_Server_(10.5) @@ -64,6 +67,4 @@ fi if [ -z "$(which pkg-config | grep pkg-config)" ]; then echo "installing pkg-config..." brew install pkg-config -else - echo "pkg-config already installed" fi diff --git a/setup-deps-ubuntu.bash b/setup-deps-ubuntu.bash index cd68b75..fbd3e31 100644 --- a/setup-deps-ubuntu.bash +++ b/setup-deps-ubuntu.bash @@ -6,6 +6,15 @@ NO_FAIL2BAN=${1} echo "" echo "" +echo "Checking for" +echo "" +echo " * build-essential" +echo " * rsync" +echo " * wget" +echo " * curl" +echo " * pkg-config" +echo " * jshint" +echo "" echo "updating apt-get..." sudo bash -c "apt-get update -qq -y < /dev/null" > /dev/null diff --git a/setup.bash b/setup.bash index f30d9e0..9deb3f4 100644 --- a/setup.bash +++ b/setup.bash @@ -138,7 +138,7 @@ esac # Download installers # ####################### -echo "${OS}" "${ARCH}" +echo "Preparing to install io.js (and common development dependencies) for ${OS}" "${ARCH}" if [ -n "$(which curl)" ]; then curl --silent "${BASE_URL}/setup-deps-${SETUP_FILE}.bash" \ @@ -210,24 +210,15 @@ if [ -z "$IOJS_VER" ]; then IOJS_VER="v1.0.1" fi -if [ -n "$(which iojs 2>/dev/null || false)" ]; then - echo "" - echo "HEY, LISTEN:" - echo "io.js is already install as iojs $(iojs -v | grep v)" - echo "" - echo "to reinstall please first run:" - echo "sudo mv '$(which iojs)' '$(which iojs).$(iojs -v)'" - echo "" -fi - # # iojs # if [ -n "$(which iojs | grep iojs 2>/dev/null)" ]; then # iojs of some version is already installed if [ "${IOJS_VER}" == "$(iojs -v 2>/dev/null)" ]; then - echo iojs ${IOJS_VER} already installed + echo iojs ${IOJS_VER} is already installed else + echo "" echo "HEY, LISTEN:" echo "" echo "io.js is already installed as iojs $(iojs -v | grep v)" @@ -238,8 +229,6 @@ if [ -n "$(which iojs | grep iojs 2>/dev/null)" ]; then IOJS_VER="" elif [ "$(node -v 2>/dev/null)" != "$(iojs -v 2>/dev/null)" ]; then # node of some version is already installed - echo "" - echo "################################################################################" echo "" echo "HEY, LISTEN!" echo "" @@ -247,10 +236,11 @@ elif [ "$(node -v 2>/dev/null)" != "$(iojs -v 2>/dev/null)" ]; then echo "Backing up $(which node) as $(which node).$(node -v)" echo "(copy it back after the install if to maintain node.js and io.js separately)" echo "" - echo sudo mv "$(which node)" "$(which node).$(node -v)" sleep 3 - sudo mv "$(which node)" "$(which node).$(node -v)" echo "################################################################################" + echo sudo mv "$(which node)" "$(which node).$(node -v)" + echo "################################################################################" + sudo mv "$(which node)" "$(which node).$(node -v)" echo "" fi @@ -262,8 +252,6 @@ fi if [ -z "$(which jshint | grep jshint)" ]; then echo "installing jshint..." npm install --silent jshint -g > /dev/null -else - echo "jshint already installed" fi echo "" From a737667301f4b659443bfe46f751b58033c8c39b Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 15 Jan 2015 15:53:55 -0700 Subject: [PATCH 15/71] better output --- setup-deps-mavericks.bash | 2 ++ setup-deps-ubuntu.bash | 2 ++ 2 files changed, 4 insertions(+) diff --git a/setup-deps-mavericks.bash b/setup-deps-mavericks.bash index b232b01..3c17651 100644 --- a/setup-deps-mavericks.bash +++ b/setup-deps-mavericks.bash @@ -10,6 +10,8 @@ echo "" echo " * XCode Command Line Tools" echo " * wget" echo " * pkg-config" +echo " * node" +echo " * iojs" echo " * jshint" echo "" diff --git a/setup-deps-ubuntu.bash b/setup-deps-ubuntu.bash index fbd3e31..9d38e22 100644 --- a/setup-deps-ubuntu.bash +++ b/setup-deps-ubuntu.bash @@ -13,6 +13,8 @@ echo " * rsync" echo " * wget" echo " * curl" echo " * pkg-config" +echo " * node" +echo " * iojs" echo " * jshint" echo "" From ee45e9d885e94c0e173d3f9f358e9c9d99ca99e6 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 15 Jan 2015 15:57:43 -0700 Subject: [PATCH 16/71] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e764c53..fd47550 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,6 @@ wget -nv bit.ly/install-iojs -O - | bash This is what gets installed: -* fail2ban (not necessary for development, but should be on every server) * rsync * curl * wget @@ -29,6 +28,8 @@ This is what gets installed: * iojs (including npm and node symlink) * jshint +If `fail2ban` is not already securing ssh, you will be asked to install it. + Screencast ========== From 6bb1b6a612da8e9049b1e7dc6862934e88ac70b6 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 15 Jan 2015 15:59:12 -0700 Subject: [PATCH 17/71] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fd47550..dcedcd6 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ A script to install basic development tools for iojs (git, iojs, gcc, pkg-config Works for any recent version of Ubuntu or OS X. +**NOTE**: If you have node installed, this script will rename it so that it isn't overwritten by the iojs installer. + ```bash # Specify the version of iojs to install echo "v1.0.1" > /tmp/IOJS_VER @@ -28,7 +30,7 @@ This is what gets installed: * iojs (including npm and node symlink) * jshint -If `fail2ban` is not already securing ssh, you will be asked to install it. +**NOTE**: If `fail2ban` is not already securing ssh, you will be asked to install it. Screencast ========== From 158d114aebabd8998dc9d0284acf2f667ed6ba2f Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 15 Jan 2015 15:59:32 -0700 Subject: [PATCH 18/71] Update README.md --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dcedcd6..be014fd 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,6 @@ A script to install basic development tools for iojs (git, iojs, gcc, pkg-config Works for any recent version of Ubuntu or OS X. -**NOTE**: If you have node installed, this script will rename it so that it isn't overwritten by the iojs installer. - ```bash # Specify the version of iojs to install echo "v1.0.1" > /tmp/IOJS_VER @@ -14,6 +12,9 @@ echo "v1.0.1" > /tmp/IOJS_VER curl -fsSL bit.ly/install-iojs | bash ``` +**NOTE**: If you have node installed, this script will rename it so that it isn't overwritten by the iojs installer. + + **For older versions of Ubuntu**: ```bash From 6defb38f854c28b9fc5f7d51e0643c55e83a9fc9 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 15 Jan 2015 16:01:15 -0700 Subject: [PATCH 19/71] typo fix --- setup.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.bash b/setup.bash index 9deb3f4..94ae782 100644 --- a/setup.bash +++ b/setup.bash @@ -234,7 +234,7 @@ elif [ "$(node -v 2>/dev/null)" != "$(iojs -v 2>/dev/null)" ]; then echo "" echo "You have node.js installed." echo "Backing up $(which node) as $(which node).$(node -v)" - echo "(copy it back after the install if to maintain node.js and io.js separately)" + echo "(copy it back after the install to maintain node.js and io.js separately)" echo "" sleep 3 echo "################################################################################" From 984b6135f7dc88ff40057a0a07e54219771e3fda Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 15 Jan 2015 16:05:06 -0700 Subject: [PATCH 20/71] make restoring node more clear --- setup.bash | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/setup.bash b/setup.bash index 94ae782..7c37f09 100644 --- a/setup.bash +++ b/setup.bash @@ -237,10 +237,11 @@ elif [ "$(node -v 2>/dev/null)" != "$(iojs -v 2>/dev/null)" ]; then echo "(copy it back after the install to maintain node.js and io.js separately)" echo "" sleep 3 - echo "################################################################################" echo sudo mv "$(which node)" "$(which node).$(node -v)" - echo "################################################################################" sudo mv "$(which node)" "$(which node).$(node -v)" + echo "################################################################################" + echo "to restore backup: sudo rsync -a '$(which node).$(node -v)' '$(which node)' + echo "################################################################################" echo "" fi From 52d1bd8cdcca1a034b8570499e602f3276a16e4f Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 15 Jan 2015 16:07:03 -0700 Subject: [PATCH 21/71] typo fix --- setup.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.bash b/setup.bash index 7c37f09..66e19ec 100644 --- a/setup.bash +++ b/setup.bash @@ -240,7 +240,7 @@ elif [ "$(node -v 2>/dev/null)" != "$(iojs -v 2>/dev/null)" ]; then echo sudo mv "$(which node)" "$(which node).$(node -v)" sudo mv "$(which node)" "$(which node).$(node -v)" echo "################################################################################" - echo "to restore backup: sudo rsync -a '$(which node).$(node -v)' '$(which node)' + echo "to restore backup: sudo rsync -a '$(which node).$(node -v)' '$(which node)'" echo "################################################################################" echo "" fi From 331f4eadb92c70053e147a375cb0afdfc81a9392 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sat, 17 Jan 2015 18:23:25 -0700 Subject: [PATCH 22/71] store node path & ver before moving --- setup.bash | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/setup.bash b/setup.bash index 66e19ec..9cb8454 100644 --- a/setup.bash +++ b/setup.bash @@ -237,8 +237,10 @@ elif [ "$(node -v 2>/dev/null)" != "$(iojs -v 2>/dev/null)" ]; then echo "(copy it back after the install to maintain node.js and io.js separately)" echo "" sleep 3 - echo sudo mv "$(which node)" "$(which node).$(node -v)" - sudo mv "$(which node)" "$(which node).$(node -v)" + NODE_PATH=$(which node) + NODE_VER=$(node -v) + echo sudo mv "$NODE_PATH" "$NODE_PATH.$NODE_VER" + sudo mv "$NODE_PATH" "$NODE_PATH.$NODE_VER" echo "################################################################################" echo "to restore backup: sudo rsync -a '$(which node).$(node -v)' '$(which node)'" echo "################################################################################" From 22d6a12a7f6ad3585a377f785e00b7b191a17f2b Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Mon, 19 Jan 2015 16:59:20 -0700 Subject: [PATCH 23/71] don't run from stdin Running from stdin by piping to bash prevents `read` and other install prompts. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index be014fd..6e2ec66 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Works for any recent version of Ubuntu or OS X. echo "v1.0.1" > /tmp/IOJS_VER # And install away! -curl -fsSL bit.ly/install-iojs | bash +curl -fsSL bit.ly/install-iojs -o /tmp/iojs-dev.bash; bash /tmp/iojs-dev.bash ``` **NOTE**: If you have node installed, this script will rename it so that it isn't overwritten by the iojs installer. From d7c26deaf15d8e9c45bf9da5462ae650c55c25c1 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Mon, 19 Jan 2015 17:06:29 -0700 Subject: [PATCH 24/71] Create setup-min.sh --- setup-min.sh | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 setup-min.sh diff --git a/setup-min.sh b/setup-min.sh new file mode 100644 index 0000000..8772af0 --- /dev/null +++ b/setup-min.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +echo "not implemented yet" From 09322c50aea9c48a6092945d14962eaedd672f93 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Mon, 19 Jan 2015 17:09:36 -0700 Subject: [PATCH 25/71] added iojs-dev and iojs-min --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6e2ec66..2ca1d30 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,12 @@ Works for any recent version of Ubuntu or OS X. echo "v1.0.1" > /tmp/IOJS_VER # And install away! -curl -fsSL bit.ly/install-iojs -o /tmp/iojs-dev.bash; bash /tmp/iojs-dev.bash +curl -fsSL bit.ly/iojs-dev -o /tmp/iojs-dev.bash; bash /tmp/iojs-dev.bash +``` + +``` +# Or if you don't need any development tools +curl -fsSL bit.ly/iojs-min | bash ``` **NOTE**: If you have node installed, this script will rename it so that it isn't overwritten by the iojs installer. From 2e22e92cd9aabcec784211509829c495a2ea72d9 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Mon, 19 Jan 2015 17:18:28 -0700 Subject: [PATCH 26/71] .bash -> .sh (for shortness) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2ca1d30..d51b9e1 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Works for any recent version of Ubuntu or OS X. echo "v1.0.1" > /tmp/IOJS_VER # And install away! -curl -fsSL bit.ly/iojs-dev -o /tmp/iojs-dev.bash; bash /tmp/iojs-dev.bash +curl -fsSL bit.ly/iojs-dev -o /tmp/iojs-dev.sh; bash /tmp/iojs-dev.sh ``` ``` From 3d699462405fa4459018b50a3f275ccfb92aa6d9 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 20 Jan 2015 19:34:25 -0700 Subject: [PATCH 27/71] XCode License, Ubuntu wget forgot about the OS X license and desktop ubuntu doesn't have wget --- README.md | 67 ++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 52 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index d51b9e1..bfb506e 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,47 @@ # iojs-install-script -A script to install basic development tools for iojs (git, iojs, gcc, pkg-config, etc) +A script to install basic development tools for io.js - the new node.js - git, iojs, gcc, pkg-config, etc -Works for any recent version of Ubuntu or OS X. +## TL;DR + +If you kinda know what you're doing already: + +```bash +echo "v1.0.1" > /tmp/IOJS_VER +curl -fsSL bit.ly/iojs-dev -o /tmp/iojs-dev.sh; bash /tmp/iojs-dev.sh +``` + +Or, if you don't need any developer tools and you *just* want io.js + +``` +# Or if you don't need any development tools +echo "v1.0.1" > /tmp/IOJS_VER +curl -fsSL bit.ly/iojs-min | bash +``` + +## Screencast + +[How to Setup a VPS for io.js Development](https://www.youtube.com/watch?v=ypjzi1axH2A) - [(3:06 installing io.js](https://www.youtube.com/watch?v=ypjzi1axH2A#t=186)) + +## Apple OS X + +First you need to install X Code Tools + +``` +xcode-select --install +``` + +Then you need to *Accept the License* by running any command installed by Xcode with sudo. We'll use git. + +``` +sudo git status +``` + +You can scroll to the bottom by hitting shift+G (capital G). + +Type `agree` and hit enter to accept the license. + +Now you can install io.js (the new node.js) ```bash # Specify the version of iojs to install @@ -12,20 +51,22 @@ echo "v1.0.1" > /tmp/IOJS_VER curl -fsSL bit.ly/iojs-dev -o /tmp/iojs-dev.sh; bash /tmp/iojs-dev.sh ``` +*TODO*: Make it easier to accepting the license (automatic?) + +## Ubuntu Linux + ``` -# Or if you don't need any development tools -curl -fsSL bit.ly/iojs-min | bash +# Specify the version of iojs to install +echo "v1.0.1" > /tmp/IOJS_VER + +# And install away! +wget -nv bit.ly/iojs-dev -O /tmp/iojs-dev.sh; bash /tmp/iojs-dev.sh ``` +## Other things you should know + **NOTE**: If you have node installed, this script will rename it so that it isn't overwritten by the iojs installer. - -**For older versions of Ubuntu**: - -```bash -wget -nv bit.ly/install-iojs -O - | bash -``` - This is what gets installed: * rsync @@ -38,10 +79,6 @@ This is what gets installed: **NOTE**: If `fail2ban` is not already securing ssh, you will be asked to install it. -Screencast -========== - -[How to Setup a VPS for io.js Development](https://www.youtube.com/watch?v=ypjzi1axH2A) - [(3:06 installing io.js](https://www.youtube.com/watch?v=ypjzi1axH2A#t=186)) Front-End Extras ================ From 2f2e7218937b28c32170bb9ab607a9fe016f9635 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 20 Jan 2015 19:45:45 -0700 Subject: [PATCH 28/71] added TOC --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index bfb506e..810bbd4 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,11 @@ A script to install basic development tools for io.js - the new node.js - git, iojs, gcc, pkg-config, etc +* [Instructions for OS X](#apple-os-x) +* [Instructions for Ubuntu Linux](#ubuntu-linux) +* [Instructions for TL;DR](#tl-dr) +* [Important Notes](#other-things-you-should-know) + ## TL;DR If you kinda know what you're doing already: From f14b3d6b497585e23e731be461169f40ccc690f6 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 20 Jan 2015 19:46:12 -0700 Subject: [PATCH 29/71] typo fix --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 810bbd4..f81b467 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ A script to install basic development tools for io.js - the new node.js - git, i * [Instructions for OS X](#apple-os-x) * [Instructions for Ubuntu Linux](#ubuntu-linux) -* [Instructions for TL;DR](#tl-dr) +* [Instructions for TL;DR](#tldr) * [Important Notes](#other-things-you-should-know) ## TL;DR From d13acf1a8f0d24e486a7f03f6c8e0aa922d12133 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 20 Jan 2015 22:34:04 -0700 Subject: [PATCH 30/71] Update README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f81b467..074ab07 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,10 @@ A script to install basic development tools for io.js - the new node.js - git, i * [Instructions for TL;DR](#tldr) * [Important Notes](#other-things-you-should-know) +## Screencast + +[How to Setup a VPS for io.js Development](https://www.youtube.com/watch?v=ypjzi1axH2A) - [(3:06 installing io.js](https://www.youtube.com/watch?v=ypjzi1axH2A#t=186)) + ## TL;DR If you kinda know what you're doing already: @@ -24,10 +28,6 @@ echo "v1.0.1" > /tmp/IOJS_VER curl -fsSL bit.ly/iojs-min | bash ``` -## Screencast - -[How to Setup a VPS for io.js Development](https://www.youtube.com/watch?v=ypjzi1axH2A) - [(3:06 installing io.js](https://www.youtube.com/watch?v=ypjzi1axH2A#t=186)) - ## Apple OS X First you need to install X Code Tools From fc3c4fcf2e5326e2ea55857537ff1f14ecf78b07 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 20 Jan 2015 22:39:46 -0700 Subject: [PATCH 31/71] Update README.md --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 074ab07..cbf012a 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ curl -fsSL bit.ly/iojs-dev -o /tmp/iojs-dev.sh; bash /tmp/iojs-dev.sh Or, if you don't need any developer tools and you *just* want io.js -``` +```bash # Or if you don't need any development tools echo "v1.0.1" > /tmp/IOJS_VER curl -fsSL bit.ly/iojs-min | bash @@ -32,14 +32,14 @@ curl -fsSL bit.ly/iojs-min | bash First you need to install X Code Tools -``` +```bash xcode-select --install ``` Then you need to *Accept the License* by running any command installed by Xcode with sudo. We'll use git. -``` -sudo git status +```bash +sudo git --version ``` You can scroll to the bottom by hitting shift+G (capital G). @@ -60,7 +60,7 @@ curl -fsSL bit.ly/iojs-dev -o /tmp/iojs-dev.sh; bash /tmp/iojs-dev.sh ## Ubuntu Linux -``` +```bash # Specify the version of iojs to install echo "v1.0.1" > /tmp/IOJS_VER From 882f8c6d972bee47a60a39762a9408ed54287990 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 20 Jan 2015 22:45:27 -0700 Subject: [PATCH 32/71] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cbf012a..be9cf17 100644 --- a/README.md +++ b/README.md @@ -30,13 +30,13 @@ curl -fsSL bit.ly/iojs-min | bash ## Apple OS X -First you need to install X Code Tools +First you need to **Install XCode Command Line Tools** ```bash xcode-select --install ``` -Then you need to *Accept the License* by running any command installed by Xcode with sudo. We'll use git. +Then you need to **Accept the XCode License** by running any command installed by Xcode with sudo. We'll use git. ```bash sudo git --version From 1e5263858342fd78fba7b1ff1381ca633d9d69bc Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 20 Jan 2015 23:15:30 -0700 Subject: [PATCH 33/71] update to 1.0.3 --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index be9cf17..9f5e993 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ A script to install basic development tools for io.js - the new node.js - git, i If you kinda know what you're doing already: ```bash -echo "v1.0.1" > /tmp/IOJS_VER +echo "v1.0.3" > /tmp/IOJS_VER curl -fsSL bit.ly/iojs-dev -o /tmp/iojs-dev.sh; bash /tmp/iojs-dev.sh ``` @@ -24,7 +24,7 @@ Or, if you don't need any developer tools and you *just* want io.js ```bash # Or if you don't need any development tools -echo "v1.0.1" > /tmp/IOJS_VER +echo "v1.0.3" > /tmp/IOJS_VER curl -fsSL bit.ly/iojs-min | bash ``` @@ -50,7 +50,7 @@ Now you can install io.js (the new node.js) ```bash # Specify the version of iojs to install -echo "v1.0.1" > /tmp/IOJS_VER +echo "v1.0.3" > /tmp/IOJS_VER # And install away! curl -fsSL bit.ly/iojs-dev -o /tmp/iojs-dev.sh; bash /tmp/iojs-dev.sh @@ -62,7 +62,7 @@ curl -fsSL bit.ly/iojs-dev -o /tmp/iojs-dev.sh; bash /tmp/iojs-dev.sh ```bash # Specify the version of iojs to install -echo "v1.0.1" > /tmp/IOJS_VER +echo "v1.0.3" > /tmp/IOJS_VER # And install away! wget -nv bit.ly/iojs-dev -O /tmp/iojs-dev.sh; bash /tmp/iojs-dev.sh From c4c74e3f46a1c4e79a5ed2babea181a3ae4d29f4 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 20 Jan 2015 23:16:17 -0700 Subject: [PATCH 34/71] print command to restore node correctly --- setup.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.bash b/setup.bash index 9cb8454..04fc891 100644 --- a/setup.bash +++ b/setup.bash @@ -207,7 +207,7 @@ if [ -f "/tmp/IOJS_VER" ]; then fi if [ -z "$IOJS_VER" ]; then - IOJS_VER="v1.0.1" + IOJS_VER="v1.0.3" fi # @@ -242,7 +242,7 @@ elif [ "$(node -v 2>/dev/null)" != "$(iojs -v 2>/dev/null)" ]; then echo sudo mv "$NODE_PATH" "$NODE_PATH.$NODE_VER" sudo mv "$NODE_PATH" "$NODE_PATH.$NODE_VER" echo "################################################################################" - echo "to restore backup: sudo rsync -a '$(which node).$(node -v)' '$(which node)'" + echo "to restore backup: sudo rsync -a '"$NODE_PATH.$NODE_VER"' '$NODE_PATH'" echo "################################################################################" echo "" fi From 835ebe737f13313586853aba83a07d6e2e4720dd Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 20 Jan 2015 23:16:58 -0700 Subject: [PATCH 35/71] move paths to bash vars --- setup-iojs-mavericks.bash | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/setup-iojs-mavericks.bash b/setup-iojs-mavericks.bash index 0770fd9..945d9ff 100644 --- a/setup-iojs-mavericks.bash +++ b/setup-iojs-mavericks.bash @@ -1,10 +1,11 @@ IOJS_VER=${1} +IOJS_REMOTE="http://iojs.org/dist/${IOJS_VER}/iojs-${IOJS_VER}.pkg" +IOJS_PKG="/tmp/iojs-${IOJS_VER}.pkg" if [ -n "${IOJS_VER}" ]; then echo "installing io.js as iojs ${IOJS_VER}..." - curl -fsSL "http://iojs.org/dist/${IOJS_VER}/iojs-${IOJS_VER}.pkg" -o "/tmp/iojs-${IOJS_VER}.pkg" - sudo /usr/sbin/installer -pkg "/tmp/iojs-${IOJS_VER}.pkg" -target / - + curl -fsSL "${IOJS_REMOTE}" -o "${IOJS_PKG}" + sudo /usr/sbin/installer -pkg "${IOJS_PKG}" -target / sudo chown -R $(whoami) /usr/local 2>/dev/null fi From 05dd997bf65a29d9bb79e5d211edaf5b4dfb89ee Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 20 Jan 2015 23:17:31 -0700 Subject: [PATCH 36/71] add setup-min for install without deps --- setup-min.sh | 203 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 202 insertions(+), 1 deletion(-) diff --git a/setup-min.sh b/setup-min.sh index 8772af0..7667571 100644 --- a/setup-min.sh +++ b/setup-min.sh @@ -1,3 +1,204 @@ #!/bin/bash -echo "not implemented yet" +# Installs iojs only (no development dependencies) for both Ubuntu and OS X + +# +# See https://github.com/coolaj86/iojs-install-script +# + +# curl -fsSL bit.ly/iojs-min | bash +# wget -nv bit.ly/iojs-min -O - | bash + +# curl -fsSL https://example.com/setup-min.bash | bash +# wget -nv https://example.com/setup-min.bash -O - | bash + +BASE_URL="https://raw.githubusercontent.com/coolaj86/iojs-install-script/master" +OS="unsupported" +ARCH="" +IOJS_VER="" +SETUP_FILE="" + +clear + +######################### +# Which OS and version? # +######################### + +if [ "$(uname | grep -i 'Darwin')" ]; then + OSX_VER="$(sw_vers | grep ProductVersion | cut -d':' -f2 | cut -f2)" + OSX_MAJOR="$(echo ${OSX_VER} | cut -d'.' -f1)" + OSX_MINOR="$(echo ${OSX_VER} | cut -d'.' -f2)" + OSX_PATCH="$(echo ${OSX_VER} | cut -d'.' -f3)" + + # + # Major + # + if [ "$OSX_MAJOR" -lt 10 ]; then + echo "unsupported OS X version (os 9-)" + exit 1 + fi + + if [ "$OSX_MAJOR" -gt 10 ]; then + echo "unsupported OS X version (os 11+)" + exit 1 + fi + + # + # Minor + # + if [ "$OSX_MINOR" -le 5 ]; then + echo "unsupported OS X version (os 10.5-)" + exit 1 + fi + + # Snow + if [ "$OSX_MINOR" -eq 6 ]; then + OS='snow' + fi + + # Lion + if [ $OSX_MINOR -eq 7 ]; then + OS='lion' + fi + + # Mountain Lion + if [ "$OSX_MINOR" -eq 8 ]; then + OS='mountain' + fi + + # Mavericks, Yosemite + if [ "$OSX_MINOR" -ge 9 ]; then + OS='mavericks' + fi + + if [ -n "$(sysctl hw | grep 64bit | grep ': 1')" ]; then + ARCH="64" + else + ARCH="32" + fi +elif [ "$(uname | grep -i 'Linux')" ]; then + if [ ! -f "/etc/issue" ]; then + echo "unsupported linux os" + exit 1 + fi + + if [ -n "$(arch | grep 64)" ]; then + ARCH="64" + else + ARCH="32" + fi + + if [ "$(cat /etc/issue | grep -i 'Ubuntu')" ]; then + OS='ubuntu' + elif [ "$(cat /etc/issue | grep -i 'Fedora')" ]; then + OS='fedora' + fi +else + echo "unsupported unknown os (non-mac, non-linux)" + exit 1 +fi + +case "${OS}" in + fedora) + echo "FEDORA not yet supported (feel free to pull request)" + exit 1 + ;; + ubuntu) + SETUP_FILE="ubuntu" + ;; + yosemite) + # mavericks + SETUP_FILE="mavericks" + ;; + mavericks) + SETUP_FILE="mavericks" + ;; + mountain) + echo "Mountain Lion not yet supported (feel free to pull request)" + exit 1 + ;; + lion) + echo "Lion not yet supported (feel free to pull request)" + exit 1 + ;; + snow) + echo "Snow Leopard not yet supported (feel free to pull request)" + exit 1 + ;; + *) + echo "unsupported unknown os ${OS}" + exit 1 + ;; +esac + +####################### +# Download installers # +####################### + +echo "Preparing to install io.js (and common development dependencies) for ${OS}" "${ARCH}" + +if [ -n "$(which curl)" ]; then + curl --silent "${BASE_URL}/setup-iojs-${SETUP_FILE}.bash" \ + -o /tmp/install-iojs.bash || echo 'error downloading os setup script' +elif [ -n "$(which wget)" ]; then + wget --quiet "${BASE_URL}/setup-iojs-${SETUP_FILE}.bash" \ + -O /tmp/install-iojs.bash || echo 'error downloading os setup script' +else + echo "Found neither 'curl' nor 'wget'. Can't Continue." + exit 1 +fi + +######################### +# Which io.js VERSION ? # +######################### + +if [ -f "/tmp/IOJS_VER" ]; then + IOJS_VER=$(cat /tmp/IOJS_VER | grep v) +fi + +if [ -z "$IOJS_VER" ]; then + IOJS_VER="v1.0.3" +fi + +# +# iojs +# +if [ -n "$(which iojs | grep iojs 2>/dev/null)" ]; then +# iojs of some version is already installed + if [ "${IOJS_VER}" == "$(iojs -v 2>/dev/null)" ]; then + echo iojs ${IOJS_VER} is already installed + else + echo "" + echo "HEY, LISTEN:" + echo "" + echo "io.js is already installed as iojs $(iojs -v | grep v)" + echo "" + echo "to reinstall please first run: rm $(which iojs)" + echo "" + fi + IOJS_VER="" +elif [ "$(node -v 2>/dev/null)" != "$(iojs -v 2>/dev/null)" ]; then +# node of some version is already installed + echo "" + echo "HEY, LISTEN!" + echo "" + echo "You have node.js installed." + echo "Backing up $(which node) as $(which node).$(node -v)" + echo "(copy it back after the install to maintain node.js and io.js separately)" + echo "" + sleep 3 + NODE_PATH=$(which node) + NODE_VER=$(node -v) + echo sudo mv "$NODE_PATH" "$NODE_PATH.$NODE_VER" + sudo mv "$NODE_PATH" "$NODE_PATH.$NODE_VER" + echo "################################################################################" + echo "to restore backup: sudo rsync -a '"$NODE_PATH.$NODE_VER"' '$NODE_PATH'" + echo "################################################################################" + echo "" +fi + +if [ -n "${IOJS_VER}" ]; then + bash /tmp/install-iojs.bash "${IOJS_VER}" +fi + +echo "" From 6d2d7e7c20291e7cc352871419f3376ec0a0a123 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 20 Jan 2015 23:18:12 -0700 Subject: [PATCH 37/71] move paths to bash vars --- setup-iojs-ubuntu.bash | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/setup-iojs-ubuntu.bash b/setup-iojs-ubuntu.bash index f8b7911..48b6337 100644 --- a/setup-iojs-ubuntu.bash +++ b/setup-iojs-ubuntu.bash @@ -6,15 +6,26 @@ else ARCH="x86" fi +IOJS_REMOTE="http://iojs.org/dist/${IOJS_VER}/iojs-${IOJS_VER}-linux-${ARCH}.tar.gz" +IOJS_LOCAL="/tmp/iojs-${IOJS_VER}-linux-${ARCH}.tar.gz" +IOJS_UNTAR="/tmp/iojs-${IOJS_VER}-linux-${ARCH}" + if [ -n "${IOJS_VER}" ]; then echo "installing io.js as iojs ${IOJS_VER}..." - curl -fsSL "http://iojs.org/dist/${IOJS_VER}/iojs-${IOJS_VER}-linux-${ARCH}.tar.gz" \ - -o "/tmp/iojs-${IOJS_VER}-linux-${ARCH}.tar.gz" - pushd /tmp >/dev/null - tar xf /tmp/iojs-${IOJS_VER}-linux-${ARCH}.tar.gz - rm iojs-${IOJS_VER}-linux-x64/{LICENSE,CHANGELOG.md,README.md} - sudo rsync -a "/tmp/iojs-${IOJS_VER}-linux-${ARCH}/" /usr/local/ + if [ -n "$(which curl 2>/dev/null)" ]; then + curl -fsSL ${IOJS_REMOTE} -o ${IOJS_LOCAL} || echo 'error downloading io.js' + elif [ -n "$(which wget 2>/dev/null)" ]; then + wget --quiet ${IOJS_REMOTE} -O ${IOJS_LOCAL} || echo 'error downloading io.js' + else + echo "'wget' and 'curl' are missing. Please run the following command and try again" + echo "\tsudo apt-get install --yes curl wget" + exit 1 + fi + + tar xf ${IOJS_LOCAL} + rm ${IOJS_UNTAR}/{LICENSE,CHANGELOG.md,README.md} + sudo rsync -a "${IOJS_UNTAR}/" /usr/local/ sudo chown -R $(whoami) /usr/local From 21f26603f616732aa507afaf264f57fb3667feaa Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 20 Jan 2015 23:24:02 -0700 Subject: [PATCH 38/71] specify output dir with tar instead of using cd --- setup-iojs-ubuntu.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup-iojs-ubuntu.bash b/setup-iojs-ubuntu.bash index 48b6337..58d9e01 100644 --- a/setup-iojs-ubuntu.bash +++ b/setup-iojs-ubuntu.bash @@ -23,7 +23,7 @@ if [ -n "${IOJS_VER}" ]; then exit 1 fi - tar xf ${IOJS_LOCAL} + tar xf ${IOJS_LOCAL} -C /tmp/ rm ${IOJS_UNTAR}/{LICENSE,CHANGELOG.md,README.md} sudo rsync -a "${IOJS_UNTAR}/" /usr/local/ From 7f07bc0a255a3a5d6e36c0d1812f5855ffeed403 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 20 Jan 2015 23:33:28 -0700 Subject: [PATCH 39/71] clarified tl;dr --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9f5e993..7f89f76 100644 --- a/README.md +++ b/README.md @@ -15,17 +15,21 @@ A script to install basic development tools for io.js - the new node.js - git, i If you kinda know what you're doing already: +**io.js + dev tools** + ```bash echo "v1.0.3" > /tmp/IOJS_VER curl -fsSL bit.ly/iojs-dev -o /tmp/iojs-dev.sh; bash /tmp/iojs-dev.sh ``` -Or, if you don't need any developer tools and you *just* want io.js +**io.js only** (no git, gcc, etc) ```bash -# Or if you don't need any development tools echo "v1.0.3" > /tmp/IOJS_VER curl -fsSL bit.ly/iojs-min | bash + +# Ubuntu without curl +wget -nv bit.ly/iojs-min -O - | bash ``` ## Apple OS X From 9f245dd42b8bc8bc63ba0550b96fd1334d6bba20 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 20 Jan 2015 23:34:08 -0700 Subject: [PATCH 40/71] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7f89f76..613003b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# iojs-install-script +# Automated io.js installers for OS X and Ubuntu A script to install basic development tools for io.js - the new node.js - git, iojs, gcc, pkg-config, etc From 2d13295e6358389c32fa0f4d3e099370a7f774d5 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sat, 24 Jan 2015 16:29:03 -0700 Subject: [PATCH 41/71] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 613003b..9f8d776 100644 --- a/README.md +++ b/README.md @@ -18,14 +18,14 @@ If you kinda know what you're doing already: **io.js + dev tools** ```bash -echo "v1.0.3" > /tmp/IOJS_VER +echo "v1.0.4" > /tmp/IOJS_VER curl -fsSL bit.ly/iojs-dev -o /tmp/iojs-dev.sh; bash /tmp/iojs-dev.sh ``` **io.js only** (no git, gcc, etc) ```bash -echo "v1.0.3" > /tmp/IOJS_VER +echo "v1.0.4" > /tmp/IOJS_VER curl -fsSL bit.ly/iojs-min | bash # Ubuntu without curl @@ -54,7 +54,7 @@ Now you can install io.js (the new node.js) ```bash # Specify the version of iojs to install -echo "v1.0.3" > /tmp/IOJS_VER +echo "v1.0.4" > /tmp/IOJS_VER # And install away! curl -fsSL bit.ly/iojs-dev -o /tmp/iojs-dev.sh; bash /tmp/iojs-dev.sh From 76fe4fad6ee24becedfb80710cd5300ecb5b615f Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Mon, 26 Jan 2015 00:11:42 -0700 Subject: [PATCH 42/71] Update README.md --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9f8d776..2aa6724 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,11 @@ A script to install basic development tools for io.js - the new node.js - git, iojs, gcc, pkg-config, etc -* [Instructions for OS X](#apple-os-x) -* [Instructions for Ubuntu Linux](#ubuntu-linux) -* [Instructions for TL;DR](#tldr) +Pick one: + +* [OS X](#apple-os-x) +* [Ubuntu Linux](#ubuntu-linux) +* [TL;DR](#tldr) * [Important Notes](#other-things-you-should-know) ## Screencast From c4d784318b7dfb19c92d03ed32eecf8e106e6c5f Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 3 Feb 2015 22:26:04 -0700 Subject: [PATCH 43/71] Update README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2aa6724..e4294c5 100644 --- a/README.md +++ b/README.md @@ -20,14 +20,14 @@ If you kinda know what you're doing already: **io.js + dev tools** ```bash -echo "v1.0.4" > /tmp/IOJS_VER +echo "v1.1.0" > /tmp/IOJS_VER curl -fsSL bit.ly/iojs-dev -o /tmp/iojs-dev.sh; bash /tmp/iojs-dev.sh ``` **io.js only** (no git, gcc, etc) ```bash -echo "v1.0.4" > /tmp/IOJS_VER +echo "v1.1.0" > /tmp/IOJS_VER curl -fsSL bit.ly/iojs-min | bash # Ubuntu without curl @@ -56,7 +56,7 @@ Now you can install io.js (the new node.js) ```bash # Specify the version of iojs to install -echo "v1.0.4" > /tmp/IOJS_VER +echo "v1.1.0" > /tmp/IOJS_VER # And install away! curl -fsSL bit.ly/iojs-dev -o /tmp/iojs-dev.sh; bash /tmp/iojs-dev.sh @@ -68,7 +68,7 @@ curl -fsSL bit.ly/iojs-dev -o /tmp/iojs-dev.sh; bash /tmp/iojs-dev.sh ```bash # Specify the version of iojs to install -echo "v1.0.3" > /tmp/IOJS_VER +echo "v1.1.0" > /tmp/IOJS_VER # And install away! wget -nv bit.ly/iojs-dev -O /tmp/iojs-dev.sh; bash /tmp/iojs-dev.sh From 23f94007280fcb1a293d13ea1869f4423b27f84d Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 3 Feb 2015 22:26:39 -0700 Subject: [PATCH 44/71] bump v1.1.0 --- setup-min.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup-min.sh b/setup-min.sh index 7667571..22c9cf4 100644 --- a/setup-min.sh +++ b/setup-min.sh @@ -157,7 +157,7 @@ if [ -f "/tmp/IOJS_VER" ]; then fi if [ -z "$IOJS_VER" ]; then - IOJS_VER="v1.0.3" + IOJS_VER="v1.1.0" fi # From 91279d1fe20d292bfd7058d02aa348a0060dba90 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 3 Feb 2015 22:27:03 -0700 Subject: [PATCH 45/71] bump v1.1.0 --- setup.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.bash b/setup.bash index 04fc891..8181f91 100644 --- a/setup.bash +++ b/setup.bash @@ -207,7 +207,7 @@ if [ -f "/tmp/IOJS_VER" ]; then fi if [ -z "$IOJS_VER" ]; then - IOJS_VER="v1.0.3" + IOJS_VER="v1.1.0" fi # From e845e13631c51c4e8e3237439243916f4d0b3105 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sun, 15 Mar 2015 21:36:11 -0600 Subject: [PATCH 46/71] Update to 1.5.1 --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e4294c5..958ab02 100644 --- a/README.md +++ b/README.md @@ -20,14 +20,14 @@ If you kinda know what you're doing already: **io.js + dev tools** ```bash -echo "v1.1.0" > /tmp/IOJS_VER +echo "v1.5.1" > /tmp/IOJS_VER curl -fsSL bit.ly/iojs-dev -o /tmp/iojs-dev.sh; bash /tmp/iojs-dev.sh ``` **io.js only** (no git, gcc, etc) ```bash -echo "v1.1.0" > /tmp/IOJS_VER +echo "v1.5.1" > /tmp/IOJS_VER curl -fsSL bit.ly/iojs-min | bash # Ubuntu without curl @@ -56,7 +56,7 @@ Now you can install io.js (the new node.js) ```bash # Specify the version of iojs to install -echo "v1.1.0" > /tmp/IOJS_VER +echo "v1.5.1" > /tmp/IOJS_VER # And install away! curl -fsSL bit.ly/iojs-dev -o /tmp/iojs-dev.sh; bash /tmp/iojs-dev.sh @@ -68,7 +68,7 @@ curl -fsSL bit.ly/iojs-dev -o /tmp/iojs-dev.sh; bash /tmp/iojs-dev.sh ```bash # Specify the version of iojs to install -echo "v1.1.0" > /tmp/IOJS_VER +echo "v1.5.1" > /tmp/IOJS_VER # And install away! wget -nv bit.ly/iojs-dev -O /tmp/iojs-dev.sh; bash /tmp/iojs-dev.sh From 837f52dd7dc67b829cf8e35ffde4950ad30d0893 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sun, 15 Mar 2015 21:39:00 -0600 Subject: [PATCH 47/71] Update to 1.5.1 --- setup.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.bash b/setup.bash index 8181f91..1866309 100644 --- a/setup.bash +++ b/setup.bash @@ -207,7 +207,7 @@ if [ -f "/tmp/IOJS_VER" ]; then fi if [ -z "$IOJS_VER" ]; then - IOJS_VER="v1.1.0" + IOJS_VER="v1.5.1" fi # From 373b1ebe1910743c0d8f7d19351aabd2db413700 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sun, 15 Mar 2015 21:40:23 -0600 Subject: [PATCH 48/71] Update to 1.5.1 --- setup-min.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup-min.sh b/setup-min.sh index 22c9cf4..86a88b3 100644 --- a/setup-min.sh +++ b/setup-min.sh @@ -157,7 +157,7 @@ if [ -f "/tmp/IOJS_VER" ]; then fi if [ -z "$IOJS_VER" ]; then - IOJS_VER="v1.1.0" + IOJS_VER="v1.5.1" fi # From e7102d3406d8a2c1e1290fd36f3f1351cb524f09 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 19 Mar 2015 21:31:19 -0600 Subject: [PATCH 49/71] Add raspbian option --- setup-min.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/setup-min.sh b/setup-min.sh index 86a88b3..2061715 100644 --- a/setup-min.sh +++ b/setup-min.sh @@ -90,6 +90,8 @@ elif [ "$(uname | grep -i 'Linux')" ]; then if [ "$(cat /etc/issue | grep -i 'Ubuntu')" ]; then OS='ubuntu' + elif [ "$(cat /etc/issue | grep -i 'Raspbian')" ]; then + OS='raspbian' elif [ "$(cat /etc/issue | grep -i 'Fedora')" ]; then OS='fedora' fi @@ -106,6 +108,9 @@ case "${OS}" in ubuntu) SETUP_FILE="ubuntu" ;; + raspbian) + SETUP_FILE="raspbian" + ;; yosemite) # mavericks SETUP_FILE="mavericks" From a3ae1c98f07b6bb3ee3c66aee24669e3a2217d18 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 19 Mar 2015 21:32:37 -0600 Subject: [PATCH 50/71] raspbian to use ubuntu setup file --- setup-min.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup-min.sh b/setup-min.sh index 2061715..7021a87 100644 --- a/setup-min.sh +++ b/setup-min.sh @@ -109,7 +109,7 @@ case "${OS}" in SETUP_FILE="ubuntu" ;; raspbian) - SETUP_FILE="raspbian" + SETUP_FILE="ubuntu" ;; yosemite) # mavericks From 6a8de7e98adb380977f0a5cdb56b01fe7eaf5bcc Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 19 Mar 2015 21:34:45 -0600 Subject: [PATCH 51/71] add raspbian --- setup.bash | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/setup.bash b/setup.bash index 1866309..bd9e083 100644 --- a/setup.bash +++ b/setup.bash @@ -90,6 +90,8 @@ elif [ "$(uname | grep -i 'Linux')" ]; then if [ "$(cat /etc/issue | grep -i 'Ubuntu')" ]; then OS='ubuntu' + elif [ "$(cat /etc/issue | grep -i 'Raspbian')" ]; then + OS='raspbian' elif [ "$(cat /etc/issue | grep -i 'Fedora')" ]; then OS='fedora' fi @@ -106,6 +108,9 @@ case "${OS}" in ubuntu) SETUP_FILE="ubuntu" ;; + raspbian) + SETUP_FILE="ubuntu" + ;; yosemite) # mavericks SETUP_FILE="mavericks" From 2a362e70e9997114ee94caaa4d8bdb51ca059868 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 19 Mar 2015 22:01:17 -0600 Subject: [PATCH 52/71] support armv7l, armv6l --- setup-iojs-ubuntu.bash | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/setup-iojs-ubuntu.bash b/setup-iojs-ubuntu.bash index 58d9e01..2cc064d 100644 --- a/setup-iojs-ubuntu.bash +++ b/setup-iojs-ubuntu.bash @@ -2,6 +2,10 @@ IOJS_VER=${1} if [ -n "$(arch | grep 64)" ]; then ARCH="x64" +elif [ -n "$(arch | grep armv7l)" ]; then + ARCH="armv7l" +elif [ -n "$(arch | grep armv6l)" ]; then + ARCH="armv6l" else ARCH="x86" fi From 5ef5c2ed1dd3e9a3fe1701f0c035176cf59f038b Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 1 Apr 2015 10:11:12 -0600 Subject: [PATCH 53/71] update to 1.6.3 --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 958ab02..10ccace 100644 --- a/README.md +++ b/README.md @@ -20,14 +20,14 @@ If you kinda know what you're doing already: **io.js + dev tools** ```bash -echo "v1.5.1" > /tmp/IOJS_VER +echo "v1.6.3" > /tmp/IOJS_VER curl -fsSL bit.ly/iojs-dev -o /tmp/iojs-dev.sh; bash /tmp/iojs-dev.sh ``` **io.js only** (no git, gcc, etc) ```bash -echo "v1.5.1" > /tmp/IOJS_VER +echo "v1.6.3" > /tmp/IOJS_VER curl -fsSL bit.ly/iojs-min | bash # Ubuntu without curl @@ -56,7 +56,7 @@ Now you can install io.js (the new node.js) ```bash # Specify the version of iojs to install -echo "v1.5.1" > /tmp/IOJS_VER +echo "v1.6.3" > /tmp/IOJS_VER # And install away! curl -fsSL bit.ly/iojs-dev -o /tmp/iojs-dev.sh; bash /tmp/iojs-dev.sh @@ -68,7 +68,7 @@ curl -fsSL bit.ly/iojs-dev -o /tmp/iojs-dev.sh; bash /tmp/iojs-dev.sh ```bash # Specify the version of iojs to install -echo "v1.5.1" > /tmp/IOJS_VER +echo "v1.6.3" > /tmp/IOJS_VER # And install away! wget -nv bit.ly/iojs-dev -O /tmp/iojs-dev.sh; bash /tmp/iojs-dev.sh From a40b71b1b1ad6706d2abbd68f2c30ae0c0e34fd0 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 22 Apr 2015 09:46:54 -0600 Subject: [PATCH 54/71] default to current version --- setup.bash | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/setup.bash b/setup.bash index bd9e083..a29af98 100644 --- a/setup.bash +++ b/setup.bash @@ -212,7 +212,16 @@ if [ -f "/tmp/IOJS_VER" ]; then fi if [ -z "$IOJS_VER" ]; then - IOJS_VER="v1.5.1" + if [ -n "$(which curl)" ]; then + IOJS_VER="$(curl -fsSL https://iojs.org/dist/index.tab | head -2 | tail -1 | cut -f 1)" \ + || echo 'error downloading os setup script' + elif [ -n "$(which wget)" ]; then + IOJS_VER="wget --quiet https://iojs.org/dist/index.tab | head -2 | tail -1 | cut -f 1)" \ + || echo 'error downloading os setup script' + else + echo "Found neither 'curl' nor 'wget'. Can't Continue." + exit 1 + fi fi # From 339c4b83bd4dc8919362de1ac46310c6818f480d Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 22 Apr 2015 09:48:01 -0600 Subject: [PATCH 55/71] default to current version --- setup-min.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/setup-min.sh b/setup-min.sh index 7021a87..ac86407 100644 --- a/setup-min.sh +++ b/setup-min.sh @@ -162,7 +162,16 @@ if [ -f "/tmp/IOJS_VER" ]; then fi if [ -z "$IOJS_VER" ]; then - IOJS_VER="v1.5.1" + if [ -n "$(which curl)" ]; then + IOJS_VER="$(curl -fsSL https://iojs.org/dist/index.tab | head -2 | tail -1 | cut -f 1)" \ + || echo 'error automatically determining current io.js version' + elif [ -n "$(which wget)" ]; then + IOJS_VER="wget --quiet https://iojs.org/dist/index.tab | head -2 | tail -1 | cut -f 1)" \ + || echo 'error automatically determining current io.js version' + else + echo "Found neither 'curl' nor 'wget'. Can't Continue." + exit 1 + fi fi # From c09719e26a20b4dea20edd4300aae87079450030 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 22 Apr 2015 09:48:29 -0600 Subject: [PATCH 56/71] fix error message --- setup.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.bash b/setup.bash index a29af98..2f5a891 100644 --- a/setup.bash +++ b/setup.bash @@ -214,10 +214,10 @@ fi if [ -z "$IOJS_VER" ]; then if [ -n "$(which curl)" ]; then IOJS_VER="$(curl -fsSL https://iojs.org/dist/index.tab | head -2 | tail -1 | cut -f 1)" \ - || echo 'error downloading os setup script' + || echo 'error automatically determining current io.js version' elif [ -n "$(which wget)" ]; then IOJS_VER="wget --quiet https://iojs.org/dist/index.tab | head -2 | tail -1 | cut -f 1)" \ - || echo 'error downloading os setup script' + || echo 'error automatically determining current io.js version' else echo "Found neither 'curl' nor 'wget'. Can't Continue." exit 1 From 2c58eb64c517a612458a76769379f77de7bd9fcb Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 22 Apr 2015 09:54:59 -0600 Subject: [PATCH 57/71] default to latest --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 10ccace..6c56936 100644 --- a/README.md +++ b/README.md @@ -20,14 +20,17 @@ If you kinda know what you're doing already: **io.js + dev tools** ```bash -echo "v1.6.3" > /tmp/IOJS_VER +echo "Current io.js version is $(curl -fsSL https://iojs.org/dist/index.tab | head -2 | tail -1 | cut -f 1)" curl -fsSL bit.ly/iojs-dev -o /tmp/iojs-dev.sh; bash /tmp/iojs-dev.sh ``` **io.js only** (no git, gcc, etc) ```bash -echo "v1.6.3" > /tmp/IOJS_VER +# To install a specific version rather than defaulting to latest +echo "v1.8.1" > /tmp/IOJS_VER + +# io.js without development dependencies curl -fsSL bit.ly/iojs-min | bash # Ubuntu without curl From 18577cb2de55e56c0aa9713308092a22d583f71d Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 22 Apr 2015 09:56:03 -0600 Subject: [PATCH 58/71] don't specify version, defaults to latest --- README.md | 8 -------- 1 file changed, 8 deletions(-) diff --git a/README.md b/README.md index 6c56936..1539d9e 100644 --- a/README.md +++ b/README.md @@ -58,10 +58,6 @@ Type `agree` and hit enter to accept the license. Now you can install io.js (the new node.js) ```bash -# Specify the version of iojs to install -echo "v1.6.3" > /tmp/IOJS_VER - -# And install away! curl -fsSL bit.ly/iojs-dev -o /tmp/iojs-dev.sh; bash /tmp/iojs-dev.sh ``` @@ -70,10 +66,6 @@ curl -fsSL bit.ly/iojs-dev -o /tmp/iojs-dev.sh; bash /tmp/iojs-dev.sh ## Ubuntu Linux ```bash -# Specify the version of iojs to install -echo "v1.6.3" > /tmp/IOJS_VER - -# And install away! wget -nv bit.ly/iojs-dev -O /tmp/iojs-dev.sh; bash /tmp/iojs-dev.sh ``` From f5f40aaed85b562bad51f3787bfc3be56e8724e6 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 22 Apr 2015 10:54:08 -0600 Subject: [PATCH 59/71] correct wget command --- setup-min.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup-min.sh b/setup-min.sh index ac86407..58976b9 100644 --- a/setup-min.sh +++ b/setup-min.sh @@ -166,7 +166,7 @@ if [ -z "$IOJS_VER" ]; then IOJS_VER="$(curl -fsSL https://iojs.org/dist/index.tab | head -2 | tail -1 | cut -f 1)" \ || echo 'error automatically determining current io.js version' elif [ -n "$(which wget)" ]; then - IOJS_VER="wget --quiet https://iojs.org/dist/index.tab | head -2 | tail -1 | cut -f 1)" \ + IOJS_VER="wget --quiet https://iojs.org/dist/index.tab -O - | head -2 | tail -1 | cut -f 1)" \ || echo 'error automatically determining current io.js version' else echo "Found neither 'curl' nor 'wget'. Can't Continue." From fa01634643ce41442c523f8f9ee67ac44936d494 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 22 Apr 2015 10:54:37 -0600 Subject: [PATCH 60/71] correct wget command --- setup.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.bash b/setup.bash index 2f5a891..2ab1018 100644 --- a/setup.bash +++ b/setup.bash @@ -216,7 +216,7 @@ if [ -z "$IOJS_VER" ]; then IOJS_VER="$(curl -fsSL https://iojs.org/dist/index.tab | head -2 | tail -1 | cut -f 1)" \ || echo 'error automatically determining current io.js version' elif [ -n "$(which wget)" ]; then - IOJS_VER="wget --quiet https://iojs.org/dist/index.tab | head -2 | tail -1 | cut -f 1)" \ + IOJS_VER="wget --quiet https://iojs.org/dist/index.tab -O - | head -2 | tail -1 | cut -f 1)" \ || echo 'error automatically determining current io.js version' else echo "Found neither 'curl' nor 'wget'. Can't Continue." From 1ec672254477acbbd9a0fab5ef1c0f2c7d7d3a46 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 9 Jun 2015 00:17:55 -0600 Subject: [PATCH 61/71] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1539d9e..487e0cc 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ curl -fsSL bit.ly/iojs-dev -o /tmp/iojs-dev.sh; bash /tmp/iojs-dev.sh ```bash # To install a specific version rather than defaulting to latest -echo "v1.8.1" > /tmp/IOJS_VER +echo "v1.8.2" > /tmp/IOJS_VER # io.js without development dependencies curl -fsSL bit.ly/iojs-min | bash From 139be1b26d933383fbe6d8250dc63f517fdfd6cd Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sat, 22 Aug 2015 00:56:35 -0600 Subject: [PATCH 62/71] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 487e0cc..1937eb8 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,8 @@ curl -fsSL bit.ly/iojs-dev -o /tmp/iojs-dev.sh; bash /tmp/iojs-dev.sh ```bash # To install a specific version rather than defaulting to latest -echo "v1.8.2" > /tmp/IOJS_VER +# latest version at time of writing are v1.8.4, v2.5.0, and v3.1.0 +echo "v2.5.0" > /tmp/IOJS_VER # io.js without development dependencies curl -fsSL bit.ly/iojs-min | bash From 701513faa984858b868ab1b91b80dd4393efaa5b Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 11 Sep 2015 12:43:13 -0600 Subject: [PATCH 63/71] prepare to update to nodejs 4.0.0 --- setup.bash | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/setup.bash b/setup.bash index 2ab1018..3bbb7ad 100644 --- a/setup.bash +++ b/setup.bash @@ -9,6 +9,8 @@ # curl -fsSL https://example.com/setup.bash | bash # wget -nv https://example.com/setup.bash -O - | bash +NODEJS_BASE_URL="https://iojs.org" +#NODEJS_BASE_URL="https://nodejs.org" BASE_URL="https://raw.githubusercontent.com/coolaj86/iojs-install-script/master" NO_FAIL2BAN="" OS="unsupported" @@ -213,10 +215,10 @@ fi if [ -z "$IOJS_VER" ]; then if [ -n "$(which curl)" ]; then - IOJS_VER="$(curl -fsSL https://iojs.org/dist/index.tab | head -2 | tail -1 | cut -f 1)" \ + IOJS_VER="$(curl -fsSL "$NODEJS_BASE_URL/dist/index.tab" | head -2 | tail -1 | cut -f 1)" \ || echo 'error automatically determining current io.js version' elif [ -n "$(which wget)" ]; then - IOJS_VER="wget --quiet https://iojs.org/dist/index.tab -O - | head -2 | tail -1 | cut -f 1)" \ + IOJS_VER="wget --quiet "$NODEJS_BASE_URL/dist/index.tab" -O - | head -2 | tail -1 | cut -f 1)" \ || echo 'error automatically determining current io.js version' else echo "Found neither 'curl' nor 'wget'. Can't Continue." From d8c75b08f40a0de172b8eeaff615fca2e2d43d60 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 11 Sep 2015 13:35:08 -0600 Subject: [PATCH 64/71] install io.js if 1 <= x < 4, otherwise install node.js --- setup-iojs-mavericks.bash | 28 ++++++++++++----- setup-iojs-ubuntu.bash | 35 ++++++++++++++------- setup-min.sh | 41 ++++++++++++++++-------- setup.bash | 65 ++++++++++++++++++++++++--------------- 4 files changed, 114 insertions(+), 55 deletions(-) diff --git a/setup-iojs-mavericks.bash b/setup-iojs-mavericks.bash index 945d9ff..f863daa 100644 --- a/setup-iojs-mavericks.bash +++ b/setup-iojs-mavericks.bash @@ -1,11 +1,25 @@ -IOJS_VER=${1} -IOJS_REMOTE="http://iojs.org/dist/${IOJS_VER}/iojs-${IOJS_VER}.pkg" -IOJS_PKG="/tmp/iojs-${IOJS_VER}.pkg" +NODEJS_VER=${1} +NODEJS_VERT=$(echo ${NODEJS_VER} | cut -c 2- | cut -d '.' -f1) -if [ -n "${IOJS_VER}" ]; then - echo "installing io.js as iojs ${IOJS_VER}..." - curl -fsSL "${IOJS_REMOTE}" -o "${IOJS_PKG}" - sudo /usr/sbin/installer -pkg "${IOJS_PKG}" -target / +NODEJS_NAME="node" +NODEJS_BASE_URL="https://nodejs.org" + +GE1=$(echo "$NODEJS_VERT>=1" | bc) +LT4=$(echo "$NODEJS_VERT<4" | bc) + +if [ "1" -eq $GE1 ] && [ "1" -eq $LT4 ] +then + NODEJS_BASE_URL="https://iojs.org" + NODEJS_NAME="iojs" +fi + +NODEJS_REMOTE="$NODEJS_BASE_URL/dist/${NODEJS_VER}/${NODEJS_NAME}-${NODEJS_VER}.pkg" +NODEJS_PKG="/tmp/${NODEJS_NAME}-${NODEJS_VER}.pkg" + +if [ -n "${NODEJS_VER}" ]; then + echo "installing ${NODEJS_NAME} as ${NODEJS_NAME} ${NODEJS_VER}..." + curl -fsSL "${NODEJS_REMOTE}" -o "${NODEJS_PKG}" + sudo /usr/sbin/installer -pkg "${NODEJS_PKG}" -target / sudo chown -R $(whoami) /usr/local 2>/dev/null fi diff --git a/setup-iojs-ubuntu.bash b/setup-iojs-ubuntu.bash index 2cc064d..8cec72b 100644 --- a/setup-iojs-ubuntu.bash +++ b/setup-iojs-ubuntu.bash @@ -1,4 +1,17 @@ -IOJS_VER=${1} +NODEJS_VER=${1} +NODEJS_VERT=$(echo ${NODEJS_VER} | cut -c 2- | cut -d '.' -f1) + +NODEJS_NAME="node" +NODEJS_BASE_URL="https://nodejs.org" + +GE1=$(echo "$NODEJS_VERT>=1" | bc) +LT4=$(echo "$NODEJS_VERT<4" | bc) + +if [ "1" -eq $GE1 ] && [ "1" -eq $LT4 ] +then + NODEJS_BASE_URL="https://iojs.org" + NODEJS_NAME="iojs" +fi if [ -n "$(arch | grep 64)" ]; then ARCH="x64" @@ -10,26 +23,26 @@ else ARCH="x86" fi -IOJS_REMOTE="http://iojs.org/dist/${IOJS_VER}/iojs-${IOJS_VER}-linux-${ARCH}.tar.gz" -IOJS_LOCAL="/tmp/iojs-${IOJS_VER}-linux-${ARCH}.tar.gz" -IOJS_UNTAR="/tmp/iojs-${IOJS_VER}-linux-${ARCH}" +NODEJS_REMOTE="${NODEJS_BASE_URL}/dist/${NODEJS_VER}/${NODEJS_NAME}-${NODEJS_VER}-linux-${ARCH}.tar.gz" +NODEJS_LOCAL="/tmp/${NODEJS_NAME}-${NODEJS_VER}-linux-${ARCH}.tar.gz" +NODEJS_UNTAR="/tmp/${NODEJS_NAME}-${NODEJS_VER}-linux-${ARCH}" -if [ -n "${IOJS_VER}" ]; then - echo "installing io.js as iojs ${IOJS_VER}..." +if [ -n "${NODEJS_VER}" ]; then + echo "installing ${NODEJS_NAME} as ${NODEJS_NAME} ${NODEJS_VER}..." if [ -n "$(which curl 2>/dev/null)" ]; then - curl -fsSL ${IOJS_REMOTE} -o ${IOJS_LOCAL} || echo 'error downloading io.js' + curl -fsSL ${NODEJS_REMOTE} -o ${NODEJS_LOCAL} || echo 'error downloading ${NODEJS_NAME}' elif [ -n "$(which wget 2>/dev/null)" ]; then - wget --quiet ${IOJS_REMOTE} -O ${IOJS_LOCAL} || echo 'error downloading io.js' + wget --quiet ${NODEJS_REMOTE} -O ${NODEJS_LOCAL} || echo 'error downloading ${NODEJS_NAME}' else echo "'wget' and 'curl' are missing. Please run the following command and try again" echo "\tsudo apt-get install --yes curl wget" exit 1 fi - tar xf ${IOJS_LOCAL} -C /tmp/ - rm ${IOJS_UNTAR}/{LICENSE,CHANGELOG.md,README.md} - sudo rsync -a "${IOJS_UNTAR}/" /usr/local/ + tar xf ${NODEJS_LOCAL} -C /tmp/ + rm ${NODEJS_UNTAR}/{LICENSE,CHANGELOG.md,README.md} + sudo rsync -a "${NODEJS_UNTAR}/" /usr/local/ sudo chown -R $(whoami) /usr/local diff --git a/setup-min.sh b/setup-min.sh index 58976b9..60fae7d 100644 --- a/setup-min.sh +++ b/setup-min.sh @@ -12,10 +12,12 @@ # curl -fsSL https://example.com/setup-min.bash | bash # wget -nv https://example.com/setup-min.bash -O - | bash +NODEJS_NAME="node" +NODEJS_BASE_URL="https://nodejs.org" BASE_URL="https://raw.githubusercontent.com/coolaj86/iojs-install-script/master" OS="unsupported" ARCH="" -IOJS_VER="" +NODEJS_VER="" SETUP_FILE="" clear @@ -157,16 +159,31 @@ fi # Which io.js VERSION ? # ######################### -if [ -f "/tmp/IOJS_VER" ]; then - IOJS_VER=$(cat /tmp/IOJS_VER | grep v) +if [ -f "/tmp/NODEJS_VER" ]; then + NODEJS_VER=$(cat /tmp/NODEJS_VER | grep v) +elif [ -f "/tmp/IOJS_VER" ]; then + NODEJS_VER=$(cat /tmp/IOJS_VER | grep v) fi -if [ -z "$IOJS_VER" ]; then +if [ -n "$NODEJS_VER" ]; then + NODEJS_VERT=$(echo ${NODEJS_VER} | cut -c 2- | cut -d '.' -f1) + + GE1=$(echo "$NODEJS_VERT>=1" | bc) + LT4=$(echo "$NODEJS_VERT<4" | bc) + + if [ "1" -eq $GE1 ] && [ "1" -eq $LT4 ] + then + NODEJS_BASE_URL="https://iojs.org" + NODEJS_NAME="iojs" + fi +fi + +if [ -z "$NODEJS_VER" ]; then if [ -n "$(which curl)" ]; then - IOJS_VER="$(curl -fsSL https://iojs.org/dist/index.tab | head -2 | tail -1 | cut -f 1)" \ + NODEJS_VER="$(curl -fsSL "$NODEJS_BASE_URL/dist/index.tab" | head -2 | tail -1 | cut -f 1)" \ || echo 'error automatically determining current io.js version' elif [ -n "$(which wget)" ]; then - IOJS_VER="wget --quiet https://iojs.org/dist/index.tab -O - | head -2 | tail -1 | cut -f 1)" \ + NODEJS_VER="wget --quiet "$NODEJS_BASE_URL/dist/index.tab" -O - | head -2 | tail -1 | cut -f 1)" \ || echo 'error automatically determining current io.js version' else echo "Found neither 'curl' nor 'wget'. Can't Continue." @@ -175,12 +192,12 @@ if [ -z "$IOJS_VER" ]; then fi # -# iojs +# iojs # if [ -n "$(which iojs | grep iojs 2>/dev/null)" ]; then # iojs of some version is already installed - if [ "${IOJS_VER}" == "$(iojs -v 2>/dev/null)" ]; then - echo iojs ${IOJS_VER} is already installed + if [ "${NODEJS_VER}" == "$(iojs -v 2>/dev/null)" ]; then + echo iojs ${NODEJS_VER} is already installed else echo "" echo "HEY, LISTEN:" @@ -190,7 +207,7 @@ if [ -n "$(which iojs | grep iojs 2>/dev/null)" ]; then echo "to reinstall please first run: rm $(which iojs)" echo "" fi - IOJS_VER="" + NODEJS_VER="" elif [ "$(node -v 2>/dev/null)" != "$(iojs -v 2>/dev/null)" ]; then # node of some version is already installed echo "" @@ -211,8 +228,8 @@ elif [ "$(node -v 2>/dev/null)" != "$(iojs -v 2>/dev/null)" ]; then echo "" fi -if [ -n "${IOJS_VER}" ]; then - bash /tmp/install-iojs.bash "${IOJS_VER}" +if [ -n "${NODEJS_VER}" ]; then + bash /tmp/install-iojs.bash "${NODEJS_VER}" fi echo "" diff --git a/setup.bash b/setup.bash index 3bbb7ad..a848549 100644 --- a/setup.bash +++ b/setup.bash @@ -9,13 +9,13 @@ # curl -fsSL https://example.com/setup.bash | bash # wget -nv https://example.com/setup.bash -O - | bash -NODEJS_BASE_URL="https://iojs.org" -#NODEJS_BASE_URL="https://nodejs.org" +NODEJS_NAME="node" +NODEJS_BASE_URL="https://nodejs.org" BASE_URL="https://raw.githubusercontent.com/coolaj86/iojs-install-script/master" NO_FAIL2BAN="" OS="unsupported" ARCH="" -IOJS_VER="" +NODEJS_VER="" SETUP_FILE="" clear @@ -145,18 +145,18 @@ esac # Download installers # ####################### -echo "Preparing to install io.js (and common development dependencies) for ${OS}" "${ARCH}" +echo "Preparing to install ${NODEJS_NAME} (and common development dependencies) for ${OS}" "${ARCH}" if [ -n "$(which curl)" ]; then curl --silent "${BASE_URL}/setup-deps-${SETUP_FILE}.bash" \ - -o /tmp/install-iojs-deps.bash || echo 'error downloading os setup script' + -o /tmp/install-${NODEJS_NAME}-deps.bash || echo 'error downloading os setup script' curl --silent "${BASE_URL}/setup-iojs-${SETUP_FILE}.bash" \ - -o /tmp/install-iojs.bash || echo 'error downloading os setup script' + -o /tmp/install-${NODEJS_NAME}.bash || echo 'error downloading os setup script' elif [ -n "$(which wget)" ]; then wget --quiet "${BASE_URL}/setup-deps-${SETUP_FILE}.bash" \ - -O /tmp/install-iojs-deps.bash || echo 'error downloading os setup script' + -O /tmp/install-${NODEJS_NAME}-deps.bash || echo 'error downloading os setup script' wget --quiet "${BASE_URL}/setup-iojs-${SETUP_FILE}.bash" \ - -O /tmp/install-iojs.bash || echo 'error downloading os setup script' + -O /tmp/install-${NODEJS_NAME}.bash || echo 'error downloading os setup script' else echo "Found neither 'curl' nor 'wget'. Can't Continue." exit 1 @@ -203,23 +203,39 @@ if [ -z "$(which fail2ban-server | grep fail2ban)" ]; then fi fi -bash /tmp/install-iojs-deps.bash "${NO_FAIL2BAN}" +bash /tmp/install-${NODEJS_NAME}-deps.bash "${NO_FAIL2BAN}" ######################### -# Which io.js VERSION ? # +# Which node.js VERSION ? # ######################### -if [ -f "/tmp/IOJS_VER" ]; then - IOJS_VER=$(cat /tmp/IOJS_VER | grep v) +if [ -f "/tmp/NODEJS_VER" ]; then + NODEJS_VER=$(cat /tmp/NODEJS_VER | grep v) +elif [ -f "/tmp/IOJS_VER" ]; then + NODEJS_VER=$(cat /tmp/IOJS_VER | grep v) fi -if [ -z "$IOJS_VER" ]; then +if [ -n "$NODEJS_VER" ]; then + NODEJS_VERT=$(echo ${NODEJS_VER} | cut -c 2- | cut -d '.' -f1) + + GE1=$(echo "$NODEJS_VERT>=1" | bc) + LT4=$(echo "$NODEJS_VERT<4" | bc) + + if [ "1" -eq $GE1 ] && [ "1" -eq $LT4 ] + then + echo "Selecting io.js instead of node.js for this version" + NODEJS_BASE_URL="https://iojs.org" + NODEJS_NAME="iojs" + fi +fi + +if [ -z "$NODEJS_VER" ]; then if [ -n "$(which curl)" ]; then - IOJS_VER="$(curl -fsSL "$NODEJS_BASE_URL/dist/index.tab" | head -2 | tail -1 | cut -f 1)" \ - || echo 'error automatically determining current io.js version' + NODEJS_VER="$(curl -fsSL "$NODEJS_BASE_URL/dist/index.tab" | head -2 | tail -1 | cut -f 1)" \ + || echo 'error automatically determining current ${NODEJS_NAME} version' elif [ -n "$(which wget)" ]; then - IOJS_VER="wget --quiet "$NODEJS_BASE_URL/dist/index.tab" -O - | head -2 | tail -1 | cut -f 1)" \ - || echo 'error automatically determining current io.js version' + NODEJS_VER="wget --quiet "$NODEJS_BASE_URL/dist/index.tab" -O - | head -2 | tail -1 | cut -f 1)" \ + || echo 'error automatically determining current ${NODEJS_NAME} version' else echo "Found neither 'curl' nor 'wget'. Can't Continue." exit 1 @@ -227,22 +243,22 @@ if [ -z "$IOJS_VER" ]; then fi # -# iojs +# iojs # if [ -n "$(which iojs | grep iojs 2>/dev/null)" ]; then # iojs of some version is already installed - if [ "${IOJS_VER}" == "$(iojs -v 2>/dev/null)" ]; then - echo iojs ${IOJS_VER} is already installed + if [ "${NODEJS_VER}" == "$(iojs -v 2>/dev/null)" ]; then + echo iojs ${NODEJS_VER} is already installed else echo "" echo "HEY, LISTEN:" echo "" - echo "io.js is already installed as iojs $(iojs -v | grep v)" + echo "${NODEJS_NAME} is already installed as iojs $(iojs -v | grep v)" echo "" echo "to reinstall please first run: rm $(which iojs)" echo "" fi - IOJS_VER="" + NODEJS_VER="" elif [ "$(node -v 2>/dev/null)" != "$(iojs -v 2>/dev/null)" ]; then # node of some version is already installed echo "" @@ -250,7 +266,6 @@ elif [ "$(node -v 2>/dev/null)" != "$(iojs -v 2>/dev/null)" ]; then echo "" echo "You have node.js installed." echo "Backing up $(which node) as $(which node).$(node -v)" - echo "(copy it back after the install to maintain node.js and io.js separately)" echo "" sleep 3 NODE_PATH=$(which node) @@ -263,8 +278,8 @@ elif [ "$(node -v 2>/dev/null)" != "$(iojs -v 2>/dev/null)" ]; then echo "" fi -if [ -n "${IOJS_VER}" ]; then - bash /tmp/install-iojs.bash "${IOJS_VER}" +if [ -n "${NODEJS_VER}" ]; then + bash /tmp/install-${NODEJS_NAME}.bash "${NODEJS_VER}" fi # jshint From 80b80bbfc6e2d8db71534165bf4478bc14918f66 Mon Sep 17 00:00:00 2001 From: Manuel Strebel Date: Thu, 17 Sep 2015 14:49:13 +0200 Subject: [PATCH 65/71] fix wget command --- setup-min.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup-min.sh b/setup-min.sh index 60fae7d..dc59f08 100644 --- a/setup-min.sh +++ b/setup-min.sh @@ -183,7 +183,7 @@ if [ -z "$NODEJS_VER" ]; then NODEJS_VER="$(curl -fsSL "$NODEJS_BASE_URL/dist/index.tab" | head -2 | tail -1 | cut -f 1)" \ || echo 'error automatically determining current io.js version' elif [ -n "$(which wget)" ]; then - NODEJS_VER="wget --quiet "$NODEJS_BASE_URL/dist/index.tab" -O - | head -2 | tail -1 | cut -f 1)" \ + NODEJS_VER="$(wget --quiet "$NODEJS_BASE_URL/dist/index.tab" -O - | head -2 | tail -1 | cut -f 1)" \ || echo 'error automatically determining current io.js version' else echo "Found neither 'curl' nor 'wget'. Can't Continue." From 2398ca578f6e70bc6246f57e5aad21e3aefd68b2 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 9 Dec 2015 12:40:29 -0800 Subject: [PATCH 66/71] io.js -> node.js again --- README.md | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 1937eb8..9fb7f4d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Automated io.js installers for OS X and Ubuntu +# Automated node.js installers for OS X and Ubuntu -A script to install basic development tools for io.js - the new node.js - git, iojs, gcc, pkg-config, etc +A script to install basic development tools for node.js - git, node, gcc, pkg-config, etc Pick one: @@ -11,27 +11,27 @@ Pick one: ## Screencast -[How to Setup a VPS for io.js Development](https://www.youtube.com/watch?v=ypjzi1axH2A) - [(3:06 installing io.js](https://www.youtube.com/watch?v=ypjzi1axH2A#t=186)) +[How to Setup a VPS for node.js Development](https://www.youtube.com/watch?v=ypjzi1axH2A) - [(3:06 installing node.js](https://www.youtube.com/watch?v=ypjzi1axH2A#t=186)) ## TL;DR If you kinda know what you're doing already: -**io.js + dev tools** +**node.js + dev tools** ```bash -echo "Current io.js version is $(curl -fsSL https://iojs.org/dist/index.tab | head -2 | tail -1 | cut -f 1)" +echo "Current node.js version is $(curl -fsSL https://nodejs.org/dist/index.tab | head -2 | tail -1 | cut -f 1)" curl -fsSL bit.ly/iojs-dev -o /tmp/iojs-dev.sh; bash /tmp/iojs-dev.sh ``` -**io.js only** (no git, gcc, etc) +**node.js only** (no git, gcc, etc) ```bash # To install a specific version rather than defaulting to latest # latest version at time of writing are v1.8.4, v2.5.0, and v3.1.0 echo "v2.5.0" > /tmp/IOJS_VER -# io.js without development dependencies +# node.js without development dependencies curl -fsSL bit.ly/iojs-min | bash # Ubuntu without curl @@ -56,7 +56,7 @@ You can scroll to the bottom by hitting shift+G (capital G). Type `agree` and hit enter to accept the license. -Now you can install io.js (the new node.js) +Now you can install node.js ```bash curl -fsSL bit.ly/iojs-dev -o /tmp/iojs-dev.sh; bash /tmp/iojs-dev.sh @@ -72,8 +72,6 @@ wget -nv bit.ly/iojs-dev -O /tmp/iojs-dev.sh; bash /tmp/iojs-dev.sh ## Other things you should know -**NOTE**: If you have node installed, this script will rename it so that it isn't overwritten by the iojs installer. - This is what gets installed: * rsync @@ -81,7 +79,7 @@ This is what gets installed: * wget * git * xcode / brew / build-essential / pkg-config / gcc -* iojs (including npm and node symlink) +* node (including npm) * jshint **NOTE**: If `fail2ban` is not already securing ssh, you will be asked to install it. From 1f63791ef91fe6f093d347dc7bf536eb9b5e2abc Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 22 Dec 2015 21:46:44 -0500 Subject: [PATCH 67/71] Update setup.bash --- setup.bash | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/setup.bash b/setup.bash index a848549..cc5bcd1 100644 --- a/setup.bash +++ b/setup.bash @@ -218,12 +218,9 @@ fi if [ -n "$NODEJS_VER" ]; then NODEJS_VERT=$(echo ${NODEJS_VER} | cut -c 2- | cut -d '.' -f1) - GE1=$(echo "$NODEJS_VERT>=1" | bc) - LT4=$(echo "$NODEJS_VERT<4" | bc) - - if [ "1" -eq $GE1 ] && [ "1" -eq $LT4 ] + if [ $NODEJS_VERT -ge 1 ] && [ $NODEJS_VERT -lt 4 ] then - echo "Selecting io.js instead of node.js for this version" + echo "Selecting io.js instead of node.js for this version (>= 1.0.0 < 4.0.0)" NODEJS_BASE_URL="https://iojs.org" NODEJS_NAME="iojs" fi From d9f6f974ae5b196e7a5a19cdf4fa3b14d5c5bedf Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 22 Dec 2015 21:47:52 -0500 Subject: [PATCH 68/71] remove bc --- setup-iojs-ubuntu.bash | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/setup-iojs-ubuntu.bash b/setup-iojs-ubuntu.bash index 8cec72b..cd96ffd 100644 --- a/setup-iojs-ubuntu.bash +++ b/setup-iojs-ubuntu.bash @@ -4,11 +4,9 @@ NODEJS_VERT=$(echo ${NODEJS_VER} | cut -c 2- | cut -d '.' -f1) NODEJS_NAME="node" NODEJS_BASE_URL="https://nodejs.org" -GE1=$(echo "$NODEJS_VERT>=1" | bc) -LT4=$(echo "$NODEJS_VERT<4" | bc) - -if [ "1" -eq $GE1 ] && [ "1" -eq $LT4 ] +if [ $NODEJS_VERT -ge 1 ] && [ $NODEJS_VERT -lt 4 ] then + echo "Selecting io.js instead of node.js for this version (>= 1.0.0 < 4.0.0)" NODEJS_BASE_URL="https://iojs.org" NODEJS_NAME="iojs" fi From 9d7e5f6442d7c20fcc6bd123bb0b25623ad10a06 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 22 Dec 2015 21:50:41 -0500 Subject: [PATCH 69/71] remove bc --- setup-iojs-mavericks.bash | 5 ++--- setup-min.sh | 6 ++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/setup-iojs-mavericks.bash b/setup-iojs-mavericks.bash index f863daa..13388f4 100644 --- a/setup-iojs-mavericks.bash +++ b/setup-iojs-mavericks.bash @@ -4,11 +4,10 @@ NODEJS_VERT=$(echo ${NODEJS_VER} | cut -c 2- | cut -d '.' -f1) NODEJS_NAME="node" NODEJS_BASE_URL="https://nodejs.org" -GE1=$(echo "$NODEJS_VERT>=1" | bc) -LT4=$(echo "$NODEJS_VERT<4" | bc) -if [ "1" -eq $GE1 ] && [ "1" -eq $LT4 ] +if [ $NODEJS_VERT -ge 1 ] && [ $NODEJS_VERT -lt 4 ] then + echo "Selecting io.js instead of node.js for this version (>= 1.0.0 < 4.0.0)" NODEJS_BASE_URL="https://iojs.org" NODEJS_NAME="iojs" fi diff --git a/setup-min.sh b/setup-min.sh index 60fae7d..9488d8c 100644 --- a/setup-min.sh +++ b/setup-min.sh @@ -168,11 +168,9 @@ fi if [ -n "$NODEJS_VER" ]; then NODEJS_VERT=$(echo ${NODEJS_VER} | cut -c 2- | cut -d '.' -f1) - GE1=$(echo "$NODEJS_VERT>=1" | bc) - LT4=$(echo "$NODEJS_VERT<4" | bc) - - if [ "1" -eq $GE1 ] && [ "1" -eq $LT4 ] + if [ $NODEJS_VERT -ge 1 ] && [ $NODEJS_VERT -lt 4 ] then + echo "Selecting io.js instead of node.js for this version (>= 1.0.0 < 4.0.0)" NODEJS_BASE_URL="https://iojs.org" NODEJS_NAME="iojs" fi From 40ab864ee80cb2ef364150e68884e8b2febc43d5 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Mon, 28 Mar 2016 15:50:12 -0400 Subject: [PATCH 70/71] updating iojs -> node.js --- setup-min.sh | 42 ++++++++++------- ...avericks.bash => setup-node-mavericks.bash | 0 ...iojs-ubuntu.bash => setup-node-ubuntu.bash | 0 setup.bash | 45 ++++++++++--------- 4 files changed, 51 insertions(+), 36 deletions(-) rename setup-iojs-mavericks.bash => setup-node-mavericks.bash (100%) rename setup-iojs-ubuntu.bash => setup-node-ubuntu.bash (100%) diff --git a/setup-min.sh b/setup-min.sh index 546230e..0e6f39b 100644 --- a/setup-min.sh +++ b/setup-min.sh @@ -1,20 +1,20 @@ #!/bin/bash -# Installs iojs only (no development dependencies) for both Ubuntu and OS X +# Installs node.js only (no development dependencies) for both Ubuntu and OS X # -# See https://github.com/coolaj86/iojs-install-script +# See https://github.com/coolaj86/node-install-script # -# curl -fsSL bit.ly/iojs-min | bash -# wget -nv bit.ly/iojs-min -O - | bash +# curl -fsSL bit.ly/nodejs-min | bash +# wget -nv bit.ly/nodejs-min -O - | bash # curl -fsSL https://example.com/setup-min.bash | bash # wget -nv https://example.com/setup-min.bash -O - | bash NODEJS_NAME="node" NODEJS_BASE_URL="https://nodejs.org" -BASE_URL="https://raw.githubusercontent.com/coolaj86/iojs-install-script/master" +BASE_URL="https://raw.githubusercontent.com/coolaj86/node-install-script/master" OS="unsupported" ARCH="" NODEJS_VER="" @@ -144,14 +144,24 @@ esac echo "Preparing to install io.js (and common development dependencies) for ${OS}" "${ARCH}" -if [ -n "$(which curl)" ]; then - curl --silent "${BASE_URL}/setup-iojs-${SETUP_FILE}.bash" \ - -o /tmp/install-iojs.bash || echo 'error downloading os setup script' -elif [ -n "$(which wget)" ]; then - wget --quiet "${BASE_URL}/setup-iojs-${SETUP_FILE}.bash" \ - -O /tmp/install-iojs.bash || echo 'error downloading os setup script' -else - echo "Found neither 'curl' nor 'wget'. Can't Continue." +INSTALL_FILE="setup-node-${SETUP_FILE}.bash" +if [ ! -e "/tmp/${INSTALL_FILE}" ] +then + if [ -n "$(which curl)" ]; then + curl --silent "${BASE_URL}/${INSTALL_FILE}" \ + -o "/tmp/${INSTALL_FILE}" || echo 'error downloading os setup script' + elif [ -n "$(which wget)" ]; then + wget --quiet "${BASE_URL}/${INSTALL_FILE}" \ + -O "/tmp/${INSTALL_FILE}" || echo 'error downloading os setup script' + else + echo "Found neither 'curl' nor 'wget'. Can't Continue." + exit 1 + fi +fi + +if [ ! -e "/tmp/${INSTALL_FILE}" ] +then + echo "Error Downloading Install File" exit 1 fi @@ -178,10 +188,10 @@ fi if [ -z "$NODEJS_VER" ]; then if [ -n "$(which curl)" ]; then - NODEJS_VER="$(curl -fsSL "$NODEJS_BASE_URL/dist/index.tab" | head -2 | tail -1 | cut -f 1)" \ + NODEJS_VER=$(curl -fsSL "$NODEJS_BASE_URL/dist/index.tab" | head -2 | tail -1 | cut -f 1) \ || echo 'error automatically determining current io.js version' elif [ -n "$(which wget)" ]; then - NODEJS_VER="$(wget --quiet "$NODEJS_BASE_URL/dist/index.tab" -O - | head -2 | tail -1 | cut -f 1)" \ + NODEJS_VER=$(wget --quiet "$NODEJS_BASE_URL/dist/index.tab" -O - | head -2 | tail -1 | cut -f 1) \ || echo 'error automatically determining current io.js version' else echo "Found neither 'curl' nor 'wget'. Can't Continue." @@ -227,7 +237,7 @@ elif [ "$(node -v 2>/dev/null)" != "$(iojs -v 2>/dev/null)" ]; then fi if [ -n "${NODEJS_VER}" ]; then - bash /tmp/install-iojs.bash "${NODEJS_VER}" + bash "/tmp/${INSTALL_FILE}" "${NODEJS_VER}" fi echo "" diff --git a/setup-iojs-mavericks.bash b/setup-node-mavericks.bash similarity index 100% rename from setup-iojs-mavericks.bash rename to setup-node-mavericks.bash diff --git a/setup-iojs-ubuntu.bash b/setup-node-ubuntu.bash similarity index 100% rename from setup-iojs-ubuntu.bash rename to setup-node-ubuntu.bash diff --git a/setup.bash b/setup.bash index cc5bcd1..21237c2 100644 --- a/setup.bash +++ b/setup.bash @@ -1,6 +1,6 @@ #!/bin/bash -# Installs iojs + dependencies for both Ubuntu and OS X +# Installs node.js + dependencies for both Ubuntu and OS X # # See https://github.com/coolaj86/iojs-install-script @@ -147,19 +147,24 @@ esac echo "Preparing to install ${NODEJS_NAME} (and common development dependencies) for ${OS}" "${ARCH}" -if [ -n "$(which curl)" ]; then - curl --silent "${BASE_URL}/setup-deps-${SETUP_FILE}.bash" \ - -o /tmp/install-${NODEJS_NAME}-deps.bash || echo 'error downloading os setup script' - curl --silent "${BASE_URL}/setup-iojs-${SETUP_FILE}.bash" \ - -o /tmp/install-${NODEJS_NAME}.bash || echo 'error downloading os setup script' -elif [ -n "$(which wget)" ]; then - wget --quiet "${BASE_URL}/setup-deps-${SETUP_FILE}.bash" \ - -O /tmp/install-${NODEJS_NAME}-deps.bash || echo 'error downloading os setup script' - wget --quiet "${BASE_URL}/setup-iojs-${SETUP_FILE}.bash" \ - -O /tmp/install-${NODEJS_NAME}.bash || echo 'error downloading os setup script' -else - echo "Found neither 'curl' nor 'wget'. Can't Continue." - exit 1 +INSTALL_DEPS_FILE="setup-deps-${SETUP_FILE}.bash" +INSTALL_FILE="setup-node-${SETUP_FILE}.bash" +if [ ! -e "/tmp/${INSTALL_DEPS_FILE}" ] +then + if [ -n "$(which curl)" ]; then + curl --silent "${BASE_URL}/${INSTALL_DEPS_FILE}" \ + -o "/tmp/${INSTALL_DEPS_FILE}" || echo 'error downloading os setup script' + curl --silent "${BASE_URL}/${INSTALL_FILE}" \ + -o "/tmp/${INSTALL_FILE}" || echo 'error downloading os setup script' + elif [ -n "$(which wget)" ]; then + wget --quiet "${BASE_URL}/${INSTALL_DEPS_FILE}" \ + -O "/tmp/${INSTALL_DEPS_FILE}" || echo 'error downloading os setup script' + wget --quiet "${BASE_URL}/${INSTALL_FILE}" \ + -O "/tmp/${INSTALL_FILE}" || echo 'error downloading os setup script' + else + echo "Found neither 'curl' nor 'wget'. Can't Continue." + exit 1 + fi fi @@ -203,7 +208,7 @@ if [ -z "$(which fail2ban-server | grep fail2ban)" ]; then fi fi -bash /tmp/install-${NODEJS_NAME}-deps.bash "${NO_FAIL2BAN}" +bash "/tmp/${INSTALL_DEPS_FILE}" "${NO_FAIL2BAN}" ######################### # Which node.js VERSION ? # @@ -228,11 +233,11 @@ fi if [ -z "$NODEJS_VER" ]; then if [ -n "$(which curl)" ]; then - NODEJS_VER="$(curl -fsSL "$NODEJS_BASE_URL/dist/index.tab" | head -2 | tail -1 | cut -f 1)" \ - || echo 'error automatically determining current ${NODEJS_NAME} version' + NODEJS_VER=$(curl -fsSL "$NODEJS_BASE_URL/dist/index.tab" | head -2 | tail -1 | cut -f 1) \ + || echo "error automatically determining current ${NODEJS_NAME} version" elif [ -n "$(which wget)" ]; then - NODEJS_VER="wget --quiet "$NODEJS_BASE_URL/dist/index.tab" -O - | head -2 | tail -1 | cut -f 1)" \ - || echo 'error automatically determining current ${NODEJS_NAME} version' + NODEJS_VER=$(wget --quiet "$NODEJS_BASE_URL/dist/index.tab" -O - | head -2 | tail -1 | cut -f 1) \ + || echo "error automatically determining current ${NODEJS_NAME} version" else echo "Found neither 'curl' nor 'wget'. Can't Continue." exit 1 @@ -276,7 +281,7 @@ elif [ "$(node -v 2>/dev/null)" != "$(iojs -v 2>/dev/null)" ]; then fi if [ -n "${NODEJS_VER}" ]; then - bash /tmp/install-${NODEJS_NAME}.bash "${NODEJS_VER}" + bash "/tmp/${INSTALL_FILE}" "${NODEJS_VER}" fi # jshint From 20ebf115c97f40376117e5acc775b738a03e507b Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Mon, 28 Mar 2016 16:11:01 -0400 Subject: [PATCH 71/71] io.js -> node.js --- setup-min.sh | 35 +++++++++-------------------------- setup.bash | 48 ++++++++++++++++++------------------------------ 2 files changed, 27 insertions(+), 56 deletions(-) diff --git a/setup-min.sh b/setup-min.sh index 0e6f39b..6f70f13 100644 --- a/setup-min.sh +++ b/setup-min.sh @@ -14,7 +14,7 @@ NODEJS_NAME="node" NODEJS_BASE_URL="https://nodejs.org" -BASE_URL="https://raw.githubusercontent.com/coolaj86/node-install-script/master" +BASE_URL="https://raw.githubusercontent.com/coolaj86/iojs-install-script/master" OS="unsupported" ARCH="" NODEJS_VER="" @@ -200,40 +200,23 @@ if [ -z "$NODEJS_VER" ]; then fi # -# iojs +# node # -if [ -n "$(which iojs | grep iojs 2>/dev/null)" ]; then -# iojs of some version is already installed - if [ "${NODEJS_VER}" == "$(iojs -v 2>/dev/null)" ]; then - echo iojs ${NODEJS_VER} is already installed +if [ -n "$(which node | grep node 2>/dev/null)" ]; then +# node of some version is already installed + if [ "${NODEJS_VER}" == "$(node -v 2>/dev/null)" ]; then + echo node ${NODEJS_VER} is already installed else echo "" echo "HEY, LISTEN:" echo "" - echo "io.js is already installed as iojs $(iojs -v | grep v)" + echo "node.js is already installed as node $(node -v | grep v)" echo "" - echo "to reinstall please first run: rm $(which iojs)" + echo "to reinstall please first run: rm $(which node)" echo "" fi + NODEJS_VER="" -elif [ "$(node -v 2>/dev/null)" != "$(iojs -v 2>/dev/null)" ]; then -# node of some version is already installed - echo "" - echo "HEY, LISTEN!" - echo "" - echo "You have node.js installed." - echo "Backing up $(which node) as $(which node).$(node -v)" - echo "(copy it back after the install to maintain node.js and io.js separately)" - echo "" - sleep 3 - NODE_PATH=$(which node) - NODE_VER=$(node -v) - echo sudo mv "$NODE_PATH" "$NODE_PATH.$NODE_VER" - sudo mv "$NODE_PATH" "$NODE_PATH.$NODE_VER" - echo "################################################################################" - echo "to restore backup: sudo rsync -a '"$NODE_PATH.$NODE_VER"' '$NODE_PATH'" - echo "################################################################################" - echo "" fi if [ -n "${NODEJS_VER}" ]; then diff --git a/setup.bash b/setup.bash index 21237c2..393f02c 100644 --- a/setup.bash +++ b/setup.bash @@ -3,7 +3,7 @@ # Installs node.js + dependencies for both Ubuntu and OS X # -# See https://github.com/coolaj86/iojs-install-script +# See https://github.com/coolaj86/node-install-script # # curl -fsSL https://example.com/setup.bash | bash @@ -153,21 +153,25 @@ if [ ! -e "/tmp/${INSTALL_DEPS_FILE}" ] then if [ -n "$(which curl)" ]; then curl --silent "${BASE_URL}/${INSTALL_DEPS_FILE}" \ - -o "/tmp/${INSTALL_DEPS_FILE}" || echo 'error downloading os setup script' + -o "/tmp/${INSTALL_DEPS_FILE}" || echo 'error downloading os deps script: '"${BASE_URL}/${INSTALL_DEPS_FILE}" curl --silent "${BASE_URL}/${INSTALL_FILE}" \ - -o "/tmp/${INSTALL_FILE}" || echo 'error downloading os setup script' + -o "/tmp/${INSTALL_FILE}" || echo 'error downloading os setup script: '"${BASE_URL}/${INSTALL_FILE}" elif [ -n "$(which wget)" ]; then wget --quiet "${BASE_URL}/${INSTALL_DEPS_FILE}" \ - -O "/tmp/${INSTALL_DEPS_FILE}" || echo 'error downloading os setup script' + -O "/tmp/${INSTALL_DEPS_FILE}" || echo 'error downloading os deps script: '"${BASE_URL}/${INSTALL_DEPS_FILE}" wget --quiet "${BASE_URL}/${INSTALL_FILE}" \ - -O "/tmp/${INSTALL_FILE}" || echo 'error downloading os setup script' + -O "/tmp/${INSTALL_FILE}" || echo 'error downloading os setup script: '"${BASE_URL}/${INSTALL_FILE}" else echo "Found neither 'curl' nor 'wget'. Can't Continue." exit 1 fi fi - +if [ ! -e "/tmp/${INSTALL_DEPS_FILE}" ] +then + echo "Error Downloading Install File" + exit 1 +fi ################ @@ -245,39 +249,23 @@ if [ -z "$NODEJS_VER" ]; then fi # -# iojs +# node # -if [ -n "$(which iojs | grep iojs 2>/dev/null)" ]; then -# iojs of some version is already installed - if [ "${NODEJS_VER}" == "$(iojs -v 2>/dev/null)" ]; then - echo iojs ${NODEJS_VER} is already installed +if [ -n "$(which node | grep node 2>/dev/null)" ]; then +# node of some version is already installed + if [ "${NODEJS_VER}" == "$(node -v 2>/dev/null)" ]; then + echo node ${NODEJS_VER} is already installed else echo "" echo "HEY, LISTEN:" echo "" - echo "${NODEJS_NAME} is already installed as iojs $(iojs -v | grep v)" + echo "node.js is already installed as node $(node -v | grep v)" echo "" - echo "to reinstall please first run: rm $(which iojs)" + echo "to reinstall please first run: rm $(which node)" echo "" fi + NODEJS_VER="" -elif [ "$(node -v 2>/dev/null)" != "$(iojs -v 2>/dev/null)" ]; then -# node of some version is already installed - echo "" - echo "HEY, LISTEN!" - echo "" - echo "You have node.js installed." - echo "Backing up $(which node) as $(which node).$(node -v)" - echo "" - sleep 3 - NODE_PATH=$(which node) - NODE_VER=$(node -v) - echo sudo mv "$NODE_PATH" "$NODE_PATH.$NODE_VER" - sudo mv "$NODE_PATH" "$NODE_PATH.$NODE_VER" - echo "################################################################################" - echo "to restore backup: sudo rsync -a '"$NODE_PATH.$NODE_VER"' '$NODE_PATH'" - echo "################################################################################" - echo "" fi if [ -n "${NODEJS_VER}" ]; then