Compare commits

...

229 Commits

Author SHA1 Message Date
AJ ONeal a431978582 docs: fix typo 2022-08-19 19:05:47 +00:00
AJ ONeal 6c3fa218ba docs: update deprecation notice 2022-08-19 19:05:19 +00:00
AJ ONeal 79d4d239ad bugfix: don't block macOS 11+ 2021-09-08 03:20:15 +00:00
AJ ONeal 60f206373c Update 'install.sh' 2021-09-04 21:14:30 +00:00
AJ ONeal 22c741817c point to webinstall.dev 2020-04-28 02:32:35 +00:00
AJ ONeal 1f3a195fe9 update link 2019-04-09 03:48:40 +00:00
AJ ONeal c3890ca8a9 silence stupid errors 2019-04-04 06:07:54 +00:00
AJ ONeal 689fa58531 silence unimportant errors 2019-04-04 06:05:25 +00:00
AJ ONeal 895dcd31f2 NODE_VERSION taks preference over NODEJS_VER 2018-09-14 06:49:59 +00:00
AJ ONeal b8acbae85f fix unbound var 2018-09-14 06:46:56 +00:00
AJ ONeal 509ee32688 remove trailing / 2018-09-10 08:21:38 +00:00
AJ ONeal 3109f4bb94 syntax highlighting 2018-09-10 08:20:38 +00:00
AJ ONeal 05199bcf82 refactor the docs 2018-09-10 08:19:11 +00:00
AJ ONeal 1387929dfc NODEJS_VER => NODE_VERSION 2018-09-10 07:45:08 +00:00
AJ ONeal c15264b763 Update 'README.md' 2018-09-10 07:40:50 +00:00
AJ ONeal 8be0a29b7d remove tmpdir on success 2018-07-26 22:10:46 +00:00
AJ ONeal 972d510f59 better tmpdir 2018-07-26 22:08:15 +00:00
AJ ONeal 92ec7ad5b6 use better tmp dir 2018-07-26 22:07:02 +00:00
AJ ONeal 95c0caf4be cleanup 2018-07-26 22:02:16 +00:00
AJ ONeal ed24276356 bugfix for Arch Linux sans rsync 2018-07-26 22:00:40 +00:00
AJ ONeal dddf31db8d do copy links with rsync 2018-07-26 21:48:34 +00:00
AJ ONeal a1af3328cb copy -Hr as best approximation for rsync -Kr 2018-07-26 21:47:05 +00:00
AJ ONeal 515bdce8c2 rsync with -Kr instead of -a to not break symlinks in /usr/local 2018-07-26 21:41:42 +00:00
AJ ONeal 4ea01c4c42 don't include * in quotes 2018-07-26 20:51:20 +00:00
AJ ONeal 45adb12ae1 cp has slightly different symmantecs 2018-07-26 20:49:40 +00:00
AJ ONeal 0d6e15ee62 don't rely on rsync 2018-07-26 20:48:00 +00:00
AJ ONeal 8a14fc8ede assume no dev tools by default 2018-07-26 20:38:51 +00:00
AJ ONeal 2309008c5f failsafe exit if node is installed 2018-06-27 10:20:10 +00:00
AJ ONeal f2a8c2fc49 allow ANDROID_ROOT to be undefined 2018-06-26 05:54:06 +00:00
AJ ONeal b562d6dd3b merge 2018-06-23 16:31:37 -06:00
AJ ONeal bad41027ad only sudo as fallback, use mktemp -d 2018-06-23 16:29:13 -06:00
AJ ONeal 5f231f9d22 set ANDROID_ROOT empty 2018-06-23 05:16:13 +00:00
AJ ONeal 0171162f20 typo fix 2018-06-20 02:11:24 +00:00
AJ ONeal 3ced314799 fix comparison 2018-06-20 02:07:43 +00:00
AJ ONeal 00c986e483 regression fix: allow empty NODEJS_VER 2018-06-20 02:06:38 +00:00
AJ ONeal 97c7ef9793 make sure directory exists before chowning it 2018-06-18 21:40:42 +00:00
AJ ONeal c747edb99a update installer examples 2018-06-14 21:10:05 +00:00
AJ ONeal 62bc523d03 fix #1 typo / misspelling of PREFIX
PREFIX not PREFIIX as per #1
2018-06-05 07:36:21 +00:00
AJ ONeal 82e6ace060 make docs more readable 2018-05-24 21:34:44 +00:00
AJ ONeal 748c51a687 show selecting version in docs 2018-05-24 21:31:04 +00:00
AJ ONeal 0c7d0a7da6 note desired version number when already installed 2018-05-24 21:13:55 +00:00
AJ ONeal be9344dbea match literal '.' for version, not wildcard 2018-05-24 21:12:37 +00:00
AJ ONeal 2d628014d0 tail typo fix 2018-05-24 21:09:02 +00:00
AJ ONeal 17c0b01ee0 unset far typo fix 2018-05-24 21:08:12 +00:00
AJ ONeal e436cdb64d allow use of partial version number i.e. v10 or v10.2 2018-05-24 21:07:04 +00:00
AJ ONeal a443dd04d3 fix for unbound var 2018-05-12 14:37:54 -06:00
AJ ONeal 5af26c6c86 Merge branch 'master' into v1.1 2018-05-12 13:53:53 -06:00
AJ ONeal a9e1370b58 don't reset NODEJS_VER to empty string 2018-05-12 13:53:46 -06:00
AJ ONeal 1edc07515f Merge branch 'master' of ssh://git.coolaj86.com:22042/coolaj86/node-installer.sh 2018-05-12 13:48:13 -06:00
AJ ONeal 1a7d21b850 prefix links with https 2018-05-12 19:46:57 +00:00
AJ ONeal 7809937d74 use env var for NODEJS_VER, update version 2018-05-12 13:45:15 -06:00
AJ ONeal 3adefcc4a8 update 2018-03-20 19:56:45 -06:00
AJ ONeal ae2511f592 update 2018-03-20 19:56:09 -06:00
AJ ONeal 08002c572a fix argument passing 2017-12-08 22:00:46 +00:00
AJ ONeal 3e7745177f Merge branch 'master' of ssh://git.coolaj86.com:22042/coolaj86/node-installer.sh 2017-11-07 04:46:22 -07:00
AJ ONeal 5d39eef143 less verbose output 2017-11-07 04:45:52 -07:00
AJ ONeal 90cdb8f93e Merge branch 'v1' 2017-11-06 13:21:19 -07:00
AJ ONeal ccb1487b36 merged old and new 2017-11-06 13:20:05 -07:00
AJ ONeal e57069fe50 rename for merge 2017-11-06 13:17:09 -07:00
AJ ONeal e9c21e3063 Merge branch 'master' of ssh://git.coolaj86.com:22042/coolaj86/node-installer.sh 2017-11-03 15:21:35 -06:00
AJ ONeal 216aa9b420 more helpful path output 2017-11-03 15:21:25 -06:00
AJ ONeal d3069471e7 Options 2017-11-03 21:16:35 +00:00
AJ ONeal 65ad946056 document install location env variable 2017-11-03 15:11:57 -06:00
AJ ONeal b0b829fd91 update urls 2017-11-03 14:51:47 -06:00
AJ ONeal bacd1a4537 rename setup.bash -> install.sh 2017-11-03 14:32:42 -06:00
AJ ONeal 963f551a98 update urls 2017-11-03 14:31:34 -06:00
AJ ONeal 32839e69ba add -L to curl to follow redirects 2017-11-02 04:20:56 +00:00
AJ ONeal 4090196e84 add -L to curl 2017-11-02 04:19:58 +00:00
AJ ONeal 2adfec1fd6 Update 'README.md' 2017-10-29 03:41:44 +00:00
richdex14 aed892007f Clean up debugging from copying paths issue. 2017-09-04 14:35:23 -06:00
richdex14 6252737cc1 Update setup-deps-ubuntu.bash to use portable `sudo_cmd` syntax 2017-09-04 13:35:16 -06:00
richdex14 2f9f3c0c82 Update setup-node-ubuntu.bash to use portable `$sudo_cmd` syntax 2017-09-04 12:20:00 -06:00
richdex14 a24f92df98 Update setup.bash to use portable `$sudo_cmd` syntax 2017-09-04 12:18:57 -06:00
richdex14 351056f9bc Update setup-node-ubuntu.bash 2017-09-04 11:39:30 -06:00
richdex14 28c1ad8484 Debugging copying issues 2017-09-04 11:35:52 -06:00
richdex14 ae331149f7 Debugging file copy issues on daplie board. 2017-09-04 11:28:57 -06:00
richdex14 16a6d7e18c Debugging installer script issues on daplie board. 2017-09-04 11:11:18 -06:00
richdex14 6c0afe6488 Update setup-node-ubuntu.bash to use portable copy method as opposed to non-portable `tar --strip-components` in unpacking step. 2017-09-03 21:13:47 -06:00
richdex14 31b92cdadb Update setup-node-ubuntu.bash to replace `arch` call with portable call to `uname -a` 2017-09-03 20:47:40 -06:00
richdex14 561a2e2fa1 Correcting copy-paste mistake in `setup-node-ubuntu.bash`. Restoring version from coolaj86 repo. 2017-09-03 20:46:44 -06:00
richdex14 8a5593363d Update setup.bash to work with portable `head` command. 2017-09-02 12:05:22 -06:00
richdex14 69bc78680d Update setup.bash to use Daplie repo instead of coolaj86 repo. 2017-09-02 11:56:17 -06:00
richdex14 8a3f4ba77f Update setup.bash to work on Marvell arm64 OS 2017-09-02 11:45:28 -06:00
richdex14 a99583fb1d Update setup-min.sh to use Daplie repo instead of coolaj86 private repo. 2017-09-01 20:54:43 -06:00
richdex14 0948a728c3 Update setup-node-ubuntu.bash to use portable `head -n` syntax. 2017-09-01 20:45:22 -06:00
richdex14 fb0a8f6372 Update setup-node-ubuntu.bash to change to Daplie project from coolaj86 private project. 2017-09-01 20:16:12 -06:00
richdex14 de522df09b Update setup-node-ubuntu.bash to allow for `Marvell` OS. This is for our development purposes. In the future, we will have a fully custom image with the name containing `Daplie` 2017-09-01 20:09:55 -06:00
AJ ONeal b96b79f3ed Update setup.bash 2017-07-21 15:47:05 -06:00
AJ ONeal efe4bde88e no yarn 2017-06-15 20:44:21 -06:00
AJ ONeal 1b271ba7e5 no yarn 2017-06-15 19:39:46 -06:00
AJ ONeal 01bc3bf064 fix typo 2017-06-14 15:18:53 -06:00
AJ ONeal 586863fb75 check install deps file separately 2017-05-29 18:03:29 -06:00
AJ ONeal 77c6be5840 add if around install deps 2017-05-29 17:58:16 -06:00
AJ ONeal a05cf035b3 typo fix 2017-05-25 15:22:04 -06:00
AJ ONeal f2f1cb94d2 typo fix 2017-05-25 15:18:30 -06:00
AJ ONeal 6a73356dd9 print install path 2017-05-25 15:15:56 -06:00
AJ ONeal b33f1136f2 consolidate installer 2017-05-25 15:08:33 -06:00
AJ ONeal 0e84c903e9 typo fix 2017-05-25 11:50:45 -06:00
AJ ONeal 6fb08fe2af check python, replace which with type -p 2017-05-25 11:24:37 -06:00
AJ ONeal ae72817e43 Update README.md 2017-05-25 11:20:00 -06:00
AJ ONeal 228bdc5e1c nix fail2ban 2017-05-25 11:17:40 -06:00
AJ ONeal 59e420471b Update setup-deps-mavericks.bash 2017-05-25 11:15:33 -06:00
AJ ONeal 3e36adfbcb Update setup-deps-ubuntu.bash 2017-05-25 11:15:30 -06:00
AJ ONeal d41b5b1adf Update setup.bash 2017-05-16 15:28:17 -06:00
AJ ONeal 49d19e6cdb add yarn 2017-05-16 15:17:28 -06:00
AJ ONeal 1a41b29bfb Update setup-node-mavericks.bash 2017-05-15 22:23:36 -06:00
AJ ONeal 6d1df2e7e4 use bin, not src, duh! 2017-05-15 22:20:57 -06:00
AJ ONeal 1c05eb8a68 Update setup-min.sh 2017-05-15 22:12:58 -06:00
AJ ONeal 6dde1965fc Update setup-node-mavericks.bash 2017-05-15 22:10:02 -06:00
AJ ONeal e9837d9445 Update setup-node-mavericks.bash 2017-05-15 22:08:36 -06:00
AJ ONeal 0a5ec4deba Update setup-min.sh 2017-05-15 22:05:55 -06:00
AJ ONeal 933ceba356 Update setup-min.sh 2017-05-15 21:57:29 -06:00
AJ ONeal 5a1edbd2e4 Update setup-node-ubuntu.bash 2017-05-15 21:57:16 -06:00
AJ ONeal 216bcb8796 Update setup-node-mavericks.bash 2017-05-15 21:56:56 -06:00
AJ ONeal 30627ef933 Update setup-min.sh 2017-05-15 21:56:32 -06:00
AJ ONeal b6c4f023f5 Update setup-min.sh 2017-05-15 21:56:04 -06:00
AJ ONeal e93042403c Update setup-min.sh 2017-05-15 21:55:30 -06:00
AJ ONeal 1bc7b66208 Update setup-node-ubuntu.bash 2017-05-15 21:54:35 -06:00
AJ ONeal 24b68d4f90 Update setup-node-mavericks.bash 2017-05-15 21:54:13 -06:00
AJ ONeal 85ad20281f derive $node_install_path from $NODE_PATH 2017-05-15 21:53:39 -06:00
AJ ONeal c3e6fa9660 Update setup-node-ubuntu.bash 2017-05-15 21:51:46 -06:00
AJ ONeal 94e18f04a9 Derive $node_install_path from $NODE_PATH 2017-05-15 21:38:48 -06:00
AJ ONeal 2831949296 use NODE_PATH for node_install_path 2017-05-15 21:37:06 -06:00
AJ ONeal 5b17c6e5fd remove old iojs references 2017-05-08 20:22:57 -06:00
AJ ONeal 4155a7c639 removing old crufty io.js references 2017-05-08 19:36:24 +00:00
AJ ONeal 2cfa00cced Update setup-min.sh 2017-05-08 16:20:59 +00:00
AJ ONeal 4011161397 Update README.md 2017-04-24 17:20:38 +00:00
AJ ONeal 67245d84fc Update README.md 2017-04-07 02:29:04 +00:00
AJ ONeal a5d7a27747 update links 2017-04-06 20:19:16 -06:00
AJ ONeal c65932db08 Update setup.bash 2017-04-07 02:09:14 +00:00
AJ ONeal 020fe6b3d6 revert 2017-04-06 20:07:07 -06:00
AJ ONeal c243b8bb89 Update setup.bash 2017-04-07 02:05:09 +00:00
AJ ONeal d5fb60b2a9 Update setup-deps-mavericks.bash 2017-04-07 01:45:10 +00:00
AJ ONeal 891dd40394 Update README.md 2016-11-25 10:52:04 -07:00
AJ ONeal 2f42061544 support pine64, raspberry pi 3 2016-06-27 22:02:34 +00:00
Joshua Mudge dde86e4db2 Added support for Zorin OS 2016-05-12 17:54:54 -06:00
Joshua Mudge fe16a47cb6 Added support for Trisquel 2016-05-12 17:54:15 -06:00
Joshua Mudge c8d1657124 Added support for Elementary OS 2016-05-12 17:53:37 -06:00
Joshua Mudge 2c16603901 Added support for latest Debian 2016-05-12 17:50:29 -06:00
Joshua Mudge 4eccc5c807 Added Linux Mint support 2016-05-12 17:47:58 -06:00
AJ ONeal 9163e8e4e5 allow npm to install to /usr/local/bin/ 2016-04-18 10:01:05 -06:00
AJ ONeal 0241804132 allow npm to install to /usr/local/bin/ 2016-04-18 10:00:44 -06:00
AJ ONeal 4f96105db3 change perms on /usr/local/lib/node_modules/ only 2016-04-18 09:55:37 -06:00
AJ ONeal 3f364aa1ed change perms on /usr/local/lib/node_modules/ only 2016-04-18 09:55:11 -06:00
AJ ONeal 3e0dbfed66 omit false error message 2016-03-28 17:19:18 -04:00
AJ ONeal 1445f20fca fix iojs-install-script#6 2016-03-28 17:13:38 -04:00
AJ ONeal 5658598c4a merged iojs-install-script#6 2016-03-28 17:12:06 -04:00
AJ ONeal 2648050562 cleanup 2016-03-28 17:06:16 -04:00
AJ ONeal 5a54bd3c50 cleanup 2016-03-28 17:05:29 -04:00
AJ ONeal 06a6c22afb typo fix 2016-03-28 17:01:51 -04:00
AJ ONeal 6229b43e22 cleanup 2016-03-28 17:00:38 -04:00
AJ ONeal 16dee18802 cleanup 2016-03-28 16:56:29 -04:00
AJ ONeal 4eeef938b6 io.js -> node.js 2016-03-28 16:35:23 -04:00
AJ ONeal 70ba60508c io.js -> node.js 2016-03-28 16:24:37 -04:00
AJ ONeal 863a949524 Merge branch 'iojs' 2016-03-28 16:23:26 -04:00
AJ ONeal 20ebf115c9 io.js -> node.js 2016-03-28 16:11:01 -04:00
AJ ONeal 40ab864ee8 updating iojs -> node.js 2016-03-28 15:50:12 -04:00
AJ ONeal cfcb236d39 Merge pull request #4 from strebl/fix-3
fix wget command. fixes #3
2016-02-09 13:47:35 -07:00
AJ ONeal 9d7e5f6442 remove bc 2015-12-22 21:50:41 -05:00
AJ ONeal d9f6f974ae remove bc 2015-12-22 21:47:52 -05:00
AJ ONeal 1f63791ef9 Update setup.bash 2015-12-22 21:46:44 -05:00
AJ ONeal 2398ca578f io.js -> node.js again 2015-12-09 12:40:29 -08:00
Manuel Strebel 80b80bbfc6 fix wget command 2015-09-17 14:49:13 +02:00
AJ ONeal d8c75b08f4 install io.js if 1 <= x < 4, otherwise install node.js 2015-09-11 13:35:08 -06:00
AJ ONeal 701513faa9 prepare to update to nodejs 4.0.0 2015-09-11 12:43:13 -06:00
AJ ONeal 139be1b26d Update README.md 2015-08-22 00:56:35 -06:00
AJ ONeal 1ec6722544 Update README.md 2015-06-09 00:17:55 -06:00
AJ ONeal fa01634643 correct wget command 2015-04-22 10:54:37 -06:00
AJ ONeal f5f40aaed8 correct wget command 2015-04-22 10:54:08 -06:00
AJ ONeal 18577cb2de don't specify version, defaults to latest 2015-04-22 09:56:03 -06:00
AJ ONeal 2c58eb64c5 default to latest 2015-04-22 09:54:59 -06:00
AJ ONeal c09719e26a fix error message 2015-04-22 09:48:29 -06:00
AJ ONeal 339c4b83bd default to current version 2015-04-22 09:48:01 -06:00
AJ ONeal a40b71b1b1 default to current version 2015-04-22 09:46:54 -06:00
AJ ONeal 5ef5c2ed1d update to 1.6.3 2015-04-01 10:11:12 -06:00
AJ ONeal 2a362e70e9 support armv7l, armv6l 2015-03-19 22:01:17 -06:00
AJ ONeal 6a8de7e98a add raspbian 2015-03-19 21:34:45 -06:00
AJ ONeal a3ae1c98f0 raspbian to use ubuntu setup file 2015-03-19 21:32:37 -06:00
AJ ONeal e7102d3406 Add raspbian option 2015-03-19 21:31:19 -06:00
AJ ONeal 373b1ebe19 Update to 1.5.1 2015-03-15 21:40:23 -06:00
AJ ONeal 837f52dd7d Update to 1.5.1 2015-03-15 21:39:00 -06:00
AJ ONeal e845e13631 Update to 1.5.1 2015-03-15 21:36:11 -06:00
AJ ONeal 91279d1fe2 bump v1.1.0 2015-02-03 22:27:03 -07:00
AJ ONeal 23f9400728 bump v1.1.0 2015-02-03 22:26:39 -07:00
AJ ONeal c4d784318b Update README.md 2015-02-03 22:26:04 -07:00
AJ ONeal 76fe4fad6e Update README.md 2015-01-26 00:11:42 -07:00
AJ ONeal 2d13295e63 Update README.md 2015-01-24 16:29:03 -07:00
AJ ONeal 9f245dd42b Update README.md 2015-01-20 23:34:08 -07:00
AJ ONeal 7f07bc0a25 clarified tl;dr 2015-01-20 23:33:28 -07:00
AJ ONeal 21f26603f6 specify output dir with tar instead of using cd 2015-01-20 23:24:02 -07:00
AJ ONeal 6d2d7e7c20 move paths to bash vars 2015-01-20 23:18:12 -07:00
AJ ONeal 05dd997bf6 add setup-min for install without deps 2015-01-20 23:17:31 -07:00
AJ ONeal 835ebe737f move paths to bash vars 2015-01-20 23:16:58 -07:00
AJ ONeal c4c74e3f46 print command to restore node correctly 2015-01-20 23:16:17 -07:00
AJ ONeal 1e52638583 update to 1.0.3 2015-01-20 23:15:30 -07:00
AJ ONeal 882f8c6d97 Update README.md 2015-01-20 22:45:27 -07:00
AJ ONeal fc3c4fcf2e Update README.md 2015-01-20 22:39:46 -07:00
AJ ONeal d13acf1a8f Update README.md 2015-01-20 22:34:04 -07:00
AJ ONeal f14b3d6b49 typo fix 2015-01-20 19:46:12 -07:00
AJ ONeal 2f2e721893 added TOC 2015-01-20 19:45:45 -07:00
AJ ONeal 3d69946240 XCode License, Ubuntu wget
forgot about the OS X license and desktop ubuntu doesn't have wget
2015-01-20 19:34:25 -07:00
AJ ONeal 2e22e92cd9 .bash -> .sh (for shortness) 2015-01-19 17:18:28 -07:00
AJ ONeal 09322c50ae added iojs-dev and iojs-min 2015-01-19 17:09:36 -07:00
AJ ONeal d7c26deaf1 Create setup-min.sh 2015-01-19 17:06:29 -07:00
AJ ONeal 22d6a12a7f don't run from stdin
Running from stdin by piping to bash prevents `read` and other install prompts.
2015-01-19 16:59:20 -07:00
AJ ONeal 331f4eadb9 store node path & ver before moving 2015-01-17 18:23:25 -07:00
AJ ONeal 52d1bd8cdc typo fix 2015-01-15 16:07:03 -07:00
AJ ONeal 984b6135f7 make restoring node more clear 2015-01-15 16:05:06 -07:00
AJ ONeal e2974cc962 Merge branch 'master' of github.com:coolaj86/iojs-install-script 2015-01-15 16:01:20 -07:00
AJ ONeal 6defb38f85 typo fix 2015-01-15 16:01:15 -07:00
AJ ONeal 158d114aeb Update README.md 2015-01-15 15:59:32 -07:00
AJ ONeal 6bb1b6a612 Update README.md 2015-01-15 15:59:12 -07:00
AJ ONeal ee45e9d885 Update README.md 2015-01-15 15:57:43 -07:00
AJ ONeal a737667301 better output 2015-01-15 15:53:55 -07:00
AJ ONeal 8a6a7ed83a better output 2015-01-15 15:52:35 -07:00
AJ ONeal 0ff11fbf72 no output for pushd 2015-01-15 15:43:34 -07:00
AJ ONeal e013693961 refactor 2015-01-15 15:41:04 -07:00
AJ ONeal b44332e44d handle node + iojs 2015-01-15 15:04:14 -07:00
AJ ONeal 8916e4501a handle node + iojs 2015-01-15 15:01:58 -07:00
AJ ONeal 9aba23aec2 show user that node is already installed 2015-01-15 14:50:53 -07:00
AJ ONeal 1928941c1b handle node + iojs 2015-01-15 14:43:34 -07:00
AJ ONeal 5f316be072 handle node + iojs 2015-01-15 14:42:39 -07:00
AJ ONeal 220530a675 Update setup-ubuntu.bash 2015-01-15 14:39:53 -07:00
AJ ONeal 6433047dab Update setup-ubuntu.bash 2015-01-15 14:34:11 -07:00
AJ ONeal 14d64876cc 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
2015-01-15 14:32:21 -07:00
AJ ONeal aceb40476d added friendly comment 2015-01-14 02:57:45 -07:00
AJ ONeal 1ed3b1934b ChangeLog -> CHANGELOG.md 2015-01-14 02:54:25 -07:00
AJ ONeal 7cc0644fec node.js -> io.js, node -> iojs 2015-01-14 02:43:38 -07:00
AJ ONeal b1855d243e Initial commit 2015-01-14 02:33:38 -07:00
9 changed files with 808 additions and 259 deletions

