From d08cfae873153a41bad818ee3135bd135816aed2 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sun, 21 Dec 2014 17:10:33 -0700 Subject: [PATCH 01/24] Initial commit --- .gitignore | 28 ++++++++ LICENSE | 202 +++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 4 ++ 3 files changed, 234 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..fda205a --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +node-install-script +=================== + +A script to install basic development tools for node (git, node, gcc, etc) From 71de7325011d30cabd8584e4755281f846055128 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sun, 21 Dec 2014 17:16:06 -0700 Subject: [PATCH 02/24] added scripts --- setup-mavericks.bash | 74 ++++++++++++++++++++ setup-ubuntu.bash | 40 +++++++++++ setup.bash | 158 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 272 insertions(+) create mode 100644 setup-mavericks.bash create mode 100644 setup-ubuntu.bash create mode 100644 setup.bash diff --git a/setup-mavericks.bash b/setup-mavericks.bash new file mode 100644 index 0000000..d93c79a --- /dev/null +++ b/setup-mavericks.bash @@ -0,0 +1,74 @@ +#!/bin/bash + +# curl -fsSL https://ldsconnect.org/setup-osx.bash | bash -c +NODE_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 + 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" +fi + +# node +CUR_NODE_VER=$(node -v 2>/dev/null) +if [ -n "$(which node | grep node)" ] && [ "${NODE_VER}" == "$(node -v 2>/dev/null)" ]; then + echo node ${NODE_VER} already installed +else + echo "installing node ${NODE_VER}..." + curl -fsSL "http://nodejs.org/dist/${NODE_VER}/node-${NODE_VER}.pkg" -o "/tmp/node-${NODE_VER}.pkg" + sudo /usr/sbin/installer -pkg "/tmp/node-${NODE_VER}.pkg" -target / + sudo chown -R $(whoami) /usr/local +fi diff --git a/setup-ubuntu.bash b/setup-ubuntu.bash new file mode 100644 index 0000000..cc81f45 --- /dev/null +++ b/setup-ubuntu.bash @@ -0,0 +1,40 @@ +#!/bin/bash + +# curl -fsSL https://ldsconnect.org/setup-linux.bash | bash -c + +NODE_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 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..." + sudo bash -c "apt-get install -qq -y git wget curl build-essential rsync < /dev/null" > /dev/null 2>/dev/null +fi + +# node +CUR_NODE_VER=$(node -v 2>/dev/null) +if [ -n "$(which node | grep node)" ] && [ "${NODE_VER}" == "$(node -v 2>/dev/null)" ]; then +#if [ "${NODE_VER}" == "${CUR_NODE_VER}" ]; then + echo node ${NODE_VER} already installed +else + echo "installing node ${NODE_VER}..." + curl -fsSL "http://nodejs.org/dist/${NODE_VER}/node-${NODE_VER}-linux-x64.tar.gz" \ + -o "/tmp/node-${NODE_VER}-linux-x64.tar.gz" + pushd /tmp + tar xf /tmp/node-${NODE_VER}-linux-x64.tar.gz + rm node-${NODE_VER}-linux-x64/{LICENSE,ChangeLog,README.md} + sudo rsync -a /tmp/node-${NODE_VER}-linux-x64/ /usr/local/ + sudo chown -R $(whoami) /usr/local +fi diff --git a/setup.bash b/setup.bash new file mode 100644 index 0000000..e4edbd6 --- /dev/null +++ b/setup.bash @@ -0,0 +1,158 @@ +#!/bin/bash + +# curl -s https://ldsconnect.org/setup.bash | bash +# wget -nv https://ldsconnect.org/setup.bash -O - | bash + +BASE_URL="https://ldsconnect.org" +NODE_VER="v0.11.14" +OS="unsupported" +ARCH="" + +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 "sudo yum" + echo "wget --quiet ${BASE_URL}/setup-fedora.bash -O /tmp/install-node.bash || echo 'error downloading os setup script'" + ;; + ubuntu) + wget --quiet "${BASE_URL}/setup-ubuntu.bash" -O /tmp/install-node.bash || echo 'error downloading os setup script' + ;; + yosemite) + # mavericks + curl --silent "${BASE_URL}/setup-mavericks.bash" -o /tmp/install-node.bash || echo 'error downloading os setup script' + ;; + mavericks) + curl --silent "${BASE_URL}/setup-mavericks.bash" -o /tmp/install-node.bash || echo 'error downloading os setup script' + ;; + mountain) + echo "wget cltools" + echo "curl --silent ${BASE_URL}/setup-mountain.bash -o /tmp/install-node.bash || echo 'error downloading os setup script'" + ;; + lion) + echo "wget cltools" + echo "curl --silent ${BASE_URL}/setup-lion.bash -o /tmp/install-node.bash || echo 'error downloading os setup script'" + ;; + snow) + echo "wget gcc-0.6.pkg" + echo "curl --silent ${BASE_URL}/setup-snow.bash -o /tmp/install-node.bash || echo 'error downloading os setup script'" + ;; + *) + echo "unsupported unknown os ${OS}" + exit 1 + ;; +esac + +echo "${OS}" "${ARCH}" +bash /tmp/install-node.bash "${NODE_VER}" + +# jshint +if [ -z "$(which jshint | grep jshint)" ]; then + echo "installing jshint..." + npm install --silent jshint -g > /dev/null +else + echo "jshint already installed" +fi + +# yo +if [ -z "$(which yo | grep yo)" ]; then + echo "installing yo (yeoman)..." + npm install --silent yo generator-angular -g > /dev/null +else + echo "yo (yeoman) already installed" +fi + +# bower +if [ -z "$(which bower | grep bower)" ]; then + echo "installing bower..." + npm install --silent bower -g > /dev/null +else + echo "bower already installed" +fi + +# jade +if [ -z "$(which jade | grep jade)" ]; then + echo "installing jade..." + npm install --silent jade -g > /dev/null +else + echo "jade already installed" +fi + +echo "" From 73e9a6495c7d500ee7e51d5065ffb8e26c5537b1 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sun, 21 Dec 2014 17:36:52 -0700 Subject: [PATCH 03/24] update docs, add npm modules --- README.md | 26 ++++++++++++++++++++++++++ setup.bash | 19 ++++++++++++++++++- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fda205a..c663bce 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,29 @@ node-install-script =================== A script to install basic development tools for node (git, node, gcc, etc) + +Works for any recent version of Ubuntu or OS X. + +```bash +curl -fsSL bit.ly/easy-install-node | bash + + +# For older version of ubuntu +wget -nv bit.ly/easy-install-node -O - | bash +``` + +This is what gets installed: + +* fail2ban (not necessary for development, but should be on every server) +* rsync +* curl +* wget +* git +* xcode / build-essential / gcc +* node +* jshint +* bower +* uglifyjs +* yo +* jade +* less diff --git a/setup.bash b/setup.bash index e4edbd6..e455e94 100644 --- a/setup.bash +++ b/setup.bash @@ -1,6 +1,6 @@ #!/bin/bash -# curl -s https://ldsconnect.org/setup.bash | bash +# curl -fsSL https://ldsconnect.org/setup.bash | bash # wget -nv https://ldsconnect.org/setup.bash -O - | bash BASE_URL="https://ldsconnect.org" @@ -155,4 +155,21 @@ else echo "jade already installed" fi +# less +if [ -z "$(which lessc | grep lessc)" ]; then + echo "installing lessc..." + npm install --silent less -g > /dev/null +else + echo "lessc already installed" +fi + +# uglifyjs +if [ -z "$(which uglifyjs | grep uglifyjs)" ]; then + echo "installing uglifyjs..." + npm install --silent uglify-js -g > /dev/null +else + echo "uglifyjs already installed" +fi + + echo "" From fa7b6a97256ef28a8cf8270aeb52a0256e2c2883 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sun, 21 Dec 2014 17:40:38 -0700 Subject: [PATCH 04/24] update docs --- README.md | 2 +- setup.bash | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c663bce..1cf33ad 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ This is what gets installed: * curl * wget * git -* xcode / build-essential / gcc +* xcode / brew / build-essential / gcc * node * jshint * bower diff --git a/setup.bash b/setup.bash index e455e94..2dd1d8e 100644 --- a/setup.bash +++ b/setup.bash @@ -157,18 +157,18 @@ fi # less if [ -z "$(which lessc | grep lessc)" ]; then - echo "installing lessc..." + echo "installing lessc (less)..." npm install --silent less -g > /dev/null else - echo "lessc already installed" + echo "lessc (less) already installed" fi # uglifyjs if [ -z "$(which uglifyjs | grep uglifyjs)" ]; then - echo "installing uglifyjs..." + echo "installing uglifyjs (uglify-js)..." npm install --silent uglify-js -g > /dev/null else - echo "uglifyjs already installed" + echo "uglifyjs (uglify-js) already installed" fi From 4c350592670a2fd95a91b79ab191e49c9d99b20b Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sat, 27 Dec 2014 18:10:25 -0700 Subject: [PATCH 05/24] add pkg-config this is needed by node-sharp, libvips, and many other libraries --- setup-ubuntu.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup-ubuntu.bash b/setup-ubuntu.bash index cc81f45..ba32d3e 100644 --- a/setup-ubuntu.bash +++ b/setup-ubuntu.bash @@ -17,10 +17,10 @@ if [ -z "$(which fail2ban-server | grep fail2ban)" ]; then fi # git, wget, curl, build-essential -if [ -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)" ] +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..." - sudo bash -c "apt-get install -qq -y git wget curl build-essential rsync < /dev/null" > /dev/null 2>/dev/null + sudo bash -c "apt-get install -qq -y git wget curl build-essential rsync pkg-config < /dev/null" > /dev/null 2>/dev/null fi # node From 3d1ad9385ad4d5a15cf94bf0962a22c5bd9d8570 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sat, 27 Dec 2014 18:12:13 -0700 Subject: [PATCH 06/24] Update setup-mavericks.bash --- setup-mavericks.bash | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/setup-mavericks.bash b/setup-mavericks.bash index d93c79a..2a0ed99 100644 --- a/setup-mavericks.bash +++ b/setup-mavericks.bash @@ -62,6 +62,13 @@ else echo "fail2ban already installed" fi +if [ -z "$(which pkg-config | grep pkg-config)" ]; then + echo "installing pkg-config..." + brew install pkg-config +else + echo "fail2ban already installed" +fi + # node CUR_NODE_VER=$(node -v 2>/dev/null) if [ -n "$(which node | grep node)" ] && [ "${NODE_VER}" == "$(node -v 2>/dev/null)" ]; then From 40befcd2df2067eed73ec7892bb5ddbec72f45b9 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sun, 28 Dec 2014 01:24:33 -0700 Subject: [PATCH 07/24] use github raw as baseurl --- setup.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.bash b/setup.bash index 2dd1d8e..a8b5de1 100644 --- a/setup.bash +++ b/setup.bash @@ -3,7 +3,7 @@ # curl -fsSL https://ldsconnect.org/setup.bash | bash # wget -nv https://ldsconnect.org/setup.bash -O - | bash -BASE_URL="https://ldsconnect.org" +BASE_URL="https://raw.githubusercontent.com/coolaj86/node-install-script/master" NODE_VER="v0.11.14" OS="unsupported" ARCH="" From b3909a1482a8735acd34adc55aabdec506484ca0 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sun, 28 Dec 2014 01:25:26 -0700 Subject: [PATCH 08/24] comment about example.com --- setup.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.bash b/setup.bash index a8b5de1..990f9dc 100644 --- a/setup.bash +++ b/setup.bash @@ -1,7 +1,7 @@ #!/bin/bash -# curl -fsSL https://ldsconnect.org/setup.bash | bash -# wget -nv https://ldsconnect.org/setup.bash -O - | bash +# curl -fsSL https://example.com/setup.bash | bash +# wget -nv https://example.com/setup.bash -O - | bash BASE_URL="https://raw.githubusercontent.com/coolaj86/node-install-script/master" NODE_VER="v0.11.14" From 0ecda410e7fb14aac7ebe67807527a14145f630d Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sun, 28 Dec 2014 01:48:20 -0700 Subject: [PATCH 09/24] log pkg-config --- setup-ubuntu.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup-ubuntu.bash b/setup-ubuntu.bash index ba32d3e..cca9f25 100644 --- a/setup-ubuntu.bash +++ b/setup-ubuntu.bash @@ -19,7 +19,7 @@ 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..." + 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 From 11650364cfffa5f536096f04b8d02d07d1e54556 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 2 Jan 2015 12:30:47 -0700 Subject: [PATCH 10/24] added missing '[' --- setup-ubuntu.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup-ubuntu.bash b/setup-ubuntu.bash index cca9f25..ab434e9 100644 --- a/setup-ubuntu.bash +++ b/setup-ubuntu.bash @@ -17,7 +17,7 @@ if [ -z "$(which fail2ban-server | grep fail2ban)" ]; then 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)" ] +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 From 0241dcf75bf1ef0e0d654c3ee0e7c8e8fb02fec9 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 8 Jan 2015 11:16:03 -0700 Subject: [PATCH 11/24] lighten the load --- setup.bash | 41 ----------------------------------------- 1 file changed, 41 deletions(-) diff --git a/setup.bash b/setup.bash index 990f9dc..35f36f5 100644 --- a/setup.bash +++ b/setup.bash @@ -131,45 +131,4 @@ else echo "jshint already installed" fi -# yo -if [ -z "$(which yo | grep yo)" ]; then - echo "installing yo (yeoman)..." - npm install --silent yo generator-angular -g > /dev/null -else - echo "yo (yeoman) already installed" -fi - -# bower -if [ -z "$(which bower | grep bower)" ]; then - echo "installing bower..." - npm install --silent bower -g > /dev/null -else - echo "bower already installed" -fi - -# jade -if [ -z "$(which jade | grep jade)" ]; then - echo "installing jade..." - npm install --silent jade -g > /dev/null -else - echo "jade already installed" -fi - -# less -if [ -z "$(which lessc | grep lessc)" ]; then - echo "installing lessc (less)..." - npm install --silent less -g > /dev/null -else - echo "lessc (less) already installed" -fi - -# uglifyjs -if [ -z "$(which uglifyjs | grep uglifyjs)" ]; then - echo "installing uglifyjs (uglify-js)..." - npm install --silent uglify-js -g > /dev/null -else - echo "uglifyjs (uglify-js) already installed" -fi - - echo "" From 8e378b5c3a08b717015f4a329bf934d48b3cde8c Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 8 Jan 2015 11:17:15 -0700 Subject: [PATCH 12/24] lighten the load --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 1cf33ad..2d3bd29 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,9 @@ This is what gets installed: * xcode / brew / build-essential / gcc * node * jshint + +These are **not installed**, but you may wish to use them if you're doing front-end work as well + * bower * uglifyjs * yo From 10ee7619df77974442de8f95c9827516e9eebb84 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 8 Jan 2015 11:23:34 -0700 Subject: [PATCH 13/24] added screencast --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 2d3bd29..dc112ac 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,14 @@ This is what gets installed: * node * jshint +Screencast +========== + +[How to Setup a VPS for Node.js Development](https://www.youtube.com/watch?v=ypjzi1axH2A) [(3:05) installing node](https://www.youtube.com/watch?v=ypjzi1axH2A#t=185) + +Front-End Extras +================ + These are **not installed**, but you may wish to use them if you're doing front-end work as well * bower From cded0da0f42786563b66158c0ba2e6ae20b1da23 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 8 Jan 2015 11:23:57 -0700 Subject: [PATCH 14/24] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dc112ac..06d945f 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ This is what gets installed: Screencast ========== -[How to Setup a VPS for Node.js Development](https://www.youtube.com/watch?v=ypjzi1axH2A) [(3:05) installing node](https://www.youtube.com/watch?v=ypjzi1axH2A#t=185) +[How to Setup a VPS for Node.js Development](https://www.youtube.com/watch?v=ypjzi1axH2A) - [(3:05 installing node](https://www.youtube.com/watch?v=ypjzi1axH2A#t=185)) Front-End Extras ================ From a817c320060ab21981277981dea28d2e3ddef435 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 8 Jan 2015 11:24:46 -0700 Subject: [PATCH 15/24] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 06d945f..f2a8b62 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ This is what gets installed: Screencast ========== -[How to Setup a VPS for Node.js Development](https://www.youtube.com/watch?v=ypjzi1axH2A) - [(3:05 installing node](https://www.youtube.com/watch?v=ypjzi1axH2A#t=185)) +[How to Setup a VPS for Node.js Development](https://www.youtube.com/watch?v=ypjzi1axH2A) - [(3:06 installing node](https://www.youtube.com/watch?v=ypjzi1axH2A#t=186)) Front-End Extras ================ From 2d1a3a697d57146b79f599eaa0405b1acf591049 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 8 Jan 2015 11:27:16 -0700 Subject: [PATCH 16/24] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f2a8b62..d13a380 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ This is what gets installed: * curl * wget * git -* xcode / brew / build-essential / gcc +* xcode / brew / build-essential / pkg-config / gcc * node * jshint From 5fb6c3488ee0ab55632d67d2382620e3ecc99020 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 8 Jan 2015 11:37:33 -0700 Subject: [PATCH 17/24] user may specify NODE_VER --- setup.bash | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/setup.bash b/setup.bash index 35f36f5..bdd226e 100644 --- a/setup.bash +++ b/setup.bash @@ -4,7 +4,12 @@ # wget -nv https://example.com/setup.bash -O - | bash BASE_URL="https://raw.githubusercontent.com/coolaj86/node-install-script/master" -NODE_VER="v0.11.14" +if [ -f "/tmp/NODE_VER" ]; then + NODE_VER=$(cat /tmp/NODE_VER | grep v) +fi +if [ -z "$NODE_VER" ]; then + NODE_VER="v0.11.14" +fi OS="unsupported" ARCH="" From b1952e44f6ea2d35e832d222d6de9e4dcfcd8648 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 8 Jan 2015 11:39:49 -0700 Subject: [PATCH 18/24] specify version of node to install --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d13a380..75809fc 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,16 @@ A script to install basic development tools for node (git, node, gcc, etc) Works for any recent version of Ubuntu or OS X. ```bash +# Specify the version of node to install +echo "v0.11.14" > /tmp/NODE_VER + +# And install away! curl -fsSL bit.ly/easy-install-node | bash +``` +**For older versions of Ubuntu**: -# For older version of ubuntu +```bash wget -nv bit.ly/easy-install-node -O - | bash ``` From 32a5b5e6107f8c578189329231e8b46df5b2a7c3 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 8 Jan 2015 11:44:48 -0700 Subject: [PATCH 19/24] print the version of node, if installed --- setup.bash | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/setup.bash b/setup.bash index bdd226e..3f9adfd 100644 --- a/setup.bash +++ b/setup.bash @@ -4,6 +4,16 @@ # wget -nv https://example.com/setup.bash -O - | bash BASE_URL="https://raw.githubusercontent.com/coolaj86/node-install-script/master" + +if [ -n "$(which node 2>/dev/null || false)" ]; then + echo "" + echo "HEY, LISTEN:" + echo "node is already install as $(node -v | grep v)" + echo "" + echo "to reinstall please first run: rm $(which node)" + echo "" +fi + if [ -f "/tmp/NODE_VER" ]; then NODE_VER=$(cat /tmp/NODE_VER | grep v) fi From c17d4a2459a95af2823aaae88f77ed03b06aeafd Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 8 Jan 2015 11:57:50 -0700 Subject: [PATCH 20/24] check existing node version --- setup-ubuntu.bash | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/setup-ubuntu.bash b/setup-ubuntu.bash index ab434e9..6bab698 100644 --- a/setup-ubuntu.bash +++ b/setup-ubuntu.bash @@ -24,17 +24,32 @@ then fi # node -CUR_NODE_VER=$(node -v 2>/dev/null) -if [ -n "$(which node | grep node)" ] && [ "${NODE_VER}" == "$(node -v 2>/dev/null)" ]; then -#if [ "${NODE_VER}" == "${CUR_NODE_VER}" ]; then - echo node ${NODE_VER} already installed -else +if [ -n "$(which node | grep node 2>/dev/null)" ]; then + if [ "${NODE_VER}" == "$(node -v 2>/dev/null)" ]; then + echo node ${NODE_VER} already installed + else + echo "" + echo "HEY, LISTEN:" + echo "node is already installed as $(node -v | grep v)" + echo "" + echo "to reinstall please first run: rm $(which node)" + echo "" + NODE_VER="" + fi +fi + +if [ -n "${NODE_VER}" ]; then + if [ -n "$(arch | grep 64)" ]; then + ARCH="x64" + else + ARCH="x86" + fi echo "installing node ${NODE_VER}..." - curl -fsSL "http://nodejs.org/dist/${NODE_VER}/node-${NODE_VER}-linux-x64.tar.gz" \ - -o "/tmp/node-${NODE_VER}-linux-x64.tar.gz" + curl -fsSL "http://nodejs.org/dist/${NODE_VER}/node-${NODE_VER}-linux-${ARCH}.tar.gz" \ + -o "/tmp/node-${NODE_VER}-linux-${ARCH}.tar.gz" pushd /tmp - tar xf /tmp/node-${NODE_VER}-linux-x64.tar.gz + tar xf /tmp/node-${NODE_VER}-linux-${ARCH}.tar.gz rm node-${NODE_VER}-linux-x64/{LICENSE,ChangeLog,README.md} - sudo rsync -a /tmp/node-${NODE_VER}-linux-x64/ /usr/local/ + sudo rsync -a "/tmp/node-${NODE_VER}-linux-${ARCH}/" /usr/local/ sudo chown -R $(whoami) /usr/local fi From 3c2c7fd0941e206ac799b21a6c2c43a312ee754c Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 8 Jan 2015 12:00:11 -0700 Subject: [PATCH 21/24] check for existing node version --- setup-mavericks.bash | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/setup-mavericks.bash b/setup-mavericks.bash index 2a0ed99..676f322 100644 --- a/setup-mavericks.bash +++ b/setup-mavericks.bash @@ -70,10 +70,22 @@ else fi # node -CUR_NODE_VER=$(node -v 2>/dev/null) -if [ -n "$(which node | grep node)" ] && [ "${NODE_VER}" == "$(node -v 2>/dev/null)" ]; then - echo node ${NODE_VER} already installed -else +if [ -n "$(which node | grep node 2>/dev/null)" ]; then + NODE_VER="" + + if [ "${NODE_VER}" == "$(node -v 2>/dev/null)" ]; then + echo node ${NODE_VER} already installed + else + echo "" + echo "HEY, LISTEN:" + echo "node is already installed as $(node -v | grep v)" + echo "" + echo "to reinstall please first run: rm $(which node)" + echo "" + fi +fi + +if [ -n "${NODE_VER}" ]; then echo "installing node ${NODE_VER}..." curl -fsSL "http://nodejs.org/dist/${NODE_VER}/node-${NODE_VER}.pkg" -o "/tmp/node-${NODE_VER}.pkg" sudo /usr/sbin/installer -pkg "/tmp/node-${NODE_VER}.pkg" -target / From e8993985bdf272d772fedfcbd2ee059fd6a3c300 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 8 Jan 2015 12:00:38 -0700 Subject: [PATCH 22/24] Update setup-ubuntu.bash --- setup-ubuntu.bash | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup-ubuntu.bash b/setup-ubuntu.bash index 6bab698..695685e 100644 --- a/setup-ubuntu.bash +++ b/setup-ubuntu.bash @@ -25,6 +25,8 @@ fi # node if [ -n "$(which node | grep node 2>/dev/null)" ]; then + NODE_VER="" + if [ "${NODE_VER}" == "$(node -v 2>/dev/null)" ]; then echo node ${NODE_VER} already installed else @@ -34,7 +36,6 @@ if [ -n "$(which node | grep node 2>/dev/null)" ]; then echo "" echo "to reinstall please first run: rm $(which node)" echo "" - NODE_VER="" fi fi From 4bf16fd847559d2534fce2b86414729d5759e90c Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 8 Jan 2015 12:04:00 -0700 Subject: [PATCH 23/24] typo fix in output --- setup-mavericks.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup-mavericks.bash b/setup-mavericks.bash index 676f322..da80048 100644 --- a/setup-mavericks.bash +++ b/setup-mavericks.bash @@ -66,7 +66,7 @@ if [ -z "$(which pkg-config | grep pkg-config)" ]; then echo "installing pkg-config..." brew install pkg-config else - echo "fail2ban already installed" + echo "pkg-config already installed" fi # node From c989855923bf7127ed17da621e2f6662f95179e5 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 8 Jan 2015 12:05:07 -0700 Subject: [PATCH 24/24] Update setup-mavericks.bash --- setup-mavericks.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup-mavericks.bash b/setup-mavericks.bash index da80048..cc2fd9d 100644 --- a/setup-mavericks.bash +++ b/setup-mavericks.bash @@ -89,5 +89,5 @@ if [ -n "${NODE_VER}" ]; then echo "installing node ${NODE_VER}..." curl -fsSL "http://nodejs.org/dist/${NODE_VER}/node-${NODE_VER}.pkg" -o "/tmp/node-${NODE_VER}.pkg" sudo /usr/sbin/installer -pkg "/tmp/node-${NODE_VER}.pkg" -target / - sudo chown -R $(whoami) /usr/local + sudo chown -R $(whoami) /usr/local 2>/dev/null fi