1
0

feat: psap init

This commit is contained in:
zhangsz
2025-04-14 16:05:39 +08:00
parent 17591b1705
commit e1f4eb6267
7 changed files with 72 additions and 17 deletions

View File

@@ -1,14 +1,17 @@
#!/bin/bash
usage() {
echo "Usage: $0 [OPTION] deb|badeb|rpm"
echo "Usage: $0 [OPTION] deb|badeb|rpm|psap"
echo
echo "Build omc package, option as follow:"
echo " deb|badeb|rpm, deb: ubuntu|debian package build by dpkg"
echo " badeb: ubuntu|debian package build by dpkg"
echo " rpm: centos/redhat package, build by rpmbuild"
echo " psap psap package, build by dpkg"
echo
echo " -r, =build root directory build root directory, default directory is $HOME/omc.git"
echo " -d dump SQL from database"
echo " -h, --help display this help and exit"
echo
}
@@ -16,7 +19,7 @@ pkgtype=""
new_args=()
# Traverse all parameters
for arg in "$@"; do
if [[ "$arg" == "deb" || "$arg" == "badeb" || "$arg" == "rpm" ]]; then
if [[ "$arg" == "deb" || "$arg" == "badeb" || "$arg" == "rpm" || "$arg" == "psap" ]]; then
pkgtype=$arg
else
new_args+=("$arg") # Add non pkgtype parameters to a new parameter list
@@ -351,6 +354,66 @@ case "${pkgtype}" in
md5sum ${DebPkgName} >omc-md5sum.txt
echo "Finish to make ${pkgtype} package <======"
;;
psap)
ProjectL="psap"
echo "Begin to make ${pkgtype} package ======>"
ReleasePkgDir=${ReleaseDir}/debs/${RelArch}
ProcList="restagent"
cd $EmsBEDir
for procName in $ProcList;do
cd $EmsBEDir/$procName
echo "Make $procName ..."
make
done
DebPkgFile=${ProjectL}-r${RelVer}-${RelOS}-${RelArch}.${ptype}
if [ ! $ProjectTag = "" ]; then
DebPkgFile=${ProjectL}-r${RelVer}-${RelOS}-${RelArch}-${ProjectTag}.${ptype}
fi
cd ${EmsBEDir}
#make deb
# clear build cache
rm -rf ${FrontBuildDir}/front/*
rm -rf ${DebFEBuildDir}/front/*
rm -rf ${DebBuildDir}/usr/local/omc/etc/db/*
rm -rf ${DebBuildOMCDir}/static/*
for procName in $ProcList;do
cd $EmsBEDir/$procName
cp -rf ${procName} ${BuildOMCBinDir}
done
cp -rf ${MiscDir}/* ${BuildOMCBinDir}
cp -rf ${ConfigEtcDir}/* ${BuildOMCEtcDir}
rm -rf ${BuildOMCEtcDir}/db/*
cp -rf ${DBSQLSrcDir}/* ${BuildOMCEtcDir}/db/
cp -rf ${BuildOMCEtcDir}/db/common/* ${BuildOMCEtcDir}/db/install
cp -rf ${BuildOMCEtcDir}/db/common/* ${BuildOMCEtcDir}/db/upgrade
#Get SQL from database, overwrite from git
cp -rf ${ConfigSystemdDir}/* ${BuildLibSystemDir}
cp -rf ${EmsFEVue3Dir}/* ${FrontBuildDir}/front >/dev/null
chmod 755 ${BuildOMCBinDir}/*
chmod 755 ${DebBuildDir}/DEBIAN/preinst
chmod 755 ${DebBuildDir}/DEBIAN/postinst
chmod 755 ${DebBuildDir}/DEBIAN/postrm
cp -rf ${BuildDir}/* ${DebBuildDir}/
cp -rf ${CustomizedDir}/agt.d ${DebBuildOMCDir}/static
cp -rf ${CustomizedDir}/omc.d ${DebBuildOMCDir}/static
#cp -rf ${BuildDir}/nginx/* ${DebBuildDir}/etc/nginx/conf.d
#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
sed -i "s/Architecture: amd64/Architecture: ${RelArch}/g" ${DebBuildDir}/DEBIAN/control
perl -0777 -i -pe 's/ne:\n user: root/ne:\n user: omcuser/g' ${DebBuildDir}/usr/local/omc/etc/default/restconf.yaml
dpkg -b ${DebBuildDir} ${ReleasePkgDir}/${DebPkgFile}
cd ${ReleasePkgDir}
rm -f omc-md5sum.txt
md5sum ${DebPkgName} >omc-md5sum.txt
echo "Finish to make ${pkgtype} package <======="
;;
*)
usage
exit 4

View File

@@ -57,12 +57,6 @@ redis:
host: "127.0.0.1" # Redis host
password: "helloearth"
db: 10 # Redis db_num
# UDM sub/auth db
udmuser:
port: 6379 # Redis port
host: "127.0.0.1"
password: "helloearth"
db: 0 # Redis db_num
# used to specify the default data source for multiple data resourece
defaultDataSourceName: "default"
@@ -78,7 +72,7 @@ mml:
# Tracking configuration
trace:
enabled: true
enabled: false
host: "172.16.5.100" # Fill in the specific IP address
port: 33033
@@ -109,7 +103,9 @@ omc:
vendor: ""
dn: ""
chk2ne: false
capability: 50
sn: "-"
expiryDate: "-"
checksign: false
rootDir: /usr/local/omc
binDir: /usr/local/omc/bin

View File

@@ -1,5 +1,5 @@
Package: OMC
Version: 2.2503.5-YYYYMMDD
Version: 2.2503.5-20250414
Section: AGrandTech
Prioritt: optional
Architecture: amd64

View File

@@ -57,12 +57,6 @@ redis:
host: "127.0.0.1" # Redis host
password: "helloearth"
db: 10 # Redis db_num
# UDM sub/auth db
udmuser:
port: 6379 # Redis port
host: "127.0.0.1"
password: "helloearth"
db: 0 # Redis db_num
# used to specify the default data source for multiple data resourece
defaultDataSourceName: "default"
@@ -78,7 +72,7 @@ mml:
# Tracking configuration
trace:
enabled: true
enabled: false
host: "172.16.5.100" # Fill in the specific IP address
port: 33033
@@ -109,7 +103,9 @@ omc:
vendor: ""
dn: ""
chk2ne: false
capability: 50
sn: "-"
expiryDate: "-"
checksign: false
rootDir: /usr/local/omc
binDir: /usr/local/omc/bin

Binary file not shown.

Binary file not shown.