fix: secp256k1. node download error

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
2019-07-10 00:06:54 +08:00
parent e6ddbf9168
commit 71b17dd7b6
2 changed files with 9 additions and 8 deletions

View File

@ -18,5 +18,5 @@
### 后续重启或运行 ### 后续重启或运行
- 之后启动 不需要输入命令 直接双击执行当前目录下的 `OneKeyTera.sh` 即可 - 之后启动 不需要输入命令 直接双击执行当前目录下的 `OneKeyTera.sh` 即可
- ![图片](https://coding-net-production-pp-ci.codehub.cn/218855db-4bb1-460a-8387-60a651b8d242.png)
- 如果有问题 请反馈给 QQ 502647092 - 如果有问题 请反馈给 QQ 502647092

View File

@ -9,22 +9,22 @@ c_green="\033[38;5;2m"
c_reset="\033[0m" c_reset="\033[0m"
c_yellow="\033[38;5;3m" c_yellow="\033[38;5;3m"
c_prefix="${c_blue}${SHELL_PREFIX}>>${c_reset}" c_prefix="${c_green}${SHELL_PREFIX}>>${c_reset}"
dateStr() { dateStr() {
echo -e "[$(date '+%H:%M:%S')]" echo -e "[$(date '+%H:%M:%S')]"
} }
info() { info() {
echo -e "${c_prefix}$(dateStr) ${*}" echo -e "$(dateStr)${c_prefix} ${*}"
} }
warn() { warn() {
echo -e "${c_prefix}$(dateStr) ${c_yellow}${*}${c_reset}" echo -e "$(dateStr)${c_prefix} ${c_yellow}${*}${c_reset}"
} }
error() { error() {
echo -e "${c_prefix}$(dateStr) ${c_red}${*}${c_reset}" echo -e "$(dateStr)${c_prefix} ${c_red}${*}${c_reset}"
} }
#==================== #====================
@ -45,7 +45,7 @@ fi
echo $(date +%s) > .lock echo $(date +%s) > .lock
info "程序将在 3秒 后运行... Ctrl + C 取消运行..." info "程序将在 3秒 后运行... Ctrl + C 取消运行..."
sleep 2 sleep 2
info "开始检测安装依赖..." info "开始检测运行环境..."
if [[ -z "$(which node)" ]]; then if [[ -z "$(which node)" ]]; then
if [[ ! -d node ]]; then if [[ ! -d node ]]; then
warn "未安装NodeJS 开始下载二进制包 请稍候..." warn "未安装NodeJS 开始下载二进制包 请稍候..."
@ -80,6 +80,7 @@ fi
if [[ ! -f "${TERA_ROOT}/node_modules/secp256k1/build/Release/secp256k1.node" ]]; then if [[ ! -f "${TERA_ROOT}/node_modules/secp256k1/build/Release/secp256k1.node" ]]; then
warn "未检测到 secp256k1.node 模块 开始下载 Windows 版本..." warn "未检测到 secp256k1.node 模块 开始下载 Windows 版本..."
mkdir -p "${TERA_ROOT}/node_modules/secp256k1/build/Release"
curl -o "${TERA_ROOT}/node_modules/secp256k1/build/Release/secp256k1.node" https://git.yumc.pw/cloud/script/raw/master/tera/secp256k1.node curl -o "${TERA_ROOT}/node_modules/secp256k1/build/Release/secp256k1.node" https://git.yumc.pw/cloud/script/raw/master/tera/secp256k1.node
fi fi
@ -108,8 +109,8 @@ info "设置NTP服务器为阿里云地址 ${TERA_NTP_SERVER}"
sed -i s@pool.ntp.org@${TERA_NTP_SERVER}@g ${TERA_ROOT}/core/library.js sed -i s@pool.ntp.org@${TERA_NTP_SERVER}@g ${TERA_ROOT}/core/library.js
info "开始启动挖矿进程..." info "开始启动挖矿进程..."
echo "setTimeout(()=>require('child_process').exec('start http://127.0.0.1'), 3000)" > temp.js echo "setTimeout(()=>require('child_process').exec('start http://127.0.0.1'), 5000)" > temp.js
"${NODE}" temp.js && info "启动完成 打开系统默认浏览器..." && rm -rf temp.js & "${NODE}" temp.js && info "启动完成 打开系统默认浏览器..." && rm -rf temp.js &
while true; do while true; do
"${NODE}" run-node.js "${NODE}" run-node.js
echo "程序已关闭 将在3秒后重启 Ctrl + C 取消运行..." echo "程序已关闭 将在3秒后重启 Ctrl + C 取消运行..."