#!/data/data/com.termux/files/usr/bin/bash
echo ""
echo ""
echo ""
echo "++++++++++++++++"
echo ""
echo "正在更新,请稍后..."
echo ""
echo "++++++++++++++++"
echo ""
echo ""
echo ""
pkg upgrade -y
echo ""
echo ""
echo ""
echo "++++++++++++++++++++++++++++++++++++++++++++++++"
echo ""
echo "正在安装环境(git,python,nodejs,yarn,openssh,termux-auth),请稍后..."
echo "正在安装环境(git,python,nodejs,yarn,openssh,termux-auth),请稍后..."
echo "正在安装环境(git,python,nodejs,yarn,openssh,termux-auth),请稍后..."
echo "正在安装环境(git,python,nodejs,yarn,openssh,termux-auth),请稍后..."
echo "正在安装环境(git,python,nodejs,yarn,openssh,termux-auth),请稍后..."
echo ""
echo "++++++++++++++++++++++++++++++++++++++++++++++++"
echo ""
echo ""
echo ""
pkg install git openssl-tool python nodejs yarn openssh termux-auth -y
echo ""
echo ""
echo ""
echo "++++++++++++++++++++++++++++++++++++++++++++++++"
echo ""
echo "正在移除以前安装的vscode,时间可能较长请耐心等待....."
echo ""
echo "++++++++++++++++++++++++++++++++++++++++++++++++"
echo ""
echo ""
echo ""
yarn global remove code-server
echo ""
echo ""
echo ""
echo "++++++++++++++++++++++++++++++++++++++++++++++++"
echo ""
echo "正在从服务器拉取并编译vscode,时间可能较长请耐心等待...."
echo ""
echo "++++++++++++++++++++++++++++++++++++++++++++++++"
echo ""
echo ""
echo ""

yarn global add code-server
echo ""
echo ""
echo ""
echo "+++++++++++++"
echo ""
echo "登录密码请在:~/.config/code-server/config.yaml"
echo "文件查看"
echo ""
echo "+++++++++++++"
echo ""
echo ""
echo ""
echo "+++++++++++++"
echo ""
echo "正在完成最后的修复..."
echo ""
echo "+++++++++++++"
echo ""
echo ""
echo ""
pkg install ripgrep -y
cd ~/.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/vscode-ripgrep/bin
ln -s $(which rg) .
cd ~
cp binding.gyp /.config/yarn/global/node_modules/code-server/lib/vscode/node_modules/spdlog/binding.gyp
echo ""
echo ""
echo ""
echo "++++++++++++++++++++++++++++++++++++++++++++++++"
echo ""
echo "安装成功,请输入:"
echo "code-server --bind-addr 0.0.0.0:8080 --cert --disable-telemetry"
echo "来开启vscode"
echo "在浏览器输入:127.0.0.1:8080 来使用VSCODE"
echo "用户密码为:"
cat ~/.config/code-server/config.yaml
echo "++++++++++++++++++++++++++++++++++++++++++++++++"
