Hello,
I've been banging my head against the wall trying to figure out how to fix an issue. Any help would be appreciated!
What's happening:
I have a server build script that does stuff like install/configure Nginx, Node.js, etc. When installing Node.js, the build script actually calls another shell script.
Code:
#Server build script excerpt
#Node.js
if $nodejs_enabled ; then
sh $server/installNodejs.sh $nodejs_version
fi
Interestingly, I get different results when the server build script calls the Node.js install script, and when I call the Node.js install script myself.
When the server build script calls it, the Node.js directory isn't copied correctly. Instead of copying the entire Node.js folder into /usr/bin/local/, it copies all of the directories within the Node.js folder there. So if you were to run "ls /usr/bin/local/" you would see "bin, etc" instead of "node-v0.12.2-linux-x64".
When I run the Node.js install script myself, it works fine though.
Code:
#installNodejs.sh
#!/bin/sh
#Make sure version isn't blank
if [ "$1" = "" ] ; then
echo "Usage: installNodejs.sh version"
echo "Example: installNodejs.sh 0.12.2"
exit
fi
dir="node-v$1-linux-x64"
gz="$dir.tar.gz"
symlink='/usr/local/node'
#Download Node.js binary
wget http://nodejs.org/dist/v$1/$gz
#Extract it
tar -zxf $gz
#Move it to /usr/bin/local/
sudo mv $dir/ /usr/bin/local/
#Remove old symlink
sudo rm $symlink
#Create new symlink
sudo ln -s /usr/bin/local/$dir/bin/node $symlink
I've tried:
-Removing the trailing slash
-Using cp instead of mv
-Running mv with the -v (verbose) flag. That yielded: ‘node-v0.12.2-linux-x64/’ -> ‘/usr/bin/local/’
Any ideas what might be the issue?