1
0

del: rpm打包移除kvdb服务绑定

This commit is contained in:
TsMask
2024-07-27 10:56:53 +08:00
parent f66806e127
commit 80f3b33813
8 changed files with 3 additions and 4221 deletions

View File

@@ -1,11 +0,0 @@
[Service]
Type=forking
ExecStart=/usr/local/bin/kvdb-server /usr/local/etc/kvdb/kvdb.conf
ExecStopPost=
PIDFile=
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target

View File

@@ -55,7 +55,6 @@ chmod +rx ${RPM_BUILD_ROOT}/usr/lib64/*
#cp -f systemd/crontask.service ${RPM_BUILD_ROOT}/lib/systemd/system/crontask.service #cp -f systemd/crontask.service ${RPM_BUILD_ROOT}/lib/systemd/system/crontask.service
#cp -f systemd/sshsvc.service ${RPM_BUILD_ROOT}/lib/systemd/system/sshsvc.service #cp -f systemd/sshsvc.service ${RPM_BUILD_ROOT}/lib/systemd/system/sshsvc.service
#cp -f systemd/captrace.service ${RPM_BUILD_ROOT}/lib/systemd/system/captrace.service #cp -f systemd/captrace.service ${RPM_BUILD_ROOT}/lib/systemd/system/captrace.service
#cp -f systemd/kvdb.service ${RPM_BUILD_ROOT}/lib/systemd/system/kvdb.service
%build %build
#cd %{buildroot}/.. #cd %{buildroot}/..
@@ -64,7 +63,6 @@ chmod +rx ${RPM_BUILD_ROOT}/usr/lib64/*
# 安装完成后执行 # 安装完成后执行
%post %post
OmcRootDir=/usr/local/omc OmcRootDir=/usr/local/omc
DependsRootDir=${OmcRootDir}/depends
RedisBinDir=/usr/local/bin RedisBinDir=/usr/local/bin
RedisConfDir=/usr/local/etc/kvdb RedisConfDir=/usr/local/etc/kvdb
OMCEtcDir=${OmcRootDir}/etc OMCEtcDir=${OmcRootDir}/etc
@@ -85,31 +83,12 @@ for CFile in ${CFileList}; do
cp -f ${OMCEtcDir}/default/${CFile} ${OMCEtcDir} cp -f ${OMCEtcDir}/default/${CFile} ${OMCEtcDir}
fi fi
done done
# Check if install kvdb
if [ ! -e "${RedisBinDir}/kvdb-server" ]; then
cp -rf ${DependsRootDir}/kvdb/* /
chmod 755 ${RedisBinDir}/kvdb*
systemctl enable kvdb.service
fi
if [ ! -e "${RedisConfDir}/kvdb.conf" ]; then
cp ${RedisConfDir}/default/kvdb.conf ${RedisConfDir};
fi
sed -i 's/replica-read-only yes/replica-read-only no/g' ${RedisConfDir}/kvdb.conf
LINE="masterauth helloearth"
FILE="${RedisConfDir}/kvdb.conf"
if ! grep -qxF "$LINE" "$FILE"; then
# 如果不存在,将其添加到文件末尾
echo "$LINE" >> "$FILE"
fi
if [ ! -e "${FERootDir}/config.js" ]; then cp ${FERootDir}/default/config.js ${FERootDir}; fi if [ ! -e "${FERootDir}/config.js" ]; then cp ${FERootDir}/default/config.js ${FERootDir}; fi
for LogoFile in ${LogoFileList}; do for LogoFile in ${LogoFileList}; do
if [ ! -e "${OMCStaticDir}/logo/${LogoFile}" ]; then if [ ! -e "${OMCStaticDir}/logo/${LogoFile}" ]; then
cp ${OMCStaticDir}/agt.d/logo/${LogoFile} ${OMCStaticDir}/logo; cp ${OMCStaticDir}/agt.d/logo/${LogoFile} ${OMCStaticDir}/logo;
fi fi
done done
if ! id -u omc >/dev/null 2>&1 ; then useradd -d /opt/omc -m -s /bin/bash -p1000ftp@kp omc; else echo "user omc exist"; fi if ! id -u omc >/dev/null 2>&1 ; then useradd -d /opt/omc -m -s /bin/bash -p1000ftp@kp omc; else echo "user omc exist"; fi
mkdir -p /opt/omc/ftp mkdir -p /opt/omc/ftp
@@ -128,11 +107,9 @@ if [ ! -e libwsutil.so.13 ]; then ln -s libwsutil.so.13.1.0 libwsutil.so.13; fi
if [ ! -e libwsutil.so ]; then ln -s libwsutil.so.13.1.0 libwsutil.so; fi if [ ! -e libwsutil.so ]; then ln -s libwsutil.so.13.1.0 libwsutil.so; fi
cd ${UsrLocalBinDir} cd ${UsrLocalBinDir}
if [ ! -e ${OmcDaemon} ]; then ln -s ${OmcBinDir}/omcsvc.sh ${OmcDaemon}; fi if [ ! -e ${OmcDaemon} ]; then ln -s ${OmcBinDir}/omcsvc.sh ${OmcDaemon}; fi
# sed -i 's/listen 80;/listen 1080;/g' ${NginxEtcDir}/nginx.conf
# sed -i 's/listen \[::\]:80;/listen \[::\]:1080;/g' ${NginxEtcDir}/nginx.conf
# setting firewall # setting firewall
PortList="80 33030 443 33443 22222" PortList="80 443 44080 44443 33030 22222"
for Port in ${PortList}; do for Port in ${PortList}; do
firewall-cmd --zone=public --add-port=${Port}/tcp --permanent firewall-cmd --zone=public --add-port=${Port}/tcp --permanent
done done
@@ -143,15 +120,10 @@ systemctl enable restagent.service
systemctl enable crontask.service systemctl enable crontask.service
systemctl enable sshsvc.service systemctl enable sshsvc.service
systemctl enable captrace.service systemctl enable captrace.service
#systemctl enable kvdb.service
systemctl stop restagent.service systemctl stop restagent.service
systemctl stop crontask.service systemctl stop crontask.service
systemctl stop sshsvc.service systemctl stop sshsvc.service
systemctl stop captrace.service systemctl stop captrace.service
# systemctl stop nginx.service
systemctl stop kvdb.service
systemctl start kvdb.service
# systemctl start nginx.service
systemctl start captrace.service systemctl start captrace.service
systemctl start sshsvc.service systemctl start sshsvc.service
systemctl start crontask.service systemctl start crontask.service
@@ -182,26 +154,19 @@ sudo systemctl stop restagent.service
sudo systemctl stop crontask.service sudo systemctl stop crontask.service
sudo systemctl stop sshsvc.service sudo systemctl stop sshsvc.service
sudo systemctl stop captrace.service sudo systemctl stop captrace.service
#sudo systemctl stop kvdb.service
#sudo systemctl stop nginx.service
#rm -rf /usr/local/omc #rm -rf /usr/local/omc
rm -rf /etc/nginx/conf.d/omc.conf rm -rf /etc/nginx/conf.d/omc.conf
sudo systemctl disable restagent.service sudo systemctl disable restagent.service
sudo systemctl disable crontask.service sudo systemctl disable crontask.service
sudo systemctl disable sshsvc.service sudo systemctl disable sshsvc.service
sudo systemctl disable captrace.service sudo systemctl disable captrace.service
#sudo systemctl disable kvdb.service
sudo systemctl daemon-reload sudo systemctl daemon-reload
else else
sudo systemctl daemon-reload sudo systemctl daemon-reload
#sudo systemctl stop nginx.service
sudo systemctl stop restagent.service sudo systemctl stop restagent.service
sudo systemctl stop crontask.service sudo systemctl stop crontask.service
sudo systemctl stop sshsvc.service sudo systemctl stop sshsvc.service
sudo systemctl stop captrace.service sudo systemctl stop captrace.service
#sudo systemctl stop kvdb.service
#sudo systemctl start nginx.service
sudo systemctl start kvdb.service
sudo systemctl start crontask.service sudo systemctl start crontask.service
sudo systemctl start sshsvc.service sudo systemctl start sshsvc.service
sudo systemctl start captrace.service sudo systemctl start captrace.service
@@ -230,7 +195,6 @@ fi
/lib/systemd/system/crontask.service /lib/systemd/system/crontask.service
/lib/systemd/system/sshsvc.service /lib/systemd/system/sshsvc.service
/lib/systemd/system/captrace.service /lib/systemd/system/captrace.service
#/lib/systemd/system/kvdb.service
/usr/lib64/libwireshark.so.15.0.12 /usr/lib64/libwireshark.so.15.0.12
/usr/lib64/libwiretap.so.12.0.12 /usr/lib64/libwiretap.so.12.0.12
/usr/lib64/libwsutil.so.13.1.0 /usr/lib64/libwsutil.so.13.1.0