1
0

ref: 打包脚本调整

This commit is contained in:
TsMask
2025-03-20 18:38:19 +08:00
parent 5160e85804
commit e363529519
4 changed files with 72 additions and 9 deletions

View File

@@ -15,8 +15,10 @@ node.js: v20.18.0 (or above)
```bash ```bash
git clone https://xxx@git/ems.git omc.git git clone https://xxx@git/ems.git omc.git
cd omc.git cd omc.git
# Universal
bash pkg.sh --web --api -v 2.2503.2 bash pkg.sh --web --api -v 2.2503.2
# RemoveChinese
find "${fehooksdir}" -type f -name '*.ts' -exec sed -i 's/[一-龥()“”,。?!]~·]//g' {} + bash pkg-en.sh --web --api -v 2.2503.2
# Place in upper directory for execution - Remote copy front-end files for packaging
bash ../pkg-front.sh --web -v 2.2503.2
``` ```

View File

@@ -95,12 +95,12 @@ ReleaseFileName=omc-r${VERSION}-${Date}-${OS_NAME}-${PACKAGE_ARCH}.${PACKAGE_MAN
# =================== # ===================
# 应用文件处理 # 应用文件处理 ./位于临时目录
app() { app() {
# 数据库脚本 common属于重建脚本 # 数据库脚本 common属于重建脚本
modeList="standard lite" modeList="standard lite"
for v in ${modeList}; do for v in ${modeList}; do
path=$BuildDir/usr/local/etc/omc/database/${v} path=./usr/local/etc/omc/database/${v}
cp -rf $path/common/* $path/install/ cp -rf $path/common/* $path/install/
cp -rf $path/common/* $path/upgrade/ cp -rf $path/common/* $path/upgrade/
rm -rf $path/common rm -rf $path/common

55
pkg-front.sh Normal file
View File

@@ -0,0 +1,55 @@
#!/bin/bash
# front-end Catalog
WebDir=/root/omc.git/fe.ems.vue3
ScpWeb="root@192.168.9.58"
BuildWeb=""
# back-end catalog
ApiBranch=main
# Package Catalog
BuildDir=/root/omc.git/build.ems
# Default Version Value
VERSION="2.2503.2"
# usage
usage() {
echo "Usage: bash $0 [OPTION]"
echo
echo "Build Software Package OPTION:"
echo " -v Specify the version"
echo " --web Build Web ($WebDir)"
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 ;;
*) usage ;;
esac
done
# =================== Web
echo
# Determine if --web is passed in
if [ -n "$BuildWeb" ]; then
cd $WebDir
echo "===> web scp dist copy to $WebDir"
rm -rf $WebDir/dist
scp -r -P 18422 $ScpWeb:$WebDir/dist $WebDir/
output=$BuildDir/linux/usr/local/etc/omc/web
rm -rf $output
cp -rf dist/default/config.js dist/config.js
cp -rf dist $output
echo "===> web build dist copy to $output"
fi
# =================== deb/rpm
echo
bash $BuildDir/pkg.sh --api -apiBranch $ApiBranch -v $VERSION
# bash pkg-front.sh --web -v 2.2503.2
# bash pkg-front.sh -v 2.2503.2

14
pkg.sh
View File

@@ -2,11 +2,11 @@
# front-end Catalog # front-end Catalog
WebDir=/root/omc.git/fe.ems.vue3 WebDir=/root/omc.git/fe.ems.vue3
WebBranch=lichang WebBranch=main
BuildWeb="" BuildWeb=""
# back-end catalog # back-end catalog
ApiDir=/root/omc.git/be.ems ApiDir=/root/omc.git/be.ems
ApiBranch=lichang ApiBranch=main
BuildApi="" BuildApi=""
# Package Catalog # Package Catalog
BuildDir=/root/omc.git/build.ems BuildDir=/root/omc.git/build.ems
@@ -20,7 +20,9 @@ usage() {
echo "Build Software Package OPTION:" echo "Build Software Package OPTION:"
echo " -v Specify the version" echo " -v Specify the version"
echo " --web Build Web ($WebDir)" echo " --web Build Web ($WebDir)"
echo " -webBranch Web Branch ($WebBranch)"
echo " --api Build Api ($ApiDir)" echo " --api Build Api ($ApiDir)"
echo " -apiBranch Api Branch ($ApiBranch)"
echo " -h Display this help message" echo " -h Display this help message"
echo echo
exit 1 exit 1
@@ -30,7 +32,9 @@ while [[ $# -gt 0 ]]; do
case "$1" in case "$1" in
-v) VERSION="$2"; shift 2 ;; -v) VERSION="$2"; shift 2 ;;
--web) BuildWeb="build"; shift ;; --web) BuildWeb="build"; shift ;;
-webBranch) WebBranch="$2"; shift 2 ;;
--api) BuildApi="build"; shift ;; --api) BuildApi="build"; shift ;;
-apiBranch) ApiBranch="$2"; shift 2 ;;
*) usage ;; *) usage ;;
esac esac
done done
@@ -82,8 +86,8 @@ if [ -n "$BuildApi" ]; then
output=$BuildDir/linux/usr/local/etc/omc output=$BuildDir/linux/usr/local/etc/omc
dirs="database default vendor" dirs="database default vendor"
for v in ${dirs}; do for v in ${dirs}; do
rm -rf ${output}/${v} rm -rf ${output}/${v}
cp -rf ${ApiDir}/build/${v} ${output}/${v} cp -rf ${ApiDir}/build/${v} ${output}/${v}
done done
echo echo
echo "===> vendor data copy to $output" echo "===> vendor data copy to $output"
@@ -94,6 +98,8 @@ echo
bash $BuildDir/build.sh -v $VERSION bash $BuildDir/build.sh -v $VERSION
# Compile the front-end and back-end and then package the version # Compile the front-end and back-end and then package the version
# bash pkg.sh --web -webBranch main --api -apiBranch main -v 2.2503.2
# bash pkg.sh --web --api -v 2.2503.2 # bash pkg.sh --web --api -v 2.2503.2
# bash pkg.sh --api -apiBranch main -v 2.2503.2
# Packaged version of just the last compiled file/build directory # Packaged version of just the last compiled file/build directory
# bash pkg.sh -v 2.2503.2 # bash pkg.sh -v 2.2503.2