Browse code

Install nodejs for RHEL/Fedora

nodejs is required for Horizon (ships a copy of lessc internally). I
couldn't find nodejs in the rpm list, despite it being installed in
lib/horizon. This adds to the rpm list as NOPRIME and retains the old
install point.

RHEL6 has nodejs in EPEL now, so we remove the old hack that installed
an upstream version and add it to the install mentioned previously

Change-Id: Ib3ee2f7d77e22666c9055c8528288c01b46a95d3

Ian Wienand authored on 2013/05/23 08:25:10
Showing 2 changed files
... ...
@@ -3,6 +3,7 @@ django-registration
3 3
 gcc
4 4
 httpd # NOPRIME
5 5
 mod_wsgi  # NOPRIME
6
+nodejs # NOPRIME
6 7
 pylint
7 8
 python-anyjson
8 9
 python-BeautifulSoup
... ...
@@ -73,31 +73,6 @@ function _horizon_config_set() {
73 73
     fi
74 74
 }
75 75
 
76
-# Basic install of upstream nodejs for platforms that want it
77
-function install_nodejs() {
78
-    if [[ $(which node) ]]; then
79
-        echo "You already appear to have nodejs, skipping install"
80
-        return
81
-    fi
82
-
83
-    # There are several node deployment scripts; one may be more
84
-    # appropriate at some future point, but for now direct download is
85
-    # the simplest way.  The version barely matters for lesscss which
86
-    # doesn't use anything fancy.
87
-    local ver=0.10.1
88
-    local nodejs=node-v${ver}-linux-x64
89
-    local tar=$nodejs.tar.gz
90
-    local nodejs_url=http://nodejs.org/dist/v${ver}/${tar}
91
-
92
-    curl -Ss ${nodejs_url} | tar -C ${DEST} -xz
93
-    if [ $? -ne 0 ]; then
94
-        echo "*** Download of nodejs failed"
95
-        return 1
96
-    fi
97
-
98
-    # /usr/bin so it gets found in the PATH available to horizon
99
-    sudo ln -s $DEST/$nodejs/bin/node /usr/bin/node
100
-}
101 76
 
102 77
 # Entry Points
103 78
 # ------------
... ...
@@ -105,15 +80,7 @@ function install_nodejs() {
105 105
 # cleanup_horizon() - Remove residual data files, anything left over from previous
106 106
 # runs that a clean run would need to clean up
107 107
 function cleanup_horizon() {
108
-
109
-    if [[ is_fedora && $DISTRO =~ (rhel6) ]]; then
110
-    # if the /usr/bin/node link looks like it's pointing into $DEST,
111
-    # then we installed it via install_nodejs
112
-        if [[ $(readlink -f /usr/bin/node) =~ ($DEST) ]]; then
113
-            sudo rm /usr/bin/node
114
-        fi
115
-    fi
116
-
108
+    :
117 109
 }
118 110
 
119 111
 # configure_horizon() - Set config files, create data dirs, etc
... ...
@@ -199,21 +166,12 @@ function install_horizon() {
199 199
         exit_distro_not_supported "apache installation"
200 200
     fi
201 201
 
202
-    if [[ is_fedora && $DISTRO =~ (rhel6) ]]; then
203
-        # RHEL6 currently has no native way to get nodejs, so we do a
204
-        # basic install here (see cleanup_horizon too).
205
-        # TODO: does nova have a better way that we can limit
206
-        # requirement of site-wide nodejs install?
207
-        install_nodejs
208
-    fi
209
-
210 202
     # NOTE(sdague) quantal changed the name of the node binary
211 203
     if is_ubuntu; then
212 204
         if [[ ! -e "/usr/bin/node" ]]; then
213 205
             install_package nodejs-legacy
214 206
         fi
215
-    elif is_fedora && [[ "$os_RELEASE" -ge "18" ]]; then
216
-        # fedora 18 and higher gets nodejs
207
+    elif is_fedora && [[ $DISTRO =~ (rhel6) || "$os_RELEASE" -ge "18" ]]; then
217 208
         install_package nodejs
218 209
     fi
219 210