171
README.md
View File

@ -1,47 +1,154 @@
node-install-script
===================
# STOP
A script to install basic development tools for node (git, node, gcc, etc)
The install method in this repo still has its place, but this is no longer maintained.
Works for any recent version of Ubuntu or OS X.
**Update**: Use [Webi](https://webinstall.dev) instead:
```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
```sh
curl https://webinstall.dev/node | bash
```
**For older versions of Ubuntu**:
# Easy Install node.js
| A [Root](https://rootprojects.org) Project |
Simple node.js installer for macOS and Linux
## QuickStart
```bash
wget -nv bit.ly/easy-install-node -O - | bash
curl -fsL bit.ly/node-installer | bash
```
This is what gets installed:
*Note*: [bit.ly/node-installer](https://bit.ly/node-installer) is a redirect to <https://git.coolaj86.com/coolaj86/node-installer.sh/raw/master/install.sh>
* fail2ban (not necessary for development, but should be on every server)
* rsync
* curl
* wget
* git
* xcode / brew / build-essential / pkg-config / gcc
* node
* jshint
## Screencast
Screencast
==========
[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))
[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))
## Installer Options
Front-End Extras
================
* [x] version
* [x] install location
* [x] tools for building native modules
These are **not installed**, but you may wish to use them if you're doing front-end work as well
### Choose Version
* bower
* uglifyjs
* yo
* jade
* less
The latest version of node is installed by default.
You can choose a specific version by defining `NODE_VERSION` in the format `vX`, `vX.Y`, or `v.X.Y.Z`:
```bash
NODE_VERSION=v10
```
Usage:
```bash
export NODE_VERSION=v10.10
curl -fsSL https://bit.ly/node-installer | bash
```
### Location
By default node will be installed to `/usr/local`, without root if possible.
You can choose a specific location by setting **both** `NPM_CONFIG_PREFIX` **and** `NODE_PATH`:
```bash
export NPM_CONFIG_PREFIX=$HOME/.local
export NODE_PATH=$NPM_CONFIG_PREFIX/lib/node_modules
curl -fsSL https://bit.ly/node-installer | bash
```
If you want to add the install location to your `PATH`, add `/bin` to the custom location used above and append it like so:
```bash
PATH=$PATH:$HOME/.local/bin
```
### Development Tools
If you plan on building or creating native node modules, you'll want to install `gcc`, `pgk-config`, and a few other required tools and niceties.
In fact, it's fairly common for modules to have both native module and pure js dependencies, so you'll probably want (or need) to install these even if you don't plan to use them directly.
* [x] curl & wget
* [x] git
* [x] rsync
* [x] xcode, brew (on macOS), build-essential (Linux)
* [x] gcc, pkg-config
* [x] pkg-config
* [x] node.js, jshint
Pass `--dev-deps` to the installer script and it will use either `brew` (on macOS) or `apt` (on Linux) to install the development tools.
```bash
curl -fsSL https://bit.ly/node-installer | bash -s -- --dev-deps
```
Or, if you don't have `curl` installed yet you can use `wget`:
```bash
wget -nv https://bit.ly/node-installer -O - | bash -s -- --dev-deps
```
### Securing your server
If you're running a node.js server on anything with a public ip address
(an "edge" server), I'd highly recommend that you also install `fail2ban` to secure ssh -
especially if you haven't switched your server to use key-only authentication (which you should also do).
See [The 15-Minute Guide to Secure VPS Access (for the Semi-Paranoid)](https://www.youtube.com/watch?v=YZzhIIJmlE0)
## Notes
* [OS X](#apple-os-x)
* [Ubuntu Linux](#ubuntu-linux)
* [Important Notes](#other-things-you-should-know)
### Apple OS X
First you need to **Install XCode Command Line Tools**
```bash
xcode-select --install
```
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
```
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 node.js
```bash
curl -fsSL https://bit.ly/node-installer -o /tmp/node-installer.sh; bash /tmp/node-installer.sh --dev-deps
```
*TODO*: Make it easier to accepting the license (automatic?)
### Ubuntu Linux
```bash
wget -nv https://bit.ly/node-installer -O /tmp/node-installer.sh; bash /tmp/node-installer.sh --dev-deps
```
### Automatic Version Detection
Fun FYI, here's how the latest version is determined:
```bash
NODE_VERSION=$(curl -fsSL https://nodejs.org/dist/index.tab | tail -n +2 | cut -f 1 | head -1 )
echo "The current node.js version is $NODE_VERSION"
```
```bash
BASE_VER="v10\\."
NODE_VERSION=$(curl -fsSL https://nodejs.org/dist/index.tab | tail -n +2 | cut -f 1 | grep $BASE_VER | head -1 )
echo "Latest node.js $BASE_VER is $NODE_VERSION"
```

387
install.sh Normal file
View File

@ -0,0 +1,387 @@
#!/bin/bash
# Installs node.js only (no development dependencies) for both Ubuntu and OS X
#
# See https://git.coolaj86.com/coolaj86/node-installer.sh
#
# 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
# Not every platform has or needs sudo, gotta save them O(1)s...
sudo_cmd=""
((EUID)) && [[ -z "${ANDROID_ROOT:-}" ]] && sudo_cmd="sudo"
deps_flag="$1"
set -e
set -u
#set -o pipefail
if [ -z "${PREFIX-}" ]; then
PREFIX=""
fi
NODEJS_NAME="node"
NODEJS_BASE_URL="https://nodejs.org"
BASE_URL="https://git.coolaj86.com/coolaj86/node-installer.sh/raw/master"
#NO_FAIL2BAN=""
NO_FAIL2BAN="nope"
OS="unsupported"
ARCH=""
SETUP_FILE=""
my_tmp="$(mktemp -d -t node-installer.XXXXXXXX)"
export my_tmp
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
# Mavericks+ works for all current macOS versions
OS='mavericks'
if [[ "$OSX_MAJOR" -eq 10 ]]; then
#
# 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
fi
# OS X (10) and macOS (11) should be supported
if [ "$OSX_MAJOR" -gt 11 ]; then
echo "WARNING: macOS 12+ may or may not be supported"
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 "$(uname -a | 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 'Linux Mint')" ]; then
OS='ubuntu'
elif [ "$(cat /etc/issue | grep -i 'elementary OS')" ]; then
OS='ubuntu'
elif [ "$(cat /etc/issue | grep -i 'Arch ')" ]; then
OS='ubuntu'
elif [ "$(cat /etc/issue | grep -i 'Debian')" ]; then
OS='ubuntu'
elif [ "$(cat /etc/issue | grep -i 'Trisquel')" ]; then
OS='ubuntu'
elif [ "$(cat /etc/issue | grep -i 'Zorin')" ]; then
OS='ubuntu'
elif [ "$(cat /etc/issue | grep -i 'Raspbian')" ]; then
OS='raspbian'
elif [ "$(cat /etc/issue | grep -i 'Fedora')" ]; then
OS='ubuntu'
elif [ "$(cat /etc/issue | grep -i 'Marvell')" ]; then
OS='marvell'
else
OS='ubuntu'
fi
else
echo "unsupported unknown os (non-mac, non-linux)"
exit 500
fi
case "${OS}" in
fedora)
echo "FEDORA not yet supported (feel free to pull request)"
exit 1
;;
ubuntu)
SETUP_FILE="ubuntu"
;;
raspbian)
SETUP_FILE="ubuntu"
;;
marvell)
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 #
#######################
if [ "--dev-deps" == "$deps_flag" ]; then
echo "Preparing to install node.js (and common development dependencies) for ${OS}" "${ARCH}"
else
echo "Preparing to install node.js (minimal) for ${OS}" "${ARCH}"
fi
INSTALL_DEPS_FILE="setup-deps-${SETUP_FILE}.bash"
INSTALL_FILE="setup-node-${SETUP_FILE}.bash"
if [ ! -e "$my_tmp/${INSTALL_FILE}" ]; then
if [ -n "$(type -p curl)" ]; then
curl --silent -L "${BASE_URL}/${INSTALL_FILE}" \
-o "$my_tmp/${INSTALL_FILE}" || echo 'error downloading os setup script'
elif [ -n "$(type -p wget)" ]; then
wget --quiet "${BASE_URL}/${INSTALL_FILE}" \
-O "$my_tmp/${INSTALL_FILE}" || echo 'error downloading os setup script'
else
echo "Found neither 'curl' nor 'wget'. Can't Continue."
exit 1
fi
fi
if [ "--dev-deps" == "$deps_flag" ]; then
if [ ! -e "$my_tmp/${INSTALL_DEPS_FILE}" ]; then
if [ -n "$(type -p curl)" ]; then
curl --silent -L "${BASE_URL}/${INSTALL_DEPS_FILE}" \
-o "$my_tmp/${INSTALL_DEPS_FILE}" || echo 'error downloading os deps script: '"${BASE_URL}/${INSTALL_DEPS_FILE}"
elif [ -n "$(type -p wget)" ]; then
wget --quiet "${BASE_URL}/${INSTALL_DEPS_FILE}" \
-O "$my_tmp/${INSTALL_DEPS_FILE}" || echo 'error downloading os deps script: '"${BASE_URL}/${INSTALL_DEPS_FILE}"
else
echo "Found neither 'curl' nor 'wget'. Can't Continue."
exit 1
fi
fi
fi
if [ ! -e "$my_tmp/${INSTALL_FILE}" ]
then
echo "Error Downloading Install File"
exit 1
fi
if [ "--dev-deps" == "$deps_flag" ]; then
if [ ! -e "$my_tmp/${INSTALL_DEPS_FILE}" ]
then
echo "Error Downloading Deps File"
exit 1
fi
fi
#########################
# Which node.js VERSION ? #
#########################
NODE_VERSION=${NODE_VERSION:-}
NODEJS_VER=${NODEJS_VER:-}
if [ -n "$NODE_VERSION" ]; then
NODEJS_VER=$NODE_VERSION
fi
if [ -z "${NODEJS_VER:-}" ]; then
# For backwards compat
if [ -f "$my_tmp/NODEJS_VER" ]; then
NODEJS_VER=$(cat $my_tmp/NODEJS_VER | grep v)
elif [ -f "/tmp/IOJS_VER" ]; then
NODEJS_VER=$(cat $my_tmp/IOJS_VER | grep v)
fi
fi
if [ -n "${NODEJS_VER:-}" ]; then
NODEJS_VERT=$(echo ${NODEJS_VER} | cut -c 2- | cut -d '.' -f1)
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
fi
NODEJS_VER="${NODEJS_VER:-v}" # Search for 'v' at the least
# sort -rV # will sort by version number, but it appears these are already sorted
# tail -n +2 # starts at line two (1-indexed) and all after (omits the csv header with 'version' and such)
# cut -f 1 # gets only the first column
# head -n 1 # gets only the most recent version
my_char="."
my_count=$(awk -F"${my_char}" '{print NF-1}' <<< "${NODEJS_VER}")
# get the latest version if partial
if [ $my_count -ne 2 ]; then
if [ "$NODEJS_VER" != "v" ]; then
NODEJS_VER="$NODEJS_VER\\."
fi
if [ -n "$(type -p curl)" ]; then
NODEJS_VER=$(curl -fsL "$NODEJS_BASE_URL/dist/index.tab" | tail -n +2 | cut -f 1 | grep "^$NODEJS_VER" | head -n 1) \
|| echo 'error automatically determining current node.js version'
elif [ -n "$(type -p wget)" ]; then
NODEJS_VER=$(wget --quiet "$NODEJS_BASE_URL/dist/index.tab" -O - | tail -n +2 | cut -f 1 | grep "^$NODEJS_VER" | head -n 1) \
|| echo 'error automatically determining current node.js version'
else
echo "Found neither 'curl' nor 'wget'. Can't Continue."
exit 1
fi
fi
#
# node
#
if [ -z "${NODE_PATH-}" ]; then
if [ -n "$(type -p node | grep node 2>/dev/null)" ]; then
# /usr/local/bin/node => /usr/local
node_install_path="$(dirname $(dirname $(type -p node)))"
echo "NODE_PATH is not set. Using existing node install path: '$node_install_path'"
else
node_install_path=$PREFIX/usr/local
echo "NODE_PATH is not set. Using default install path '$node_install_path'"
fi
else
node_install_path=$(dirname $(dirname $NODE_PATH))
echo "NODE_PATH is '$NODE_PATH', so install path is '$node_install_path'"
fi
if [ -e "$node_install_path/bin/node" ]; then
# node of some version is already installed
if [ "${NODEJS_VER}" == "$($node_install_path/bin/node -v 2>/dev/null)" ]; then
echo node ${NODEJS_VER} is already installed
exit 0
else
echo ""
echo "HEY, LISTEN:"
echo ""
echo "node.js is already installed as node $($node_install_path/bin/node -v | grep v)"
echo ""
echo "to reinstall as ${NODEJS_VER} please first run: rm $node_install_path/bin/node"
echo ""
exit 1
fi
NODEJS_VER=""
fi
if [ -n "${NODEJS_VER}" ]; then
bash "$my_tmp/${INSTALL_FILE}" "${NODEJS_VER}"
fi
mkdir -p $node_install_path/lib/node_modules 2> /dev/null || $sudo_cmd mkdir -p $node_install_path/lib/node_modules
chown -R $(whoami) $node_install_path/lib/node_modules 2> /dev/null || $sudo_cmd chown -R $(whoami) $node_install_path/lib/node_modules
echo ""
if [ "--dev-deps" == "$deps_flag" ]; then
################
# 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 obviously 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 "$my_tmp/${INSTALL_DEPS_FILE}" "${NO_FAIL2BAN}"
# yarn
#if [ -z "$(type -p yarn)" ]; then
# echo "installing yarn..."
# npm install --silent yarn -g > /dev/null
#fi
# jshint
if [ -z "$(type -p jshint)" ]; then
echo "installing jshint..."
#yarn global add jshint > /dev/null
$node_install_path/bin/npm install -g jshint > /dev/null
fi
echo ""
fi
rm -rf "$my_tmp"

