Sikuliaq IT Asset Manager (skqitam)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

100 lines
2.9 KiB

#!/usr/bin/env bash
# Detect POSIX Environment
os=`uname -s | tr '[:upper:]' '[:lower:]'`
arch=`uname -m | sed -r 's/x86_64/x64/'`
# Debian Node JS Fetch Script
rundir=`echo $0 |sed -r 's/\/server-setup\.sh$//'`
if [ ! -d "$rundir/itam-data" ]; then
mkdir $rundir/itam-data
fi
if [ ! -d "$rundir/nodejs" ]; then
mkdir $rundir/nodejs
fi
cd $rundir/nodejs
dist_base_url='https://nodejs.org/dist/latest-v8.x'
node_version='8.17.0'
# https://nodejs.org/dist/latest-v6.x/node-v6.17.1-darwin-x64.tar.gz
# https://nodejs.org/dist/latest-v6.x/node-v6.17.1-linux-arm64.tar.xz
# https://nodejs.org/dist/latest-v6.x/node-v6.17.1-linux-armv7l.tar.xz
# https://nodejs.org/dist/latest-v6.x/node-v6.17.1-linux-x64.tar.xz
# https://nodejs.org/dist/latest-v6.x/node-v6.17.1-win-x64.zip
# https://nodejs.org/dist/latest-v6.x/node-v6.17.1-win-x86.zip
#
#
# https://nodejs.org/dist/v14.17.0/node-v14.17.0-win-x86.zip
# https://nodejs.org/dist/v14.17.0/node-v14.17.0-win-x64.zip
# https://nodejs.org/dist/v14.17.0/node-v14.17.0-darwin-x64.tar.gz
# https://nodejs.org/dist/v14.17.0/node-v14.17.0-linux-x64.tar.xz
# https://nodejs.org/dist/v14.17.0/node-v14.17.0-linux-armv7l.tar.xz
# https://nodejs.org/dist/v14.17.0/node-v14.17.0-linux-arm64.tar.xz
for njs in darwin-x64.tar.gz linux-arm64.tar.xz linux-x86.tar.xz linux-armv6l.tar.xz linux-armv7l.tar.xz linux-x64.tar.xz win-x64.zip win-x86.zip; do
url="$dist_base_url/node-v$node_version-$njs"
fn="node-v$node_version-$njs"
# echo "FILE: $fn"
if [ ! -f "$fn" ]; then
echo 'Fetching: '$url' -> '$fn
wget $url
# if [ `echo $njs | egrep 'xz$'` ]; then
# tar -Jxvf node-v$node_version-$njs
# elif [ `echo $njs | egrep 'gz$'` ]; then
# tar -zxvf node-v$node_version-$njs
# elif [ `echo $njs | egrep 'zip$'` ]; then
# unzip node-v$node_version-$njs
# fi
fi
done
# Server Version
dist_base_url='https://nodejs.org/dist/v14.17.1/'
node_version='14.17.1'
for njs in darwin-x64.tar.gz linux-arm64.tar.xz linux-armv7l.tar.xz linux-x64.tar.xz win-x64.zip win-x86.zip; do
if [ `echo $njs | egrep "$os-$arch"` ]; then
url="$dist_base_url/node-v$node_version-$njs"
fn="node-v$node_version-$njs"
# echo "FILE: $fn"
if [ ! -f "$fn" ]; then
echo 'Fetching: '$url' -> '$fn
wget $url
if [ `echo $njs | egrep 'xz$'` ]; then
tar -Jxf node-v$node_version-$njs
elif [ `echo $njs | egrep 'gz$'` ]; then
tar -zxf node-v$node_version-$njs
elif [ `echo $njs | egrep 'zip$'` ]; then
unzip node-v$node_version-$njs
fi
fi
fi
done
node_ver='v'$node_version
node_path="$rundir/nodejs/node-$node_ver-$os-$arch/bin/node"
npm_path="$rundir/nodejs/node-$node_ver-$os-$arch/bin/npm"
export PATH="$rundir/nodejs/node-$node_ver-$os-$arch/bin:"$PATH
cd ..
echo -n "NODE: "
$node_path --version
echo -n "NPM: "
$npm_path --version
$npm_path install
if [ ! -f $rundir'/itam-data/host-id-map.json' ]; then
echo '{}' > $rundir'/itam-data/host-id-map.json'
fi