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
|
TmpEnvFile=${TmpDir}/.env.tmp
|
||||||
|
|
||||||
usage() {
|
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
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
SKIP_PRE_GIT_PULL=false
|
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
|
while getopts "g" opt; do
|
||||||
case ${opt} in
|
case ${opt} in
|
||||||
g )
|
g )
|
||||||
@@ -47,7 +68,7 @@ pre-build-tar(){
|
|||||||
source ${BuildRootDir}/bin/control.sh
|
source ${BuildRootDir}/bin/control.sh
|
||||||
cd ${BuildRootDir}
|
cd ${BuildRootDir}
|
||||||
sed -i "s/YYYYMMDD/${RelDate}/" ${BuildDockerDir}/env/wfc-release
|
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(){
|
pre-git-pull(){
|
||||||
@@ -75,7 +96,7 @@ pre-build-deb(){
|
|||||||
fi
|
fi
|
||||||
cd ${BuildRootDir}
|
cd ${BuildRootDir}
|
||||||
sed -i "s/YYYYMMDD/${RelDate}/" ${BuildDockerDir}/env/wfc-release
|
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(){
|
build-extras(){
|
||||||
@@ -185,7 +206,7 @@ create-src-tar(){
|
|||||||
--exclude=${BuildRelativeDir}/.vscode \
|
--exclude=${BuildRelativeDir}/.vscode \
|
||||||
--exclude=${BuildRelativeDir}/.git \
|
--exclude=${BuildRelativeDir}/.git \
|
||||||
--exclude=${BuildRelativeDir}/tmp \
|
--exclude=${BuildRelativeDir}/tmp \
|
||||||
--exclude=${BuildRelativeDir}/release \
|
--exclude=${BuildRelativeDir}/release \
|
||||||
--exclude=${BuildRelativeDir}/build/docker/nginx/html \
|
--exclude=${BuildRelativeDir}/build/docker/nginx/html \
|
||||||
--exclude=${BuildRelativeDir}/build/docker/wfc/auth/jar/*.jar \
|
--exclude=${BuildRelativeDir}/build/docker/wfc/auth/jar/*.jar \
|
||||||
--exclude=${BuildRelativeDir}/build/docker/wfc/gateway/jar/*.jar \
|
--exclude=${BuildRelativeDir}/build/docker/wfc/gateway/jar/*.jar \
|
||||||
@@ -214,8 +235,9 @@ post-build(){
|
|||||||
# mv -f ${TmpEnvFile} ${BuildDockerDir}/.env
|
# mv -f ${TmpEnvFile} ${BuildDockerDir}/.env
|
||||||
# fi
|
# fi
|
||||||
cd ${BuildRootDir}
|
cd ${BuildRootDir}
|
||||||
git checkout ${BuildDockerDir}/env/wfc-release
|
sed -i "s/${RelDate}/YYYYMMDD/" ${BuildDockerDir}/env/wfc-release
|
||||||
git update-index --no-assume-unchanged ${BuildDockerDir}/env/wfc-release
|
# git checkout ${BuildDockerDir}/env/wfc-release
|
||||||
|
# git update-index --no-assume-unchanged ${BuildDockerDir}/env/wfc-release
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@@ -256,7 +278,7 @@ case "$1" in
|
|||||||
create-deb
|
create-deb
|
||||||
post-build
|
post-build
|
||||||
;;
|
;;
|
||||||
"src-tar")
|
"srctar")
|
||||||
if [ "$SKIP_PRE_GIT_PULL" = false ]; then
|
if [ "$SKIP_PRE_GIT_PULL" = false ]; then
|
||||||
pre-git-pull
|
pre-git-pull
|
||||||
fi
|
fi
|
||||||
@@ -266,10 +288,12 @@ case "$1" in
|
|||||||
# post-build
|
# post-build
|
||||||
;;
|
;;
|
||||||
"all")
|
"all")
|
||||||
$0 tar
|
# Recursively call the script with the 'deb' argument and pass necessary parameters
|
||||||
$0 deb
|
$0 deb "${ARGS[@]:2}"
|
||||||
|
# Recursively call the script with the 'tar' argument and pass necessary parameters
|
||||||
|
$0 tar "${ARGS[@]:2}"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
usage
|
usage
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
Reference in New Issue
Block a user