View File

@ -1,10 +1,18 @@
#!/bin/bash
# curl -fsSL https://ldsconnect.org/setup-osx.bash | bash -c
NODE_VER=${1}
NO_FAIL2BAN=${1}
echo ""
echo ""
echo "Checking for"
echo ""
echo " * XCode Command Line Tools"
echo " * wget"
echo " * pkg-config"
echo " * node"
echo " * jshint"
echo ""
# XCode
# testing for which git, gcc, etc will not work because the tools are aliased to the install script
@ -23,6 +31,13 @@ if [ -z "$(xcode-select --print-path 2>/dev/null)" ] || [ -z "$(git --version 2>
while true; do
sleep 5
if [ -n "$(xcode-select --print-path 2>/dev/null)" ]; then
# Agreeing to the Xcode/iOS license requires admin privileges, please run “sudo xcodebuild -license” and then retry this command.
echo "Now running 'sudo xcodebuild -license' so that you can accept the license agreement"
sudo xcodebuild -license
fi
# http://stackoverflow.com/questions/15371925/how-to-check-if-command-line-tools-is-installed
if [ -n "$(git --version 2>/dev/null)" ] && [ -n "$(xcode-select --print-path 2>/dev/null)" ]; then
break;
fi
@ -31,8 +46,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,46 +61,18 @@ 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
#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
# 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
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 /
sudo chown -R $(whoami) /usr/local 2>/dev/null
fi

40
setup-deps-ubuntu.bash Normal file
View File

@ -0,0 +1,40 @@
#!/bin/bash
# curl -fsSL https://ldsconnect.org/setup-linux.bash | bash -c
# Not every platform has or needs sudo, gotta save them O(1)s...
sudo_cmd=""
((EUID)) && [[ -z "$ANDROID_ROOT" ]] && sudo_cmd="sudo"
NO_FAIL2BAN=${1}
echo ""
echo ""
echo "Checking for"
echo ""
echo " * build-essential"
echo " * rsync"
echo " * wget"
echo " * curl"
echo " * pkg-config"
echo " * node"
echo " * jshint"
echo ""
echo "updating apt-get..."
$sudo_cmd 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 "$(type -p pkg-config)" ] || [ -z "$(type -p git)" ] || [ -z "$(type -p wget)" ] || [ -z "$(type -p curl)" ] || [ -z "$(type -p gcc)" ] || [ -z "$(type -p rsync)" ] || [ -z "$(type -p python)" ]
then
echo "installing git, wget, curl, build-essential, rsync, pkg-config, python..."
$sudo_cmd bash -c "apt-get install -qq -y git wget curl build-essential rsync pkg-config python < /dev/null" > /dev/null 2>/dev/null
fi

