fix: for ubuntu

This commit is contained in:
Klesh Wong 2021-10-09 23:19:35 +08:00
parent b801eac38c
commit ec8a92e695
2 changed files with 21 additions and 9 deletions

View File

@ -6,17 +6,28 @@ DIR=$(dirname "$(readlink -f "$0")")
log 'Setting up nnn'
$NNN_CONFIG_DIR="$XDG_CONFIG_HOME/nnn/plugins"
# setup package mirror for CHINA
case "$PM" in
apt)
echo TODO
exit -1
mkdir -p ~/.local/bin
HTTPS_PROXY=$GITHUB_PROXY curl -Lo /tmp/nnn.tar.gz https://github.com/jarun/nnn/releases/download/v4.3/nnn-static-4.3.x86_64.tar.gz
cd /tmp
tar zxvf nnn.tar.gz
mv nnn-static ~/.local/bin/nnn
rm -rf nnn.tar.gz
cd -
mkdir -p "$NNN_CONFIG_DIR"
HTTPS_PROXY=$GITHUB_PROXY curl -Lo "$NNN_CONFIG_DIR/plugins/fzcd" https://github.com/jarun/nnn/raw/master/plugins/fzcd
HTTPS_PROXY=$GITHUB_PROXY curl -Lo "$NNN_CONFIG_DIR/plugins/preview-tui" https://github.com/jarun/nnn/raw/master/plugins/preview-tui
;;
pacman)
sudo pacman -S --noconfirm --needed nnn
yay -S --noconfirm --needed dragon-drag-and-drop
cp -r /usr/share/nnn/plugins/. "$NNN_CONFIG_DIR"
esac
# configuration
lnsf "$DIR/nnn/n.fish" "$XDG_CONFIG_HOME/fish/functions/n.fish"
cp -r /usr/share/nnn/plugins/. "$XDG_CONFIG_HOME/nnn/plugins"

View File

@ -7,11 +7,12 @@ DIR=$(dirname "$(readlink -f "$0")")
FILES_PATH=$PREFIX/nodejs
NODE_BIN=$PREFIX/bin/node
NODE_URL=https://nodejs.org/dist
NODE_VERSION=v14.15.4
NODE_VERSION=v14.18.0
NPM_BIN=npm
NPM_CONFIG_REGISTRY=
if in_china; then
NPM_REGISTRY_URL=https://npmreg.mirrors.ustc.edu.cn
NODE_URL=$NPM_REGISTRY
export NPM_CONFIG_REGISTRY=https://registry.npmmirror.com
NODE_URL=https://npmmirror.com/mirrors/node
NPM_BIN=npm
fi
export NPM_BIN
@ -61,14 +62,14 @@ install() {
| sudo tee "$FILES_PATH" >/dev/null
# remove download path
rm "/tmp/$NAME"
sudo npm install -g yarn
configure_nodejs
}
configure_nodejs() {
if in_china; then
echo "registry=$NPM_REGISTRY_URL" > ~/.npmrc
yarnpkg config set registry $NPM_REGISTRY_URL --global
echo "registry=$NPM_CONFIG_REGISTRY" > ~/.npmrc
! has_cmd yarnpkg && sudo npm install -g yarn
yarnpkg config set registry $NPM_CONFIG_REGISTRY --global
#yarnpkg config set disturl https://npm.taobao.org/dist --global
#yarnpkg config set sass_binary_site https://npm.taobao.org/mirrors/node-sass --global
#yarnpkg config set electron_mirror https://npm.taobao.org/mirrors/electron/ --global