#!/bin/bash

node_version="v12.18.4"

unamem="$(uname -m)"
if [[ $unamem == *aarch64* ]]; then
        node_arch="arm64"
elif [[ $unamem == *64* ]]; then
        node_arch="x64"
elif [[ $unamem == *86* ]]; then
        node_arch="x86"
elif [[ $unamem == *armv6l* ]]; then
        node_arch="armv6l"
elif [[ $unamem == *armv7l* ]]; then
        node_arch="armv7l"
else
        echo "Aborted, unsupported or unknown architecture: $unamem"
        return 2
fi


wget https://nodejs.org/dist/$node_version/node-$node_version-linux-$node_arch.tar.xz
tar xf node-$node_version-linux-$node_arch.tar.xz --strip 1
