Skip to content

Commit

Permalink
增加更新脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
炒饭 committed May 17, 2017
1 parent f7080a9 commit 3725674
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 55 deletions.
4 changes: 1 addition & 3 deletions bin/build.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
wechat_v="0.15.152900"
#nwjs_v="0.21.3"

wechat_v="0.17.170900"
nwjs_v="0.19.4"
75 changes: 38 additions & 37 deletions bin/pack.sh
Original file line number Diff line number Diff line change
@@ -1,67 +1,68 @@
#! /bin/sh
# tar wechat-dev-tools
#! /bin/bash
# 下载nwjs,构建项目,支持以下选项
# pack - 打包
# install - 构建,并且执行scripts/replace_weapp_vendor.sh
# build - 可以使用,但不执行scripts/replace_weapp_vendor.sh

param1=${1:-"pack"}
echo $param1
want=${1:-"build"}
if [ $want = "install" -o $want = "build" -o $want = "pack" ]; then
echo $want
else
echo "不支持$want操作"
exit 127
fi

cd `dirname $0`/..

cur_dir=$(pwd)
root_dir=$(pwd)

. "$cur_dir/bin/build.conf"
. "$root_dir/bin/build.conf"

tmp_dir="$cur_dir/.tmp"
dist_dir="$cur_dir/dist"
tmp_dir="$root_dir/.tmp"
dist_dir="$root_dir/dist"

nwjs_file="$tmp_dir/nwjs-v$nwjs_v.tar.gz"
nwjs_dir="$tmp_dir/nwjs-sdk-v${nwjs_v}-linux-x64"
nwjs_download="https://dl.nwjs.io/v$nwjs_v/nwjs-sdk-v${nwjs_v}-linux-x64.tar.gz"

dist_wechat_dir="wechat-dev-tools-xsp"
dist_wechat_package="wechat-v${wechat_v}-nwjs-v${nwjs_v}.tar.gz"

if [ $param1 = "install" ]; then
echo "install"
# rm -rf $tmp_dir
fi

mkdir -p $tmp_dir
if [ ! -d "$nwjs_dir" ]; then
if [ ! -f "$nwjs_file" ]; then
echo "================================="
echo "[注意]需要下载nwjs.请耐心等待下载完成"
echo $nwjs_download
echo "$nwjs_download"
echo "================================="
wget "$nwjs_download" -O $nwjs_file
wget "$nwjs_download" -O "$nwjs_file"
$? -ne 0 && exit "$?"
fi

tar -xf $nwjs_file -C $tmp_dir
tar -xf "$nwjs_file" -C $tmp_dir
$? -ne 0 && exit "$?"
cd "$nwjs_dir/locales" || exit "$?"
rm $(ls -I "zh*" -I "en*" )
cd "$cur_dir"
# 移除其他语言
ls -I "zh*" -I "en*" | xargs rm
cd "$root_dir"
fi

rm -rf $cur_dir/dist
mkdir -p $cur_dir/dist
rm -rf "$dist_dir"
mkdir -p "$dist_dir"

cp -r "$nwjs_dir"/* "$root_dir/scripts" "$dist_dir"

if [ $param1 = "install" ]; then
cp -r "$nwjs_dir"/* "$cur_dir/scripts" "$cur_dir/dist"
cd "$cur_dir/dist"
ln -s "$cur_dir/package.nw"
sh scripts/install.sh
elif [ $param1 = "build" ]; then
cp -r "$nwjs_dir"/* "$cur_dir/scripts" "$cur_dir/dist"
cd "$cur_dir/dist"
ln -s "$cur_dir/package.nw"
elif [ $param1 = "pack" ]; then
cp -r "$nwjs_dir"/* "$cur_dir/package.nw" "$cur_dir/scripts" "$cur_dir/dist"
mkdir -p $tmp_dir/build
tar -zcvf "$tmp_dir/build/$dist_wechat_package" -C "$cur_dir" dist
if [ $want = "pack" ]; then
cp -r "$root_dir/package.nw" "$dist_dir"
mkdir -p "$tmp_dir/build"
tar -zcvf "$tmp_dir/build/$dist_wechat_package" -C "$root_dir" dist
else
echo "不支持$param1操作"
exit 127
ln -s "$root_dir/package.nw"
if [ $want = "install" ]; then
sh "$dist_dir/scripts/replace_weapp_vendor.sh"
fi
fi
echo "$param1 success"

echo "================================="
echo "$want success"
echo "可以手动删除目录下.tmp文件夹"
echo "================================="
33 changes: 33 additions & 0 deletions bin/update_package_nw.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#! /bin/bash

cd `dirname $0`/..

root_dir=$(pwd)

. "$root_dir/bin/build.conf"

tmp_dir="$root_dir/.tmp"
dist_dir="$root_dir/dist"

wcwd_file="$tmp_dir/wechat_web_devtools_${wechat_v}_x64.exe"
wcwd_download="https://dldir1.qq.com/WechatWebDev/${wechat_v//./}/wechat_web_devtools_${wechat_v}_x64.exe"

wcwd_package_dir="$HOME/.wine/drive_c/Program Files (x86)/Tencent/微信web开发者工具/package.nw"

mkdir -p $tmp_dir

# 下载
if [ ! -f "$wcwd_file" ]; then
echo "================================="
echo "[注意]需要下载微信开发者工具.请耐心等待下载完成"
echo $wcwd_download
echo "================================="
wget "$wcwd_download" -O $wcwd_file
$? -ne 0 && exit "$?"
fi

# 安装
wine $wcwd_file

rm -rf "$root_dir/package.nw"
cp -r "$wcwd_package_dir" "$root_dir"
7 changes: 0 additions & 7 deletions note.md

This file was deleted.

8 changes: 0 additions & 8 deletions replace.sh

This file was deleted.

File renamed without changes.

0 comments on commit 3725674

Please sign in to comment.