fix: build shell script
This commit is contained in:
1 parent
a5f31f6bb8
commit
0ce22ae0c4
16 files changed
+159
No files matched your search
@@ -1,3 +1,4 @@
|
||||
etc
|
||||
opt/lic/docker/jar/*.jar
|
||||
|
||||
release
|
||||
Executable
+154
@@ -0,0 +1,154 @@
|
||||
#!/bin/bash
|
||||
ProjectL=wfc-lic
|
||||
ProjectU=WFC-LIC
|
||||
RelDate=`date +%Y%m%d`
|
||||
#GitRootDir=${HOME}/wfc.git
|
||||
GitRootDir=$(dirname $(dirname $(dirname $(realpath $0))))
|
||||
SrcRootDir=${GitRootDir}/license.wfc
|
||||
BuildRootDir=${GitRootDir}/license.build.wfc
|
||||
|
||||
LicenseWorkDir=/opt/lic
|
||||
BuildDockerDir=${BuildRootDir}/debbuild/opt/docker
|
||||
ReleseDir=${BuildRootDir}/release
|
||||
|
||||
DebBuildDir=${BuildRootDir}/debbuild
|
||||
DebReleseDir=${ReleseDir}/debs
|
||||
|
||||
usage() {
|
||||
echo "Usage: sh build.sh [jar|srctar|deb] [-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 )
|
||||
SKIP_PRE_GIT_PULL=true
|
||||
;;
|
||||
\? )
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND -1))
|
||||
|
||||
pre-git-pull(){
|
||||
cd ${SrcRootDir}
|
||||
git pull
|
||||
cd ${BuildRootDir}
|
||||
git pull
|
||||
}
|
||||
|
||||
pre-build-deb(){
|
||||
if [ ! -d ${ReleseDir}/debs ]; then
|
||||
mkdir -p ${ReleseDir}/debs
|
||||
fi
|
||||
if [ ! -d ${DebBuildDir}/opt/lic ]; then
|
||||
mkdir -p ${DebBuildDir}/opt/lic
|
||||
fi
|
||||
# git update-index --assume-unchanged ${BuildDockerDir}/env/wfc-release
|
||||
}
|
||||
|
||||
build-jar(){
|
||||
cd ${SrcRootDir}
|
||||
# git pull
|
||||
mvn clean package -Dmaven.test.skip=true
|
||||
}
|
||||
|
||||
pre-build-src-tar(){
|
||||
if [ ! -d ${ReleseDir}/src-tars ]; then
|
||||
mkdir -p ${ReleseDir}/src-tars
|
||||
fi
|
||||
source ${BuildRootDir}/bin/control.sh
|
||||
}
|
||||
|
||||
clean-jar(){
|
||||
cd ${SrcRootDir}
|
||||
mvn clean
|
||||
}
|
||||
|
||||
copy-file-debbuild(){
|
||||
DocsRootDir=${BuildRootDir}/docs
|
||||
rm -rf ${DebBuildDir}/opt/lic/docker/jar/*.jar
|
||||
cp -rf ${SrcRootDir}/target/wfc-license-server*.jar ${DebBuildDir}/opt/lic/docker/jar/
|
||||
cp -rf ${DocsRootDir}/*.pdf ${DebBuildDir}/opt/lic/docs/
|
||||
}
|
||||
|
||||
# create source tar package
|
||||
create-src-tar(){
|
||||
SrcTarFileName=${ProjectL}-${RelVersion}-${RelDate}.src.tar.gz
|
||||
echo -n "Begin build source tar package(${SrcTarFileName}) ... "
|
||||
WFCRelativeDir=./wfc.git
|
||||
LicenseSrcDir=${WFCRelativeDir}/license.wfc
|
||||
LicenseBuildDir=${WFCRelativeDir}/license.build.wfc
|
||||
cd ${HOME}
|
||||
tar cvfz ${ReleseDir}/src-tars/${SrcTarFileName} \
|
||||
--exclude=${LicenseSrcDir}/.git \
|
||||
--exclude=${LicenseSrcDir}/.vscode \
|
||||
--exclude=${LicenseSrcDir}/target \
|
||||
--exclude=${LicenseBuildDir}/.git \
|
||||
--exclude=${LicenseBuildDir}/.vscode \
|
||||
--exclude=${LicenseBuildDir}/debbuild/opt/lic/docker/jar/*.jar \
|
||||
--exclude=${LicenseBuildDir}/debbuild/opt/lic/docs \
|
||||
--exclude=${LicenseBuildDir}/release \
|
||||
${LicenseSrcDir} ${LicenseBuildDir} 1>/dev/null
|
||||
echo "done"
|
||||
}
|
||||
|
||||
# create deb package
|
||||
create-deb(){
|
||||
Version=$(grep '^Version:' ${DebBuildDir}/DEBIAN/control | awk '{print $2}')
|
||||
DebPkgFile=${ProjectL}-${Version}-${RelDate}-ub22.deb
|
||||
echo -n "Begin build deb package(${DebPkgFile}) ... "
|
||||
dpkg -b ${DebBuildDir} ${DebReleseDir}/${DebPkgFile} 1>/dev/null
|
||||
echo "done"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
"jar")
|
||||
build-jar
|
||||
;;
|
||||
"deb")
|
||||
if [ "$SKIP_PRE_GIT_PULL" = false ]; then
|
||||
pre-git-pull
|
||||
fi
|
||||
pre-build-deb
|
||||
build-jar
|
||||
copy-file-debbuild
|
||||
create-deb
|
||||
;;
|
||||
"srctar")
|
||||
if [ "$SKIP_PRE_GIT_PULL" = false ]; then
|
||||
pre-git-pull
|
||||
fi
|
||||
pre-build-src-tar
|
||||
clean-jar
|
||||
create-src-tar
|
||||
# post-build
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,4 @@
|
||||
Package=WFC-LIC
|
||||
RelVersion=1.0.0
|
||||
Architecture=amd64
|
||||
Description='MacroHub Control and Billing System'
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
File renamed without changes.
Binary file not shown.
Reference in new issue
Block a user