|
1 | 1 | #! /bin/sh |
2 | 2 | # tar wechat-dev-tools |
3 | 3 |
|
4 | | -. ./build.conf |
5 | | -package_dir="./package.nw" |
6 | | -tmp_dir="./.tmp" |
7 | | -dist_dir="./dist" |
8 | | -build_dir="./.build" |
9 | | -nwjs_file="nwjs-v$nwjs_v.tar.gz" |
10 | | -nwjs_dir="nwjs-sdk-v${nwjs_v}-linux-x64" |
| 4 | +cur_dir=`dirname $0` |
| 5 | +. "$cur_dir/build.conf" |
| 6 | +package_dir="$cur_dir/package.nw" |
| 7 | +tmp_dir="$cur_dir/.tmp" |
| 8 | +build_dir="$cur_dir/dist" |
| 9 | + |
| 10 | +nwjs_file="$tmp_dir/nwjs-v$nwjs_v.tar.gz" |
| 11 | +nwjs_dir="$tmp_dir/nwjs-sdk-v${nwjs_v}-linux-x64" |
11 | 12 | nwjs_download="https://dl.nwjs.io/v$nwjs_v/nwjs-sdk-v${nwjs_v}-linux-x64.tar.gz" |
12 | 13 |
|
13 | | -dist_wechat_dir="wechat-dev-tools" |
14 | | -dist_wechat_package="wechat-v${wechat_v}-nwjs-v${nwjs_v}.tar.gz" |
| 14 | +dist_wechat_dir="$tmp_dir/wechat-dev-tools" |
| 15 | +dist_wechat_package="$tmp_dir/wechat-v${wechat_v}-nwjs-v${nwjs_v}.tar.gz" |
| 16 | + |
15 | 17 | mkdir -p $tmp_dir |
16 | | -if [ ! -d "$tmp_dir/$nwjs_dir" ]; then |
17 | | - if [ ! -f "$tmp_dir/$nwjs_file" ]; then |
18 | | - wget "$nwjs_download" -O .tmp/$nwjs_file |
19 | | - $? -ne 0 && exit $? |
| 18 | +if [ ! -d "$nwjs_dir" ]; then |
| 19 | + if [ ! -f "$nwjs_file" ]; then |
| 20 | + wget "$nwjs_download" -O $nwjs_file |
| 21 | + $? -ne 0 && exit "$?" |
20 | 22 | fi |
21 | 23 |
|
22 | | - tar -xf $tmp_dir/$nwjs_file -C $tmp_dir |
23 | | - $? -ne 0 && exit $? |
| 24 | + tar -xf $nwjs_file -C $tmp_dir |
| 25 | + $? -ne 0 && exit "$?" |
24 | 26 | fi |
25 | 27 |
|
26 | | -rm -rf $dist_dir |
27 | | -mkdir -p $dist_dir/$dist_wechat_dir |
28 | | -cp -rl "$tmp_dir/$nwjs_dir"/* "$dist_dir/$dist_wechat_dir" && |
29 | | -cp -rl "$package_dir" "$dist_dir/$dist_wechat_dir" && |
30 | | -tar -zcvf "$dist_dir/$dist_wechat_package" "$dist_dir/$dist_wechat_dir" |
| 28 | +rm -rf $dist_wechat_dir |
| 29 | +mkdir -p $dist_wechat_dir |
| 30 | +cp -rl "$nwjs_dir"/* "$dist_wechat_dir" && |
| 31 | +cp -rl "$package_dir" "$dist_wechat_dir" && |
| 32 | +tar -zcvf "$dist_wechat_package" "$dist_wechat_dir" |
31 | 33 |
|
32 | 34 | mkdir -p $build_dir |
33 | | -cp -l "$dist_dir/$dist_wechat_package" "$build_dir" |
| 35 | +mv -f "$dist_wechat_package" "$build_dir" |
34 | 36 |
|
0 commit comments