This commit is contained in:
陆柯 2020-05-04 15:36:42 +08:00
parent f640e8c5db
commit 1d3ac7bcb6
4 changed files with 18 additions and 27 deletions

View File

@ -4,11 +4,11 @@ if [ $1 ]
then then
FONPATH=$1 FONPATH=$1
else else
read -p "Enter path-to-faronear (leave blank for default /faronear) >> " FONPATH read -p "Enter path to pull (leave blank for default ./) >> " FONPATH
if [ ! $FONPATH ] if [ ! $FONPATH ]
then then
echo Use default path: /faronear echo Use default path: ./
FONPATH=/faronear FONPATH=./
fi fi
fi fi

View File

@ -1,14 +0,0 @@
apt install curl -y
echo "######## 安装 nvm ############################"
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
echo "######## 启用 nvm ############################"
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
echo "######## 安装最新版 node #####################"
nvm install node
echo "######## node/npm 安装完毕!##################"

View File

@ -1,20 +1,24 @@
#!/bin/bash #!/bin/bash
echo "Usage: setup.sh [nodeVersion]" echo "Usage: setup.sh [nodeVersion]"
echo "Example: setup.sh 12" echo "Example: setup.sh 14"
if [ v$1 != v ] if [ v$1 != v ]
then then
nodeVersion=$1 nodeVersion=$1
else else
read -p "Enter node version (leave blank for default 12) >> " nodeVersion read -p "Enter node version (leave blank for default 14; 'nvm' for nvm) >> " nodeVersion
if [ ! $nodeVersion ] if [ ! $nodeVersion ]
then then
echo Use default node version 12 echo Use default node version 14
nodeVersion=12 nodeVersion=14
fi fi
fi fi
if [ $nodeVersion == 'nvm' ]
then
echo "######## 安装 nvm ############################"
else
sudo apt update sudo apt update
sudo apt install curl gcc g++ make -y sudo apt install curl gcc g++ make -y
@ -22,3 +26,4 @@ echo "######## 安装 node v$nodeVersion ##################"
echo https://deb.nodesource.com/setup_$nodeVersion.x echo https://deb.nodesource.com/setup_$nodeVersion.x
curl -sL https://deb.nodesource.com/setup_$nodeVersion.x | sudo bash - && sudo apt install nodejs -y curl -sL https://deb.nodesource.com/setup_$nodeVersion.x | sudo bash - && sudo apt install nodejs -y
echo "######## node v$nodeVersion 安装完毕!##################" echo "######## node v$nodeVersion 安装完毕!##################"
fi