wechat-web-devtools-linux/tools/setup-wechat-devtools-bash
msojocs 5be7974b85 Squashed commit of the following:
commit 28e7e834f793b3c9ce05c47d41e15f8a1f49d30b
Author: msojocs <jiyecafe@gmail.com>
Date:   Thu Apr 7 13:22:57 2022 +0800

    fix: 7z

commit 15f29ca887a51d7ecc783f8fddabf4e9cd3b5d21
Author: msojocs <jiyecafe@gmail.com>
Date:   Thu Apr 7 13:12:07 2022 +0800

    update: flatpak

commit 6f048bf662c2e2f64addd58d9039310a189af441
Author: msojocs <jiyecafe@gmail.com>
Date:   Thu Apr 7 12:26:45 2022 +0800

    update

commit 039de9c1b3dd53960dd7cb7fbdea6bf147481536
Author: msojocs <jiyecafe@gmail.com>
Date:   Thu Apr 7 12:16:18 2022 +0800

    update: flatpak

commit da0a56a89256a5b9792edd625666d06949ede55c
Author: msojocs <jiyecafe@gmail.com>
Date:   Thu Apr 7 12:16:02 2022 +0800

    fix: 可能的vscode-ripgrep/bin/rg 不存在问题

commit 9f7fd4ed39cc335966a095c9ab05931246282e3e
Author: msojocs <jiyecafe@gmail.com>
Date:   Wed Apr 6 23:34:18 2022 +0800

    update: flatpak

commit b00dfb3ef7d46f0423fa916078c6de6506ad525f
Author: msojocs <jiyecafe@gmail.com>
Date:   Wed Apr 6 23:20:48 2022 +0800

    feat: nodegit compiler in parallel

commit 4ff58b2fb854a874de86a5ec2be1846d8bb00f2c
Author: msojocs <jiyecafe@gmail.com>
Date:   Wed Apr 6 13:54:21 2022 +0800

    update: mirror

commit 76aac0f6a5ecae98c28b77ffc016a79d530584b1
Author: msojocs <jiyecafe@gmail.com>
Date:   Sun Apr 3 23:05:16 2022 +0800

    fix: build

commit 3099858f56eab1db82c9965a60c323869898e37f
Author: msojocs <jiyecafe@gmail.com>
Date:   Sun Apr 3 22:11:24 2022 +0800

    update

commit 150a944c026f14e6e4157ed84243560565a89818
Author: msojocs <jiyecafe@gmail.com>
Date:   Sat Mar 26 20:22:43 2022 +0800

    test

commit 6fa17ebca20f2980f08774c56a48dfa1b5ea6381
Author: msojocs <jiyecafe@gmail.com>
Date:   Sat Mar 26 19:05:35 2022 +0800

    fix: deepin build

commit 3c373a8f6fa765741c3a974d72833b3e240adb2a
Author: msojocs <jiyecafe@gmail.com>
Date:   Sat Mar 26 18:06:43 2022 +0800

    update: deepin build

commit f29fa16289132b40ef1d85992600770cfd2ba298
Author: msojocs <jiyecafe@gmail.com>
Date:   Fri Mar 25 22:42:45 2022 +0800

    使用debuild

commit 324d866482c77a9b7bb4715eebed9c149af7b1d8
Author: msojocs <jiyecafe@gmail.com>
Date:   Wed Mar 23 09:35:12 2022 +0800

    fix: krb5

commit e463415599a04fae282cb36e8a5d3ee2ebae2239
Author: msojocs <jiyecafe@gmail.com>
Date:   Tue Mar 22 22:58:52 2022 +0800

    feat: flatpak

commit 83677cba04e9d84a1ef12cfdeacb0f1e779b4e8c
Merge: 7ff73e1 41ad887
Author: msojocs <jiyecafe@gmail.com>
Date:   Tue Mar 22 13:27:06 2022 +0800

    Merge branch 'master' into flatpak

commit 7ff73e13c795ef1e84b6a6f09fb9347de3600947
Author: msojocs <jiyecafe@gmail.com>
Date:   Fri Mar 11 22:44:35 2022 +0800

    test
2022-04-07 13:43:45 +08:00