44
setup-min.sh Normal file
View File

@ -0,0 +1,44 @@
#!/bin/bash
# Installs node.js + dependencies for both Ubuntu and OS X
#
# See https://git.colaj86.com/coolaj86/node-installer.sh
#
# curl -fsSL https://example.com/setup.bash | bash
# wget -nv https://example.com/setup.bash -O - | bash
set -e
set -u
BASE_URL="https://git.coolaj86.com/coolaj86/node-installer.sh/raw/master"
#######################
# Download installers #
#######################
INSTALL_FILE_REMOTE="install.sh"
INSTALL_FILE="node-installer.sh"
if [ ! -e "/tmp/${INSTALL_FILE}" ]
then
if [ -n "$(which curl)" ]; then
curl --silent -L "${BASE_URL}/${INSTALL_FILE_REMOTE}" \
-o "/tmp/${INSTALL_FILE}" || echo 'error setup script: '"${BASE_URL}/${INSTALL_FILE_REMOTE}"
elif [ -n "$(which wget)" ]; then
wget --quiet "${BASE_URL}/${INSTALL_FILE_REMOTE}" \
-O "/tmp/${INSTALL_FILE}" || echo 'error setup script: '"${BASE_URL}/${INSTALL_FILE_REMOTE}"
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
bash "/tmp/${INSTALL_FILE}" --no-dev-deps

