Monty Taylor | 4a781a7 | 2017-07-25 07:28:04 -0400 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # Copyright 2017 Red Hat, Inc. |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
| 13 | # implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
| 17 | if type apt-get; then |
| 18 | # Install https transport - otherwise apt-get HANGS on https urls |
| 19 | sudo apt-get update |
| 20 | sudo apt-get install apt-transport-https |
| 21 | # Install recent NodeJS repo |
| 22 | curl -sS https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add - |
| 23 | echo "deb https://deb.nodesource.com/node_8.x xenial main" | sudo tee /etc/apt/sources.list.d/nodesource.list |
| 24 | # Install yarn repo |
| 25 | curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - |
| 26 | echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list |
| 27 | sudo apt-get update |
| 28 | sudo DEBIAN_FRONTEND=noninteractive \ |
| 29 | apt-get -q --option "Dpkg::Options::=--force-confold" --assume-yes \ |
| 30 | install nodejs yarn |
Tobias Henkel | ff50be6 | 2018-02-27 11:31:17 +0000 | [diff] [blame] | 31 | elif type yum; then |
Monty Taylor | 4a781a7 | 2017-07-25 07:28:04 -0400 | [diff] [blame] | 32 | sudo curl https://dl.yarnpkg.com/rpm/yarn.repo -o /etc/yum.repos.d/yarn.repo |
| 33 | sudo $(dirname $0)/install-js-repos-rpm.sh |
| 34 | sudo yum -y install nodejs yarn |
Tobias Henkel | ff50be6 | 2018-02-27 11:31:17 +0000 | [diff] [blame] | 35 | elif type brew; then |
| 36 | brew install nodejs yarn |
| 37 | else |
| 38 | echo "Unsupported platform" |
Monty Taylor | 4a781a7 | 2017-07-25 07:28:04 -0400 | [diff] [blame] | 39 | fi |