Skip to content

Instantly share code, notes, and snippets.

@LinZap
Last active November 9, 2017 20:53
Show Gist options
  • Save LinZap/55c2735b3baa1901037c to your computer and use it in GitHub Desktop.
Save LinZap/55c2735b3baa1901037c to your computer and use it in GitHub Desktop.
Node.js Upgrade on QNAP
#!/bin/sh
URL=$1
[[ $URL =~ (node-v5\.8\.0-.*)\.tar\.gz$ ]] && TARFile=${BASH_REMATCH[0]} && DirName=${BASH_REMATCH[1]}
[[ $TARFile == "" ]] && echo "url is wrong" && exit
NodeJSPath=$(/sbin/getcfg nodejs Install_Path -f /etc/config/qpkg.conf)
wget --no-check-certificate $URL
tar zxf $TARFile -C $NodeJSPath
rm -r $NodeJSPath/node $TARFile
ln -s $NodeJSPath/$DirName $NodeJSPath/node
uidscript=$NodeJSPath/$DirName/lib/node_modules/npm/node_modules/uid-number/uid-number.js
script="$(cat $uidscript)"
echo "${script/", uidSupport = process.getuid && process.setuid"/, uidSupport = false}" > $uidscript
@LinZap
Copy link
Author

LinZap commented Mar 15, 2016

NodeJS Upgrade Script

An Automation Upgrade Script

Usage

URL: NodeJS source url

sh node-upgrade.sh [URL]

NodeJS Download Page

NodeJS v5.8.0 Download Page

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment