diff --git a/tools/fix-core.sh b/tools/fix-core.sh index 6ec84aa..6a547df 100755 --- a/tools/fix-core.sh +++ b/tools/fix-core.sh @@ -1,5 +1,21 @@ #!/bin/bash root_dir=$(cd `dirname $0`/.. && pwd -P) +set -e +trap 'catchError $LINENO "$BASH_COMMAND"' ERR # 捕获错误情况 +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 +} + +notice() { + echo -e "\033[36m $1 \033[0m " +} +fail() { + echo -e "\033[41;37m 失败 \033[0m $1" +} package_dir="$root_dir/package.nw" tmp_dir="$root_dir/tmp/core" @@ -35,6 +51,7 @@ if [[ ! -z $token_find_result ]];then fi # open -a Terminal "`pwd`" --> gnome-terminal +notice "fix terminal" find_result=$( grep -lr 'open -a Terminal "`pwd`"' "$tmp_dir/core.wxvpkg" ) echo "Terminal启动位置: $find_result" if [[ ! -z $find_result ]];then @@ -79,6 +96,7 @@ if [[ "$WINE" != 'true' ]];then fi # fix theme +notice "fix theme" find_result=$( grep -lr "OSThemeController=" "$tmp_dir/core.wxvpkg" ) echo "theme: $find_result" if [[ -n $find_result ]];then @@ -93,8 +111,11 @@ if [[ -n $find_result ]];then fi # fix update check +notice "fix update check" +sed -i 's#