60
setup-node-mavericks.bash Normal file
View File

@ -0,0 +1,60 @@
#!/bin/bash
set -e
set -u
set -o pipefail
if [ -z "${my_tmp-}" ]; then
my_tmp=$(mkdir -p)
fi
if [ -z "${PREFIX-}" ]; then
PREFIX=""
fi
if [ -z "${NODE_PATH-}" ]; then
node_install_path=$PREFIX/usr/local
else
node_install_path=$(dirname $(dirname $NODE_PATH))
fi
NODEJS_VER=${1}
NODEJS_VERT=$(echo ${NODEJS_VER} | cut -c 2- | cut -d '.' -f1)
NODEJS_NAME="node"
NODEJS_BASE_URL="https://nodejs.org"
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
# When using .pkg
#NODEJS_REMOTE="$NODEJS_BASE_URL/dist/${NODEJS_VER}/${NODEJS_NAME}-${NODEJS_VER}.pkg"
#NODEJS_PKG="/tmp/${NODEJS_NAME}-${NODEJS_VER}.pkg"
NODEJS_REMOTE="$NODEJS_BASE_URL/dist/${NODEJS_VER}/${NODEJS_NAME}-${NODEJS_VER}-darwin-x64.tar.gz"
NODEJS_PKG="$my_tmp/${NODEJS_NAME}-${NODEJS_VER}-darwin-x64.tar.gz"
NODEJS_UNTAR="$my_tmp/${NODEJS_NAME}-${NODEJS_VER}-darwin-x64"
if [ -n "${NODEJS_VER}" ]; then
echo "installing ${NODEJS_NAME} as ${NODEJS_NAME} ${NODEJS_VER}..."
curl -fsSL "${NODEJS_REMOTE}" -o "${NODEJS_PKG}"
# When using .pkg
#sudo /usr/sbin/installer -pkg "${NODEJS_PKG}" -target /
# When using .tar.gz
mkdir -p ${NODEJS_UNTAR}/
tar xf "${NODEJS_PKG}" -C "${NODEJS_UNTAR}/" --strip-components=1
rm -f ${NODEJS_UNTAR}/{LICENSE,CHANGELOG.md,README.md}
mkdir -p "$node_install_path/" || sudo mkdir -p "$node_install_path/"
rsync -a "${NODEJS_UNTAR}/" "$node_install_path/" || sudo rsync -a "${NODEJS_UNTAR}/" "$node_install_path/"
chown -R $(whoami) "$node_install_path/lib/node_modules/" || sudo chown -R $(whoami) "$node_install_path/lib/node_modules/"
chown $(whoami) "$node_install_path/bin/" || sudo chown $(whoami) "$node_install_path/bin/"
fi

