fix: build option -g enhancement
This commit is contained in:
44
bin/build.sh
44
bin/build.sh
@@ -22,12 +22,33 @@ TmpDir=${BuildRootDir}/tmp
|
||||
TmpEnvFile=${TmpDir}/.env.tmp
|
||||
|
||||
usage() {
|
||||
echo "Usage: sh build.sh [-g] [extras|jar|dist|copy|tar|src-tar|deb|all]"
|
||||
echo "Usage: sh build.sh [extras|jar|dist|copy|tar|srctar|deb|all] [-g]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
SKIP_PRE_GIT_PULL=false
|
||||
|
||||
# Reorder arguments so that options come first
|
||||
ARGS=()
|
||||
for arg in "$@"; do
|
||||
case $arg in
|
||||
-g)
|
||||
SKIP_PRE_GIT_PULL=true
|
||||
;;
|
||||
*)
|
||||
ARGS+=("$arg")
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if SKIP_PRE_GIT_PULL=true; then
|
||||
ARGS+=("-g")
|
||||
fi
|
||||
|
||||
# Restore positional parameters
|
||||
set -- "${ARGS[@]}"
|
||||
|
||||
# Process options
|
||||
while getopts "g" opt; do
|
||||
case ${opt} in
|
||||
g )
|
||||
@@ -47,7 +68,7 @@ pre-build-tar(){
|
||||
source ${BuildRootDir}/bin/control.sh
|
||||
cd ${BuildRootDir}
|
||||
sed -i "s/YYYYMMDD/${RelDate}/" ${BuildDockerDir}/env/wfc-release
|
||||
git update-index --assume-unchanged ${BuildDockerDir}/env/wfc-release
|
||||
# git update-index --assume-unchanged ${BuildDockerDir}/env/wfc-release
|
||||
}
|
||||
|
||||
pre-git-pull(){
|
||||
@@ -75,7 +96,7 @@ pre-build-deb(){
|
||||
fi
|
||||
cd ${BuildRootDir}
|
||||
sed -i "s/YYYYMMDD/${RelDate}/" ${BuildDockerDir}/env/wfc-release
|
||||
git update-index --assume-unchanged ${BuildDockerDir}/env/wfc-release
|
||||
# git update-index --assume-unchanged ${BuildDockerDir}/env/wfc-release
|
||||
}
|
||||
|
||||
build-extras(){
|
||||
@@ -185,7 +206,7 @@ create-src-tar(){
|
||||
--exclude=${BuildRelativeDir}/.vscode \
|
||||
--exclude=${BuildRelativeDir}/.git \
|
||||
--exclude=${BuildRelativeDir}/tmp \
|
||||
--exclude=${BuildRelativeDir}/release \
|
||||
--exclude=${BuildRelativeDir}/release \
|
||||
--exclude=${BuildRelativeDir}/build/docker/nginx/html \
|
||||
--exclude=${BuildRelativeDir}/build/docker/wfc/auth/jar/*.jar \
|
||||
--exclude=${BuildRelativeDir}/build/docker/wfc/gateway/jar/*.jar \
|
||||
@@ -214,8 +235,9 @@ post-build(){
|
||||
# mv -f ${TmpEnvFile} ${BuildDockerDir}/.env
|
||||
# fi
|
||||
cd ${BuildRootDir}
|
||||
git checkout ${BuildDockerDir}/env/wfc-release
|
||||
git update-index --no-assume-unchanged ${BuildDockerDir}/env/wfc-release
|
||||
sed -i "s/${RelDate}/YYYYMMDD/" ${BuildDockerDir}/env/wfc-release
|
||||
# git checkout ${BuildDockerDir}/env/wfc-release
|
||||
# git update-index --no-assume-unchanged ${BuildDockerDir}/env/wfc-release
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
@@ -256,7 +278,7 @@ case "$1" in
|
||||
create-deb
|
||||
post-build
|
||||
;;
|
||||
"src-tar")
|
||||
"srctar")
|
||||
if [ "$SKIP_PRE_GIT_PULL" = false ]; then
|
||||
pre-git-pull
|
||||
fi
|
||||
@@ -266,10 +288,12 @@ case "$1" in
|
||||
# post-build
|
||||
;;
|
||||
"all")
|
||||
$0 tar
|
||||
$0 deb
|
||||
# Recursively call the script with the 'deb' argument and pass necessary parameters
|
||||
$0 deb "${ARGS[@]:2}"
|
||||
# Recursively call the script with the 'tar' argument and pass necessary parameters
|
||||
$0 tar "${ARGS[@]:2}"
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user