perf: 调整打包目录

This commit is contained in:
TsMask
2025-03-17 14:11:34 +08:00
parent b3bb2d788f
commit c20a3e5f04
187 changed files with 121 additions and 13 deletions

View File

@@ -1,7 +1,16 @@
#!/bin/bash
BinFile=/usr/local/bin/omc
ConfFile=/usr/local/etc/omc/omc.yaml
OMCBinFile=/usr/local/bin/omc
OMCEtcDir=/usr/local/etc/omc
confFile=$OMCEtcDir/omc.yaml
VariableFile=$OMCEtcDir/omc.conf
# Read the value of the variable from file
source $VariableFile
# 初始化变量
T_PARAM=""
C_PARAM=""
M_PARAM=""
# usage
usage() {
@@ -10,6 +19,8 @@ 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 " -c, --customize Available the customize (omc/agt/ba)"
echo " -h Display this help message"
echo
exit 1
@@ -26,23 +37,93 @@ checkEnv() {
fi
}
# customize
customize() {
echo "customize"
}
# install
install() {
echo "install"
/usr/local/bin/omc -c /usr/local/etc/omc.yaml --sqlPath /usr/local/etc/omc/database/upgrade/sqlite/upg_20250313.sql --sqlSource lite
# 数据源
DBSource="default"
if [ "$MODE" = "lite" ]; then
DBSource="lite"
fi
$OMCBinFile -c $confFile --sqlPath $OMCEtcDir/$DBSource/install --sqlSource $DBSource
}
# upgrade
upgrade() {
echo "upgrade"
# 数据源
DBSource="default"
if [ "$MODE" = "lite" ]; then
DBSource="lite"
fi
$OMCBinFile -c $confFile --sqlPath $OMCEtcDir/$DBSource/upgrade --sqlSource $DBSource
}
# 读取命令行参数
# =========================
# 参数解析
while [[ $# -gt 0 ]]; do
case "$1" in
-i | --install) install; shift 2 ;;
-u | --upgrade) upgrade; shift 2 ;;
*) usage ;;
-i|--install)
T_PARAM="install"
shift
;;
-u|--upgrade)
T_PARAM="upgrade"
shift
;;
-t|--type)
T_PARAM="$2"
shift 2 # 跳过 -t 参数和值
;;
-m|--mode)
M_PARAM="$2"
shift 2 # 跳过 -m 参数和值
;;
-c|--customize)
C_PARAM="$2"
shift 2 # 跳过 -c 参数和值
;;
-h)
usage
;;
*)
echo "Error: Unknown option: $1"
usage
;;
esac
done
# 确保 -i 或 -u 在前
if [ -z "$T_PARAM" ]; then
echo "Error: You must specify -i (install) or -u (upgrade) first."
usage
fi
echo "Type parameter: $T_PARAM"
# 判断 -c 是否传入
if [ -n "$C_PARAM" ]; then
echo "Customize parameter: $C_PARAM"
sed -i "s/VENDORS=.*/VENDORS=${C_PARAM}/" $VariableFile
VENDORS=$C_PARAM
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
fi