1
0

fix: rpm打包spec

This commit is contained in:
TsMask
2025-03-20 16:16:49 +08:00
parent 0aeb0673ee
commit 5160e85804

View File

@@ -10,7 +10,7 @@ BuildArch: {arch}
# 软件说明 # 软件说明
%description %description
OMC-Team for NE OMC is a management application for the 5GC core network.
# 打包前脚本 ======== # 打包前脚本 ========
@@ -35,35 +35,62 @@ echo "Please Run:"
echo " sudo systemctl start|stop|status|restart omc.service" echo " sudo systemctl start|stop|status|restart omc.service"
echo "Setting Firewall:" echo "Setting Firewall:"
echo " add: " echo " add: "
echo " firewall-cmd --zone=public --add-port=33030/tcp --permanent && firewall-cmd --reload" echo " firewall-cmd --zone=public --add-port=80/tcp --permanent && firewall-cmd --reload"
echo " remove: " echo " remove: "
echo " firewall-cmd --zone=public --remove-port=33030/tcp --permanent && firewall-cmd --reload" echo " firewall-cmd --zone=public --remove-port=80/tcp --permanent && firewall-cmd --reload"
echo "" echo ""
# 检查是否是第一次安装或是升级 # Check if this is the first installation or upgrade
if [ ! -f $RootDir/omc.yaml ]; then if [ ! -f $RootDir/omc.conf ]; then
# 第一次安装,执行相关操作 # First installation, perform the related operations
chmod +rx /usr/local/bin/omc chmod +rx /usr/local/bin/omc
cp $RootDir/default/omc.conf $RootDir/omc.conf
cp $RootDir/default/omc.yaml $RootDir/omc.yaml cp $RootDir/default/omc.yaml $RootDir/omc.yaml
cp $RootDir/default/oam_manager.yaml $RootDir/oam_manager.yaml cp $RootDir/default/sshsvc.yaml $RootDir/sshsvc.yaml
# read environment parameter and to do
if [ -n "$M_PARAM" ] && [ -n "$C_PARAM" ]; then
bash $RootDir/script/setup.sh -i -m $M_PARAM -c $C_PARAM
elif [ -n "$C_PARAM" ]; then
bash $RootDir/script/setup.sh -i -c $C_PARAM
else
bash $RootDir/script/setup.sh -i
fi
if [ $? -ne 0 ]; then
echo "Initialization failure."
rm -rf $RootDir
exit 1
fi
systemctl daemon-reload systemctl daemon-reload
systemctl enable omc.service systemctl enable omc.service
systemctl enable sshsvc.service
systemctl daemon-reload systemctl daemon-reload
systemctl stop omc.service systemctl restart omc.service
systemctl start omc.service systemctl restart sshsvc.service
else else
# 升级时的操作 # Operation when upgrading
bash $RootDir/script/setup.sh -u
if [ $? -ne 0 ]; then
echo "Upgrade failed."
exit 1
fi
systemctl daemon-reload systemctl daemon-reload
systemctl start omc.service systemctl start omc.service
systemctl start sshsvc.service
fi fi
rm -rf $RootDir/vendor
# 卸载前脚本 ======== # 卸载前脚本 ========
%preun %preun
# 停止服务 # 停止服务
systemctl daemon-reload systemctl daemon-reload
systemctl stop omc.service systemctl stop omc.service
systemctl stop sshsvc.service
# 卸载后脚本 ======== # 卸载后脚本 ========
@@ -75,7 +102,9 @@ case "$1" in
# 删除服务文件 # 删除服务文件
systemctl daemon-reload systemctl daemon-reload
systemctl disable omc.service systemctl disable omc.service
systemctl disable sshsvc.service
rm -rf /lib/systemd/system/omc.service rm -rf /lib/systemd/system/omc.service
rm -rf /lib/systemd/system/sshsvc.service
systemctl daemon-reload systemctl daemon-reload
# 移除相关文件 # 移除相关文件
@@ -91,9 +120,10 @@ esac
# 包含的文件 ======== # 包含的文件 ========
%files %files
%defattr(-,root,root,-) %defattr(-,root,root,-)
/lib/systemd/system/*
/usr/local/bin/*
/usr/local/etc/omc/* /usr/local/etc/omc/*
/usr/local/bin/omc /usr/local/omc/*
/lib/systemd/system/omc.service
# 更新日志 ======== # 更新日志 ========