update: 调整参数优先级大于环境变量

This commit is contained in:
msojocs 2022-03-06 12:16:01 +08:00
parent b6084b9b3e
commit 418714ca65
5 changed files with 23 additions and 27 deletions

View File

@ -12,11 +12,10 @@ fail() {
echo -e "\033[41;37m 失败 \033[0m $1" echo -e "\033[41;37m 失败 \033[0m $1"
} }
if [ -n "$1" ];then
if [ -z $VERSION ];then
export VERSION=$1 export VERSION=$1
fi fi
if [ -z $ARCH ];then if [ -n "$2" ];then
export ARCH=$2 export ARCH=$2
fi fi

View File

@ -16,7 +16,7 @@ root_dir=$(cd `dirname $0`/.. && pwd -P)
DEVTOOLS_VERSION=$( cat "$root_dir/package.nw/package.json" | grep -m 1 -Eo "\"[0-9]{1}\.[0-9]{2}\.[0-9]+" ) 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//\"/}" DEVTOOLS_VERSION="${DEVTOOLS_VERSION//\"/}"
echo $BUILD_VERSION echo $BUILD_VERSION
if [ -z "$BUILD_VERSION" ];then if [ -n "$1" ];then
export BUILD_VERSION=$1 export BUILD_VERSION=$1
fi fi
if [ -z "$BUILD_VERSION" ];then if [ -z "$BUILD_VERSION" ];then

View File

@ -12,7 +12,7 @@ root_dir=$(cd `dirname $0`/.. && pwd -P)
DEVTOOLS_VERSION=$( cat "$root_dir/package.nw/package.json" | grep -m 1 -Eo "\"[0-9]{1}\.[0-9]{2}\.[0-9]+" ) 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//\"/}" DEVTOOLS_VERSION="${DEVTOOLS_VERSION//\"/}"
echo $BUILD_VERSION echo $BUILD_VERSION
if [ -z "$BUILD_VERSION" ];then if [ -n "$1" ];then
export BUILD_VERSION=$1 export BUILD_VERSION=$1
fi fi
if [ -z "$BUILD_VERSION" ];then if [ -z "$BUILD_VERSION" ];then

View File

@ -6,26 +6,25 @@
# 脚本执行前提已完成支持wine的基本构建 # 脚本执行前提已完成支持wine的基本构建
set -e set -e
root_dir=$(cd `dirname $0`/.. && pwd -P)
tmp_dir="$root_dir/tmp"
if [ -z $VERSION ];then
export VERSION=$2
fi
if [ -z $ARCH ];then
export ARCH=$1
fi
success() { success() {
echo -e "\033[42;37m 成功 \033[0m $1" echo -e "\033[42;37m 成功 \033[0m $1"
} }
notice() { notice() {
echo -e "\033[36m $1 \033[0m " echo -e "\033[36m $1 \033[0m "
} }
fail() { fail() {
echo -e "\033[41;37m 失败 \033[0m $1" echo -e "\033[41;37m 失败 \033[0m $1"
} }
root_dir=$(cd `dirname $0`/.. && pwd -P)
tmp_dir="$root_dir/tmp"
if [ -n "$2" ];then
export VERSION=$2
fi
if [ -n "$1" ];then
export ARCH=$1
fi
DEVTOOLS_VERSION=$( cat "$root_dir/package.nw/package.json" | grep -m 1 -Eo "\"[0-9]{1}\.[0-9]{2}\.[0-9]+" ) 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//\"/}" DEVTOOLS_VERSION="${DEVTOOLS_VERSION//\"/}"

View File

@ -7,28 +7,26 @@
# 脚本执行前提已完成支持wine的基本构建 # 脚本执行前提已完成支持wine的基本构建
set -e set -e
root_dir=$(cd `dirname $0`/.. && pwd -P)
tmp_dir="$root_dir/tmp"
store_dir="$tmp_dir/build"
mkdir -p $store_dir
if [ -z $VERSION ];then
export VERSION=$1
fi
if [ -z $ARCH ];then
export ARCH=$2
fi
success() { success() {
echo -e "\033[42;37m 成功 \033[0m $1" echo -e "\033[42;37m 成功 \033[0m $1"
} }
notice() { notice() {
echo -e "\033[36m $1 \033[0m " echo -e "\033[36m $1 \033[0m "
} }
fail() { fail() {
echo -e "\033[41;37m 失败 \033[0m $1" echo -e "\033[41;37m 失败 \033[0m $1"
} }
root_dir=$(cd `dirname $0`/.. && pwd -P)
tmp_dir="$root_dir/tmp"
store_dir="$tmp_dir/build"
mkdir -p $store_dir
if [ -n "$1" ];then
export VERSION=$1
fi
if [ -n "$2" ];then
export ARCH=$2
fi
if [[ $VERSION == '' ]];then if [[ $VERSION == '' ]];then
fail "请指定版本" fail "请指定版本"
exit 1 exit 1