From a1010c84e5f6c71f533a34388b1a330128ed19dc Mon Sep 17 00:00:00 2001 From: simonzhangsz Date: Tue, 29 Oct 2024 19:40:04 +0800 Subject: [PATCH] dpkg debian package for general and BA tag --- makefile | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/makefile b/makefile index 27d00ccd..8e0abff1 100644 --- a/makefile +++ b/makefile @@ -12,14 +12,17 @@ ARMPLATFORM = aarch64 GitLocalRoot = $(HOME)/omc.git EmsBuildRoot=$(GitLocalRoot)/build.ems BuildDir = $(EmsBuildRoot)/build +CustomizedDir = $(EmsBuildRoot)/customized BuildOMCDir = $(BuildDir)/usr/local/omc BuildOMCBinDir = $(BuildOMCDir)/bin BuildOMCEtcDir = $(BuildOMCDir)/etc BuildLibDir = $(BuildDir)/lib BuildLibSystemDir = $(BuildLibDir)/systemd/system DebBuildDir = $(EmsBuildRoot)/debbuild +DebBuildOMCDir = $(EmsBuildRoot)/debbuild/usr/local/omc DebFEBuildDir = $(EmsBuildRoot)/debbuild/usr/local/omc/htdocs DebBuild2204Dir = $(EmsBuildRoot)/debbuild/22.04 +DebBuild2204OMCDir = $(EmsBuildRoot)/debbuild/22.04/usr/local/omc DebFEBuild2204Dir = $(EmsBuildRoot)/debbuild/22.04/usr/local/omc/htdocs RpmBuildDir = $(EmsBuildRoot)/rpmbuild RpmFEBuildDir = $(RpmBuildDir)/BUILD/usr/local/omc/htdocs @@ -54,11 +57,14 @@ RestagentSize = 29525312 BinWriterDir = $(HOME)/bin ifeq ($(shell grep VERSION_ID /etc/os-release), VERSION_ID="22.04") DebBuildDir := $(DebBuild2204Dir) +DebBuildOMCDir := $(DebBuild2204OMCDir) DebFEBuildDir := $(DebFEBuild2204Dir) #DebPkgFile := $(PROJECT)-$(VERSION)-22.04-$(Release).$(PLATFORM).deb DebPkgFile := $(PROJECT)-r$(VERSION)-$(Release)-ub22.deb +DebPkgFileBA := $(PROJECT)-r$(VERSION)-$(Release)-ub22-ba.deb else ifeq ($(shell grep VERSION_ID /etc/os-release), VERSION_ID="18.04") DebPkgFile := $(PROJECT)-r$(VERSION)-$(Release)-ub18.deb +DebPkgFileBA := $(PROJECT)-r$(VERSION)-$(Release)-ub18-ba.deb endif .PHONY: all $(RESTAGENT) $(CRONTASK) $(SshSvcBin) $(CapTraceBin) $(Data2htmlBin) @@ -101,7 +107,7 @@ dist: --exclude=../crontask/crontask \ --exclude=../initems/initems -deb: $(BINNAME) +prep_deb: $(BINNAME) # clear build cache rm -rf $(FrontBuildDir)/front/* rm -rf $(DebFEBuildDir)/front/* @@ -123,6 +129,14 @@ deb: $(BINNAME) chmod 755 $(DebBuildDir)/DEBIAN/postinst chmod 755 $(DebBuildDir)/DEBIAN/postrm cp -rf $(BuildDir)/* $(DebBuildDir)/ + +replace_chinese: + @find $(DebBuildOMCDir)/etc/db -type f -name '*.sql' -exec sed -i '' 's/[一-龥]//g' {} + + @echo "Replace all chinese charecter." + +deb: prep_deb + 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/* @@ -131,6 +145,16 @@ deb: $(BINNAME) 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) $(ReleaseDebs)/$(DebPkgFile) +ba-deb: prep_deb replace_chinese + cp -rf $(CustomizedDir)/ba.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.bak 's/YYYYMMDD/$(shell date +"%Y%m%d")/g' $(DebBuildDir)/DEBIAN/control + sed -i 's/YYYYMMDD/$(shell date +"%Y%m%d")/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) $(ReleaseDebs)/$(DebPkgFileBA) + rpm: $(BINNAME) # clear build cache rm -rf $(FrontBuildDir)/front/*