perf: 构建工具调整

This commit is contained in:
TsMask
2025-03-18 10:08:59 +08:00
parent a27e1d243c
commit d6e42ce4f5
215 changed files with 184 additions and 6015 deletions

View File

@@ -7,7 +7,7 @@ VariableFile=$OMCEtcDir/omc.conf
# Read the value of the variable from file
source $VariableFile
# 初始化变量
# Initializing variables
T_PARAM=""
C_PARAM=""
M_PARAM=""
@@ -19,18 +19,17 @@ usage() {
echo "Program Initialization OPTION:"
echo " -i, --install Specify the install"
echo " -u, --upgrade Specify the upgrade"
echo " -m, --mode Available the mode (standard/light)"
echo " -m, --mode Available the mode (standard/lite)"
echo " -c, --customize Available the customize (omc/agt/ba)"
echo " -h Display this help message"
echo
exit 1
}
# 检查环境
checkEnv() {
# 检查 mysql 或 mariadb 是否安装
# standard env
standardEnv() {
if command -v mysql &> /dev/null || command -v mariadb &> /dev/null; then
echo "MySQL MariaDB 已安装"
echo "MySQL or MariaDB installed"
else
echo "MySQL or MariaDB not installed"
exit 1
@@ -42,26 +41,6 @@ customize() {
echo "customize"
}
# install
install() {
# 数据源
DBSource="default"
if [ "$MODE" = "lite" ]; then
DBSource="lite"
fi
$OMCBinFile -c $confFile --sqlPath $OMCEtcDir/$DBSource/install --sqlSource $DBSource
}
# upgrade
upgrade() {
# 数据源
DBSource="default"
if [ "$MODE" = "lite" ]; then
DBSource="lite"
fi
$OMCBinFile -c $confFile --sqlPath $OMCEtcDir/$DBSource/upgrade --sqlSource $DBSource
}
# =========================
# 参数解析
@@ -97,14 +76,23 @@ while [[ $# -gt 0 ]]; do
esac
done
# 确保 -i -u 在前
# Make sure -i or -u comes first.
if [ -z "$T_PARAM" ]; then
echo "Error: You must specify -i (install) or -u (upgrade) first."
usage
fi
echo "Type parameter: $T_PARAM"
# 判断 -c 是否传入
# Determine if -m is passed in
if [ -n "$M_PARAM" ]; then
echo "Mode parameter: $M_PARAM"
sed -i "s/MODE=.*/MODE=${M_PARAM}/" $VariableFile
sed -i "s/serverVersion: \"standard\"/serverVersion: \"${M_PARAM}\"/" $confFile
MODE=$M_PARAM
fi
echo "Mode parameter: $MODE"
# Determine if -c is passed in
if [ -n "$C_PARAM" ]; then
echo "Customize parameter: $C_PARAM"
sed -i "s/VENDORS=.*/VENDORS=${C_PARAM}/" $VariableFile
@@ -112,18 +100,14 @@ if [ -n "$C_PARAM" ]; then
fi
echo "Customize parameter: $VENDORS"
# 判断 -m 是否传入
if [ -n "$M_PARAM" ]; then
echo "Mode parameter: $M_PARAM"
sed -i "s/MODE=.*/MODE=${M_PARAM}/" $VariableFile
sed -i "s/mode:.*/mode: ${M_PARAM}/" $confFile
MODE=$M_PARAM
fi
echo "Mode parameter: $MODE"
# =========================
if [ "$T_PARAM" = "install" ]; then
install
else
upgrade
if [ "$MODE" = "standard" ]; then
standardEnv
fi
$OMCBinFile -c $confFile --sqlPath $OMCEtcDir/database/$DBSource/$T_PARAM --sqlSource $MODE
customize
# bash setup.sh -i -m std -c omc