ref: 打包脚本调整
This commit is contained in:
@@ -115,7 +115,10 @@ $OMCBinFile -c $confFile --sqlPath $OMCEtcDir/database/$MODE/$T_PARAM --sqlSourc
|
|||||||
if [[ "$T_PARAM" == "install" && -d $OMCEtcDir/vendor ]]; then
|
if [[ "$T_PARAM" == "install" && -d $OMCEtcDir/vendor ]]; then
|
||||||
cp -rf $OMCEtcDir/vendor/$VENDORS/web/* $OMCEtcDir/web/background
|
cp -rf $OMCEtcDir/vendor/$VENDORS/web/* $OMCEtcDir/web/background
|
||||||
cp -rf $OMCEtcDir/vendor/$VENDORS/static/* /usr/local/omc/static
|
cp -rf $OMCEtcDir/vendor/$VENDORS/static/* /usr/local/omc/static
|
||||||
$OMCBinFile -c $confFile --sqlPath $OMCEtcDir/vendor/$VENDORS/database/$MODE --sqlSource $MODE
|
$OMCBinFile -c $confFile --sqlPath $OMCEtcDir/vendor/$VENDORS/database/$MODE/$T_PARAM --sqlSource $MODE
|
||||||
|
fi
|
||||||
|
if [[ "$T_PARAM" == "upgrade" && -d $OMCEtcDir/vendor ]]; then
|
||||||
|
$OMCBinFile -c $confFile --sqlPath $OMCEtcDir/vendor/$VENDORS/database/$MODE/$T_PARAM --sqlSource $MODE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# bash setup.sh -i -m standard -c omc
|
# bash setup.sh -i -m standard -c omc
|
||||||
|
|||||||
118
pkg-en.sh
Normal file
118
pkg-en.sh
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# front-end Catalog
|
||||||
|
WebDir=/root/omc.git/fe.ems.vue3
|
||||||
|
BuildWeb=""
|
||||||
|
# back-end catalog
|
||||||
|
ApiDir=/root/omc.git/be.ems
|
||||||
|
BuildApi=""
|
||||||
|
# Package Catalog
|
||||||
|
BuildDir=/root/omc.git/build.ems
|
||||||
|
# Default Not Remove Chinese Language
|
||||||
|
RemoveChinese=""
|
||||||
|
# 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 " --api Build Api ($ApiDir)"
|
||||||
|
echo " --rc Remove Chinese Language"
|
||||||
|
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 ;;
|
||||||
|
--rc) RemoveChinese="remove"; shift ;;
|
||||||
|
*) usage ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# =================== Web
|
||||||
|
echo
|
||||||
|
# Determine if --web is passed in
|
||||||
|
if [ -n "$BuildWeb" ]; then
|
||||||
|
cd $WebDir
|
||||||
|
git checkout .
|
||||||
|
git pull
|
||||||
|
git checkout lichang
|
||||||
|
git pull
|
||||||
|
|
||||||
|
# RemoveChinese
|
||||||
|
rm -rf ./public/alarmHelp/zh
|
||||||
|
rm -rf ./public/nbStateImput/zh.xlsx
|
||||||
|
find ./public -type f \( -name "*.js" -o -name "*.json" \) -exec sed -i 's/[一-龥、,。?!“”()【】·]//g' {} +
|
||||||
|
find ./src -type f \( -name "*.ts" -o -name "*.vue" -o -name "*.js" -o -name "*.json" \) -exec sed -i 's/[一-龥、,。?!“”()【】·]//g' {} +
|
||||||
|
|
||||||
|
npm install --registry https://registry.npmmirror.com
|
||||||
|
npm run build
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
# =================== Api
|
||||||
|
echo
|
||||||
|
# Determine if --api is passed in
|
||||||
|
if [ -n "$BuildApi" ]; then
|
||||||
|
cd $ApiDir
|
||||||
|
git checkout .
|
||||||
|
git pull
|
||||||
|
git checkout lichang
|
||||||
|
git pull
|
||||||
|
|
||||||
|
# RemoveChinese
|
||||||
|
find ./build/database -type f -name '*.sql' -exec sed -i 's/[一-龥、,。?!“”()【】·]//g' {} +
|
||||||
|
find ./features -type f -name '*.go' -exec sed -i 's/[一-龥、,。?!“”()【】·]//g' {} +
|
||||||
|
find ./lib -type f -name '*.go' -exec sed -i 's/[一-龥、,。?!“”()【】·]//g' {} +
|
||||||
|
find ./src -type f -name '*.go' -exec sed -i 's/[一-龥、,。?!“”()【】·]//g' {} +
|
||||||
|
find ./sshsvc -type f -name '*.go' -exec sed -i 's/[一-龥、,。?!“”()【】·]//g' {} +
|
||||||
|
find ./build/vendor -type f -name '*.sql' -exec sed -i 's/[一-龥、,。?!“”()【】·]//g' {} +
|
||||||
|
find ./build/vendor -type f -name '*.sql' -exec sed -i "s/'true' WHERE \`config_id\`/'false' WHERE \`config_id\`/g" {} +
|
||||||
|
find ./build/vendor -type f -name '*.sql' -exec sed -i "s/'1' WHERE \`menu_id\`/'0' WHERE \`menu_id\`/g" {} +
|
||||||
|
find ./build/vendor -type f -name 'zh_*' -exec rm -f {} \;
|
||||||
|
|
||||||
|
MOD_CONFIG="be.ems/src/framework/config"
|
||||||
|
go build -o omc -v -ldflags "-s -w -X '$MOD_CONFIG.Version=$VERSION' -X '$MOD_CONFIG.BuildTime=$(date)' -X '$MOD_CONFIG.GoVer=$(go version)'"
|
||||||
|
|
||||||
|
output=$BuildDir/linux/usr/local/bin
|
||||||
|
cp -rf omc $output/omc
|
||||||
|
echo "===> go build omc copy to $output"
|
||||||
|
|
||||||
|
# sshsvc
|
||||||
|
cd $ApiDir/sshsvc
|
||||||
|
make
|
||||||
|
cp -rf sshsvc $output/sshsvc
|
||||||
|
echo "===> go build sshsvc copy to $output"
|
||||||
|
|
||||||
|
# Vendor Database
|
||||||
|
output=$BuildDir/linux/usr/local/etc/omc
|
||||||
|
dirs="database default vendor"
|
||||||
|
for v in ${dirs}; do
|
||||||
|
rm -rf ${output}/${v}
|
||||||
|
cp -rf ${ApiDir}/build/${v} ${output}/${v}
|
||||||
|
done
|
||||||
|
echo
|
||||||
|
echo "===> vendor data copy to $output"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# =================== deb/rpm
|
||||||
|
echo
|
||||||
|
bash $BuildDir/build.sh -v $VERSION
|
||||||
|
|
||||||
|
# Compile the front-end and back-end and then package the version
|
||||||
|
# bash pkg-en.sh --web --api -v 2.2503.2
|
||||||
|
# Packaged version of just the last compiled file/build directory
|
||||||
|
# bash pkg-en.sh -v 2.2503.2
|
||||||
11
pkg.sh
11
pkg.sh
@@ -77,16 +77,21 @@ if [ -n "$BuildApi" ]; then
|
|||||||
echo "===> go build sshsvc copy to $output"
|
echo "===> go build sshsvc copy to $output"
|
||||||
|
|
||||||
# Vendor Database
|
# Vendor Database
|
||||||
|
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
|
||||||
path=$BuildDir/tmp/usr/local/etc/omc
|
rm -rf ${output}/${v}
|
||||||
rm -rf ${path}/${v}
|
cp -rf ${ApiDir}/build/${v} ${output}/${v}
|
||||||
cp -rf ${ApiDir}/build/${v} ${path}/${v}
|
|
||||||
done
|
done
|
||||||
|
echo
|
||||||
|
echo "===> vendor data copy to $output"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# =================== deb/rpm
|
# =================== deb/rpm
|
||||||
echo
|
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
|
||||||
# bash pkg.sh --web --api -v 2.2503.2
|
# bash pkg.sh --web --api -v 2.2503.2
|
||||||
|
# Packaged version of just the last compiled file/build directory
|
||||||
|
# bash pkg.sh -v 2.2503.2
|
||||||
|
|||||||
@@ -31,8 +31,6 @@ if [ ! -f $RootDir/omc.conf ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -rf $RootDir/vendor
|
|
||||||
|
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
systemctl enable omc.service
|
systemctl enable omc.service
|
||||||
systemctl enable sshsvc.service
|
systemctl enable sshsvc.service
|
||||||
@@ -52,3 +50,5 @@ else
|
|||||||
systemctl start omc.service
|
systemctl start omc.service
|
||||||
systemctl start sshsvc.service
|
systemctl start sshsvc.service
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
rm -rf $RootDir/vendor
|
||||||
|
|||||||
Reference in New Issue
Block a user