feat: 更新版本占位符并重构打包脚本
This commit is contained in:
33
bin/build.sh
33
bin/build.sh
@@ -56,7 +56,7 @@ fi
|
||||
ProjectL=omc
|
||||
ProjectU=OMC
|
||||
PROJECT=${ProjectL}
|
||||
VERSION=2.2508.1
|
||||
VERSION={version}
|
||||
RelDate=`date +%Y%m%d`
|
||||
RelVer=${VERSION}-${RelDate}-mt
|
||||
Ky10Arch=ky10.aarch64
|
||||
@@ -111,15 +111,7 @@ fi
|
||||
case "${pkgtype}" in
|
||||
rpm)
|
||||
echo "Begin to make ${pkgtype} package ======>"
|
||||
ReleasePkgDir=${ReleaseDir}/rpms/${RelArch}
|
||||
ProcList="restagent sshsvc"
|
||||
cd $EmsBEDir
|
||||
for procName in $ProcList;do
|
||||
cd $EmsBEDir/$procName
|
||||
echo "Make $procName ..."
|
||||
make
|
||||
done
|
||||
|
||||
|
||||
cd $EmsBEDir
|
||||
# make rpm
|
||||
# clear build cache
|
||||
@@ -153,7 +145,8 @@ case "${pkgtype}" in
|
||||
#cp -rf ${BuildDir}/systemd ${RpmBuildDir}/BUILD/lib/
|
||||
cd ${RpmBuildDir}
|
||||
rpmbuild -bb -D "_topdir ${RpmBuildDir}" ${RpmBuildDir}/SPECS/omc.spec
|
||||
|
||||
|
||||
ReleasePkgDir=${ReleaseDir}/rpms/${RelArch}
|
||||
mv -f $RpmsDir/$RpmArch/$RpmPkgName ${ReleasePkgDir}/$RpmPkgRename
|
||||
cd ${ReleasePkgDir}
|
||||
rm -f omc-md5sum.txt
|
||||
@@ -163,14 +156,6 @@ case "${pkgtype}" in
|
||||
;;
|
||||
deb)
|
||||
echo "Begin to make ${pkgtype} package ======>"
|
||||
ReleasePkgDir=${ReleaseDir}/debs/${RelArch}
|
||||
ProcList="restagent sshsvc"
|
||||
cd $EmsBEDir
|
||||
for procName in $ProcList;do
|
||||
cd $EmsBEDir/$procName
|
||||
echo "Make $procName ..."
|
||||
make
|
||||
done
|
||||
|
||||
VersionID=`grep VERSION_ID /etc/os-release`
|
||||
if [[ ${VersionID} =~ 'VERSION_ID="22.04"' ]]; then
|
||||
@@ -237,6 +222,7 @@ case "${pkgtype}" in
|
||||
#cp -rf ${BuildDir}/systemd/*.service ${DebBuildDir}/lib/systemd/system/
|
||||
chmod +x ${DebBuildDir}/usr/local/omc/bin/*
|
||||
sed -i "s/YYYYMMDD/${RelDate}/g" ${DebBuildDir}/DEBIAN/control
|
||||
ReleasePkgDir=${ReleaseDir}/debs/${RelArch}
|
||||
dpkg -b ${DebBuildDir} ${ReleasePkgDir}/${DebPkgFile}
|
||||
|
||||
cd ${ReleasePkgDir}
|
||||
@@ -247,14 +233,6 @@ case "${pkgtype}" in
|
||||
;;
|
||||
badeb)
|
||||
echo "Begin to make ${pkgtype} package ======>"
|
||||
ReleasePkgDir=${ReleaseDir}/debs/${RelArch}
|
||||
ProcList="restagent sshsvc"
|
||||
cd $EmsBEDir
|
||||
for procName in $ProcList;do
|
||||
cd $EmsBEDir/$procName
|
||||
echo "Make $procName ..."
|
||||
make
|
||||
done
|
||||
|
||||
VersionID=`grep VERSION_ID /etc/os-release`
|
||||
if [[ ${VersionID} =~ 'VERSION_ID="22.04"' ]]; then
|
||||
@@ -314,6 +292,7 @@ case "${pkgtype}" in
|
||||
echo "Replace all chinese character."
|
||||
chmod +x ${DebBuildDir}/usr/local/omc/bin
|
||||
sed -i "s/YYYYMMDD/${RelDate}/g" ${DebBuildDir}/DEBIAN/control
|
||||
ReleasePkgDir=${ReleaseDir}/debs/${RelArch}
|
||||
dpkg -b ${DebBuildDir} ${ReleasePkgDir}/${DebPkgFile}
|
||||
|
||||
cd ${ReleasePkgDir}
|
||||
|
||||
@@ -111,6 +111,15 @@ makefe() {
|
||||
makebe() {
|
||||
cd ${builddir}/bin
|
||||
#chmod +x mkpkg.sh
|
||||
EmsBEDir=${rootdir}/be.ems
|
||||
ProcList="restagent sshsvc"
|
||||
cd $EmsBEDir
|
||||
for procName in $ProcList;do
|
||||
cd $EmsBEDir/$procName
|
||||
echo "Make $procName ..."
|
||||
make
|
||||
done
|
||||
|
||||
chmod +x build.sh
|
||||
./build.sh ${be_args[@]}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Package: OMC
|
||||
Version: 2.2508.1-YYYYMMDD-mt
|
||||
Version: {version}-YYYYMMDD-mt
|
||||
Section: AGrandTech
|
||||
Prioritt: optional
|
||||
Architecture: amd64
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Package: OMC
|
||||
Version: 2.2508.1-YYYYMMDD-mt
|
||||
Version: {version}-YYYYMMDD-mt
|
||||
Section: AGrandTech
|
||||
Prioritt: optional
|
||||
Architecture: amd64
|
||||
|
||||
96
pkg.sh
Normal file
96
pkg.sh
Normal file
@@ -0,0 +1,96 @@
|
||||
#!/bin/bash
|
||||
|
||||
# front-end Catalog
|
||||
WebDir=/root/omc.git/fe.ems.vue3
|
||||
WebBranch=multi-tenant
|
||||
BuildWeb=""
|
||||
# back-end Catalog
|
||||
ApiDir=/root/omc.git/be.ems
|
||||
ApiBranch=multi-tenant
|
||||
BuildApi=""
|
||||
# Package Catalog
|
||||
BuildDir=/root/omc.git/build.ems
|
||||
BuildBranch=multi-tenant
|
||||
# Default Version Value
|
||||
VERSION="2.2508.1"
|
||||
|
||||
# usage
|
||||
usage() {
|
||||
echo "Usage: bash $0 [OPTION]"
|
||||
echo
|
||||
echo "Build Software Package OPTION:"
|
||||
echo " -v Specify the version"
|
||||
echo " --web Build Web ($WebDir) Branch ($WebBranch)"
|
||||
echo " --api Build Api ($ApiDir) Branch ($ApiBranch)"
|
||||
echo " -h Display this help message"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
# Read command line arguments
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
-v) VERSION="$2"; shift 2 ;;
|
||||
--web) BuildWeb="build"; shift ;;
|
||||
--api) BuildApi="build"; shift ;;
|
||||
*) usage ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# =================== build branch
|
||||
echo
|
||||
cd $BuildDir
|
||||
rm -rf debbuild/*
|
||||
git checkout .
|
||||
git pull
|
||||
git checkout $BuildBranch
|
||||
git pull
|
||||
echo "===> build checkout directory: $BuildDir"
|
||||
|
||||
# =================== Web
|
||||
echo
|
||||
# Determine if --web is passed in
|
||||
if [ -n "$BuildWeb" ]; then
|
||||
cd $WebDir
|
||||
git checkout .
|
||||
git pull
|
||||
git checkout $WebBranch
|
||||
git pull
|
||||
|
||||
cp -rf $BuildDir/customized/ba.d/images/background_light.jpg $WebDir/public/background/light.jpg
|
||||
cp -rf $BuildDir/customized/ba.d/images/background_dark.jpg $WebDir/public/background/dark.jpg
|
||||
cp -rf $BuildDir/customized/ba.d/locales/zh-CN.ts $WebDir/src/i18n/locales/zh-CN.ts
|
||||
|
||||
npm install --registry https://registry.npmmirror.com
|
||||
npm run build
|
||||
fi
|
||||
|
||||
# =================== Api
|
||||
echo
|
||||
# Determine if --api is passed in
|
||||
if [ -n "$BuildApi" ]; then
|
||||
cd $ApiDir
|
||||
git checkout .
|
||||
git pull
|
||||
git checkout $ApiBranch
|
||||
git pull
|
||||
|
||||
ProcList="restagent sshsvc"
|
||||
for procName in $ProcList;do
|
||||
cd $ApiDir/$procName
|
||||
echo "Make $procName ..."
|
||||
make
|
||||
done
|
||||
fi
|
||||
|
||||
# =================== ba deb
|
||||
echo
|
||||
cd $BuildDir
|
||||
sed -i "s/{version}/${VERSION}/g" $BuildDir/bin/build.sh
|
||||
sed -i "s/{version}/${VERSION}/g" $BuildDir/bin/makepkg.sh
|
||||
sed -i "s/{version}/${VERSION}/g" $BuildDir/debbuild/DEBIAN/control
|
||||
sed -i "s/{version}/${VERSION}/g" $BuildDir/debbuild/22.04/DEBIAN/control
|
||||
sed -i "s/{version}/${VERSION}/g" $BuildDir/rpmbuild/SPECS/omc.spec
|
||||
bash bin/build.sh badeb
|
||||
|
||||
# bash pkg.sh --web --api -v 2.2508.1
|
||||
# bash pkg.sh --web --api
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
Name: %{project_lname}
|
||||
Summary: 5GC OMC
|
||||
Version: 2.2508.1
|
||||
Version: {version}
|
||||
Release: %{release_date}
|
||||
Vendor: omc
|
||||
URL: https://www.omc.com/
|
||||
|
||||
Reference in New Issue
Block a user