105 lines
3.5 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
set -e # 命令出错就退出
trap 'catchError $LINENO $BASH_COMMAND' SIGHUP SIGINT SIGQUIT EXIT # 捕获错误情况
catchError() {
exit_code=$?
if [ $exit_code -ne 0 ]; then
fail "\033[31mcommand: $2\n at $0:$1\n at $STEP\033[0m"
fi
exit $exit_code
}
success() {
echo -e "\033[42;37m 成功 \033[0m $1"
}
fail() {
echo -e "\033[41;37m 失败 \033[0m $1"
}
notice() {
echo -e "\033[36m $1 \033[0m "
}
root_dir=$(cd `dirname $0`/.. && pwd -P)
echo "==========Initializing node=========="
if [ -f "$root_dir/node/bin/node" ]; then
success "node安装完毕"
else
"$root_dir/tools/update-node.sh"
success "node ok"
fi
if [ ! -f "$root_dir/node/bin/node" ]; then
fail "Node安装失败"
exit
fi
# 将node加入环境
export PATH="$root_dir/node/bin":$PATH
if [ $ACTION_MODE!='true' ]; then
notice "非ACTION模式, 设置镜像源"
npm config set registry http://registry.npmmirror.com/ # 注册模块镜像
npm config set disturl http://npmmirror.com/dist # node-gyp 编译依赖的 node 源码镜像
## 以下选择添加
npm config set sass_binary_site http://npmmirror.com/mirrors/node-sass # node-sass 二进制包镜像
npm config set electron_mirror http://npmmirror.com/mirrors/electron/ # electron 二进制包镜像
npm config set puppeteer_download_host http://npmmirror.com/mirrors # puppeteer 二进制包镜像
npm config set chromedriver_cdnurl http://npmmirror.com/mirrors/chromedriver # chromedriver 二进制包镜像
npm config set operadriver_cdnurl http://npmmirror.com/mirrors/operadriver # operadriver 二进制包镜像
npm config set phantomjs_cdnurl http://npmmirror.com/mirrors/phantomjs # phantomjs 二进制包镜像
npm config set selenium_cdnurl http://npmmirror.com/mirrors/selenium # selenium 二进制包镜像
npm config set node_inspector_cdnurl http://npmmirror.com/mirrors/node-inspector # node-inspector 二进制包镜像
# npm cache clean --force # 清空缓存
fi
echo "=====安装node-gyp nw-gyp===="
npm uninstall node-gyp -g
npm install node-gyp nw-gyp npm -g
node-gyp install
node-gyp list
echo "==========Initializing nwjs=========="
if [ -f "$root_dir/nwjs/nw" ]; then
success "nwjs安装完毕"
else
node "$root_dir/tools/update-nwjs-node"
fi
# 7z旧版本解压不正常
# rm -rf "$root_dir/tmp/7z"
# mkdir -p "$root_dir/tmp/7z"
# cd "$root_dir/tmp/7z"
# wget https://www.7-zip.org/a/7z2107-linux-x64.tar.xz
# tar -xJf 7z2107-linux-x64.tar.xz
# ln -s 7zz 7z
# export PATH="$root_dir/tmp/7z:$PATH"
echo "==========Initializing wechat-devtools package=========="
if [[ $@ == *version* ]];then
# 参数有版本号优先级高清空TARGET_VERSION
echo "参数有版本号"
TARGET_VERSION=""
else
# 参数没有版本号,获取
echo "参数没有版本号"
VERSION_DATA=$( cat "$root_dir/conf/devtools_v" )
VERSION_DATA=(${VERSION_DATA//,/ })
TARGET_VERSION="version=${VERSION_DATA[0]}"
fi
echo "TARGET_VERSION: $TARGET_VERSION"
if [ ! -f "$root_dir/package.nw/package.json" ];then
# 没装,直接装
node "$root_dir/tools/update-wechat-devtools-node" $TARGET_VERSION $@
exit 0
fi
# 装了,获取已安装版本
DEVTOOLS_VERSION=$( cat "$root_dir/package.nw/package.json" | grep -m 1 -Eo "\"[0-9]{1}\.[0-9]{2}\.[0-9]+" )
DEVTOOLS_VERSION="${DEVTOOLS_VERSION//\"/}"
# 已安装, 比较目标版本
if [ "$TARGET_VERSION" == "$DEVTOOLS_VERSION" ];then
success "微信开发者工具安装完毕"
exit 0
fi
node "$root_dir/tools/update-wechat-devtools-node" $TARGET_VERSION $@