87
setup-node-ubuntu.bash Normal file
View File

@ -0,0 +1,87 @@
#!/bin/bash
# Not every platform has or needs sudo, gotta save them O(1)s...
sudo_cmd=""
((EUID)) && [[ -z "${ANDROID_ROOT:-}" ]] && sudo_cmd="sudo"
set -e
set -u
set -o pipefail
if [ -z "${my_tmp-}" ]; then
my_tmp="$(mktemp -d -t node-installer.XXXXXXXX)"
fi
if [ -z "${PREFIX-}" ]; then
PREFIX=""
fi
if [ -z "${NODE_PATH-}" ]; then
node_install_path=$PREFIX/usr/local
else
node_install_path=$(dirname $(dirname $NODE_PATH))
fi
NODEJS_VER=${1}
NODEJS_VERT=$(echo ${NODEJS_VER} | cut -c 2- | cut -d '.' -f1)
NODEJS_NAME="node"
NODEJS_BASE_URL="https://nodejs.org"
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
if [ -n "$(uname -a | grep aarch64)" ]; then
ARCH="arm64"
elif [ -n "$(uname -a | grep 64)" ]; then
ARCH="x64"
elif [ -n "$(uname -a | grep armv8l)" ]; then
ARCH="arm64"
elif [ -n "$(uname -a | grep armv7l)" ]; then
ARCH="armv7l"
elif [ -n "$(uname -a | grep armv6l)" ]; then
ARCH="armv6l"
else
ARCH="x86"
fi
NODEJS_REMOTE="${NODEJS_BASE_URL}/dist/${NODEJS_VER}/${NODEJS_NAME}-${NODEJS_VER}-linux-${ARCH}.tar.gz"
NODEJS_LOCAL="$my_tmp/${NODEJS_NAME}-${NODEJS_VER}-linux-${ARCH}.tar.gz"
NODEJS_UNTAR="$my_tmp/${NODEJS_NAME}-${NODEJS_VER}-linux-${ARCH}"
if [ -n "${NODEJS_VER}" ]; then
echo "installing ${NODEJS_NAME} as ${NODEJS_NAME} ${NODEJS_VER}..."
if [ -n "$(command -v curl 2>/dev/null | grep curl)" ]; then
curl -fsSL ${NODEJS_REMOTE} -o ${NODEJS_LOCAL} || echo 'error downloading ${NODEJS_NAME}'
elif [ -n "$(command -v wget 2>/dev/null | grep wget)" ]; then
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 " sudo apt-get install --yes curl wget"
exit 1
fi
mkdir -p ${NODEJS_UNTAR}/
# --strip-components isn't portable, switch to portable version by performing move step after untar
tar xf ${NODEJS_LOCAL} -C ${NODEJS_UNTAR}/ #--strip-components=1
mv ${NODEJS_UNTAR}/${NODEJS_NAME}-${NODEJS_VER}-linux-${ARCH}/* ${NODEJS_UNTAR}/
rm -rf ${NODEJS_UNTAR}/${NODEJS_NAME}-${NODEJS_VER}-linux-${ARCH} # clean up the temporary unzip folder
rm ${NODEJS_UNTAR}/{LICENSE,CHANGELOG.md,README.md}
if [ -n "$(command -v rsync 2>/dev/null | grep rsync)" ]; then
echo $sudo_cmd rsync -Krl "${NODEJS_UNTAR}/" "$node_install_path/"
rsync -Krl "${NODEJS_UNTAR}/" "$node_install_path/" 2>/dev/null || $sudo_cmd rsync -Krl "${NODEJS_UNTAR}/" "$node_install_path/"
else
# due to symlink issues on Arch Linux, don't copy the share directory
rm -rf ${NODEJS_UNTAR}/share
echo $sudo_cmd cp -Hr "${NODEJS_UNTAR}/*" "$node_install_path/"
cp -Hr "${NODEJS_UNTAR}"/* "$node_install_path/" 2>/dev/null || $sudo_cmd cp -Hr "${NODEJS_UNTAR}"/* "$node_install_path/"
fi
rm -rf "${NODEJS_UNTAR}"
chown -R $(whoami) "$node_install_path/lib/node_modules/" 2>/dev/null || $sudo_cmd chown -R $(whoami) "$node_install_path/lib/node_modules/"
chown $(whoami) ""$node_install_path"/bin/" 2>/dev/null || $sudo_cmd chown $(whoami) ""$node_install_path"/bin/"
fi

View File

@ -1,56 +0,0 @@
#!/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 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
# 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
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
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-${ARCH}.tar.gz" \
-o "/tmp/node-${NODE_VER}-linux-${ARCH}.tar.gz"
pushd /tmp
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-${ARCH}/" /usr/local/
sudo chown -R $(whoami) /usr/local
fi

View File

@ -1,149 +1,44 @@
#!/bin/bash
# Installs node.js + dependencies for both Ubuntu and OS X
#
# See https://git.colaj86.com/coolaj86/node-installer.sh
#
# 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"
set -e
set -u
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
BASE_URL="https://git.coolaj86.com/coolaj86/node-installer.sh/raw/master"
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=""
#######################
# Download installers #
#######################
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"
INSTALL_FILE_REMOTE="install.sh"
INSTALL_FILE="node-installer.sh"
if [ ! -e "/tmp/${INSTALL_FILE}" ]
then
if [ -n "$(which curl)" ]; then
curl --silent -L "${BASE_URL}/${INSTALL_FILE_REMOTE}" \
-o "/tmp/${INSTALL_FILE}" || echo 'error setup script: '"${BASE_URL}/${INSTALL_FILE_REMOTE}"
elif [ -n "$(which wget)" ]; then
wget --quiet "${BASE_URL}/${INSTALL_FILE_REMOTE}" \
-O "/tmp/${INSTALL_FILE}" || echo 'error setup script: '"${BASE_URL}/${INSTALL_FILE_REMOTE}"
else
ARCH="32"
fi
elif [ "$(uname | grep -i 'Linux')" ]; then
if [ ! -f "/etc/issue" ]; then
echo "unsupported linux os"
echo "Found neither 'curl' nor 'wget'. Can't Continue."
exit 1
fi
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)"
if [ ! -e "/tmp/${INSTALL_FILE}" ]
then
echo "Error Downloading Install File"
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
echo ""
bash "/tmp/${INSTALL_FILE}"