summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2019-01-21 22:29:51 +0000
committerGerrit Code Review <review@openstack.org>2019-01-21 22:29:51 +0000
commit8bdd1208e38a43b15eb1fac1e77085bd205b5705 (patch)
treef8e28b78797de04e8529b9f2dcc3b039aee576f0
parentf1e5201b8e3e3b83282cc899886286962521d0dd (diff)
parentd940043197385a5b223a97ce804453adc1d08aff (diff)
Merge "Use sudo -E in install-js-tools only if not root"
-rwxr-xr-xtools/install-js-tools.sh29
1 files changed, 17 insertions, 12 deletions
diff --git a/tools/install-js-tools.sh b/tools/install-js-tools.sh
index a2a77ca..d65668c 100755
--- a/tools/install-js-tools.sh
+++ b/tools/install-js-tools.sh
@@ -13,25 +13,30 @@
13# implied. 13# implied.
14# See the License for the specific language governing permissions and 14# See the License for the specific language governing permissions and
15# limitations under the License. 15# limitations under the License.
16if [ $EUID -ne 0 ] ; then
17 SUDO='sudo -E'
18fi
16 19
17if type apt-get; then 20if type apt-get; then
18 # Install https transport - otherwise apt-get HANGS on https urls 21 # Install https transport - otherwise apt-get HANGS on https urls
19 sudo apt-get update 22 # Install curl so the curl commands work
20 sudo apt-get install apt-transport-https 23 # Install gnupg2 so that the apt-key add works
24 $SUDO apt-get update
25 $SUDO apt-get install -y apt-transport-https curl gnupg2
21 # Install recent NodeJS repo 26 # Install recent NodeJS repo
22 curl -sS https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add - 27 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 28 echo "deb https://deb.nodesource.com/node_8.x xenial main" | $SUDO tee /etc/apt/sources.list.d/nodesource.list
24 # Install yarn repo 29 # Install yarn repo
25 curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - 30 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 31 echo "deb https://dl.yarnpkg.com/debian/ stable main" | $SUDO tee /etc/apt/sources.list.d/yarn.list
27 sudo apt-get update 32 $SUDO apt-get update
28 sudo DEBIAN_FRONTEND=noninteractive \ 33 DEBIAN_FRONTEND=noninteractive \
29 apt-get -q --option "Dpkg::Options::=--force-confold" --assume-yes \ 34 $SUDO apt-get -q --option "Dpkg::Options::=--force-confold" --assume-yes \
30 install nodejs yarn 35 install nodejs yarn
31elif type yum; then 36elif type yum; then
32 sudo curl https://dl.yarnpkg.com/rpm/yarn.repo -o /etc/yum.repos.d/yarn.repo 37 $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 38 $SUDO $(dirname $0)/install-js-repos-rpm.sh
34 sudo yum -y install nodejs yarn 39 $SUDO yum -y install nodejs yarn
35elif type brew; then 40elif type brew; then
36 brew install nodejs yarn 41 brew install nodejs yarn
37else 42else