From: Ricardo Dias Date: Wed, 14 Feb 2018 15:53:47 +0000 (+0000) Subject: install-deps: install dashboard_v2 development dependencies X-Git-Tag: v13.0.2~84^2~28 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b6d9464806b74c9f40e03258a004921f472d122e;p=ceph.git install-deps: install dashboard_v2 development dependencies Signed-off-by: Ricardo Dias Signed-off-by: Kai Wagner --- diff --git a/install-deps.sh b/install-deps.sh index 0282b472493c..30828559166c 100755 --- a/install-deps.sh +++ b/install-deps.sh @@ -21,6 +21,8 @@ if test $(id -u) != 0 ; then fi export LC_ALL=C # the following is vulnerable to i18n +ARCH=`uname -m` + function munge_ceph_spec_in { local OUTFILE=$1 sed -e 's/@//g' -e 's/%bcond_with make_check/%bcond_without make_check/g' < ceph.spec.in > $OUTFILE @@ -105,6 +107,68 @@ EOF fi } +function ensure_min_npm_version { + local install_npm_pkg_cmd=$1 + + if [ "$ARCH" = "aarch64" ]; then + # we don't support dashboard frontend development in arm64 architecture + return 0 + fi + + if ! type npm > /dev/null 2>&1; then + $SUDO $install_npm_pkg_cmd + fi + + NODE_VER=`node -v` + NODE_VER_MAJOR=`node -v | sed 's/v\(\w\+\).*/\1/g'` + NODE_VER_MINOR=`node -v | sed 's/v\w\+\.\(\w\+\).*/\1/g'` + + # The minimum node version required is 4.8.0 so that we can use yarn below + UPDATE_NODE=false + if [ $NODE_VER_MAJOR -lt 4 ]; then + UPDATE_NODE=true + elif [ $NODE_VER_MAJOR -eq 4 ] && [ $NODE_VER_MINOR -lt 8 ]; then + UPDATE_NODE=true + fi + if $UPDATE_NODE; then + $SUDO npm install -g n + # installs nodejs version 4.8.0 + $SUDO n 4.8.0 + $SUDO npm uninstall -g n + hash -d node > /dev/null 2>&1 || true + fi + + NPM_VER=`npm -v` + NPM_VER_MAJOR=`npm -v | sed 's/\(\w\+\).*/\1/g'` + + # The minimum npm version required is 5.0.0 so that we can install and use + # a local nodejs installation (required by the dashboard angular2 frontend) + if [ $NPM_VER_MAJOR -lt 5 ]; then + $SUDO npm install -g yarn + $SUDO yarn global add npm@^5.0.0 # install npm version 5.0.0 or later + fi + hash -d npm > /dev/null 2>&1 || true + + NEW_NODE_VER=`node -v` + NEW_NPM_VER=`npm -v` + if [ ! "$NODE_VER" = "$NEW_NODE_VER" ]; then +cat <