From 931319e839f7f9ec316f12cc4185fe7442626d0b Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Thu, 29 Oct 2020 15:42:23 +0800 Subject: [PATCH] [feature] for ubuntu 16 --- fish/install.sh | 8 +++++++- nodejs/install.sh | 35 ++++++++++++++++++++++++++--------- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/fish/install.sh b/fish/install.sh index dda4ae2..6bd9f7b 100755 --- a/fish/install.sh +++ b/fish/install.sh @@ -10,7 +10,13 @@ case "$PM" in ! which pip3 && $ROOT/python/install.sh sudo add-apt-repository ppa:fish-shell/release-3 -y sudo apt update - sudo apt install fish libnotify-bin xdotool fzf -y + sudo apt install fish libnotify-bin xdotool -y + if apt show fzf &>/dev/null; then + sudo apt install fzf + else + git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf + ~/.fzf/install + fi ;; pacman) ! which pip && $ROOT/python/install.sh diff --git a/nodejs/install.sh b/nodejs/install.sh index b8080ff..cf0a240 100755 --- a/nodejs/install.sh +++ b/nodejs/install.sh @@ -3,16 +3,33 @@ DIR=$(readlink -f $(dirname $0)) . $DIR/../env.sh +# install specific version +if [[ -n $1 ]]; then + if which node &>/dev/null && [[ "$1" != "$(node -v)" ]]; then + NODE_URL=https://nodejs.org/dist + in-china && NODE_URL=https://npm.taobao.org/mirrors/node + if [[ $1 == 'ls' ]]; then + curl -s $NODE_URL/index.json | jq '.[] | "\(.version) \(if .lts then "(lts)" else "" end)"' -r | less + exit + else + FN=node-$1-linux-x64.tar.gz + wget -O /tmp/$FN $NODE_URL/$1/$FN + sudo tar zxvf /tmp/$FN --strip 1 -C /usr/local/ + rm /tmp/$FN + fi + fi +else +# install from distribution repo + case "$PM" in + apt) + sudo apt install -y nodejs npm yarnpkg + ;; + pacman) + sudo pacman -S --needed nodejs npm yarn + ;; + esac +fi -# install nodejs and yarn -case "$PM" in - apt) - sudo apt install -y nodejs npm yarnpkg - ;; - pacman) - sudo pacman -S --needed nodejs npm yarn - ;; -esac # install nvm if fish-is-default-shell; then