1
0

Merge branch 'main' into multi-tenant

This commit is contained in:
2024-09-25 17:09:04 +08:00
41 changed files with 468 additions and 13131 deletions

View File

@@ -1,10 +1,6 @@
# !/bin/bash
RedisRootDir=/usr/local
OMCRootDir=/usr/local/omc
RedisOldRootDir=/usr/local/db
RedisConfDir=${RedisRootDir}/etc/kvdb
DependsRootDir=${OMCRootDir}/depends
SystemdRootDir=/lib/systemd/system
OMCEtcDir=${OMCRootDir}/etc
FERootDir=${OMCRootDir}/htdocs/front
@@ -15,7 +11,6 @@ UsrLocalBinDir=/usr/local/bin
OmcDaemon=omcd
NginxEtcDir=/etc/nginx
NginxConfDir=${NginxEtcDir}/conf.d
NginxSiteAvailable=${NginxEtcDir}/sites-available
CFileList="restconf.yaml crontask.yaml tasks.yaml sshsvc.yaml capconf.yaml omc.conf"
LogoFileList="zh_brand.png zh_icon.png en_brand.png en_icon.png"
@@ -25,7 +20,6 @@ echo " sudo systemctl start/stop/restart/status restagent.service"
echo " sudo systemctl start/stop/restart/status crontask.service"
echo " sudo systemctl start/stop/restart/status sshsvc.service"
echo " sudo systemctl start/stop/restart/status captrace.service"
echo " sudo systemctl start/stop/restart/status kvdb.service"
echo " or run: "
echo " sudo /usr/local/omc/bin/omcsvc.sh start/stop/restart/status"
echo ""
@@ -115,27 +109,25 @@ done
if [ ! -e "${FERootDir}/config.js" ]; then
cp ${FERootDir}/default/config.js ${FERootDir};
fi
fi
for LogoFile in ${LogoFileList}; do
if [ ! -e "${OMCStaticDir}/logo/${LogoFile}" ]; then
cp ${OMCStaticDir}/agt.d/logo/${LogoFile} ${OMCStaticDir}/logo;
cp ${OMCStaticDir}/omc.d/logo/${LogoFile} ${OMCStaticDir}/logo;
fi
done
done
if ! id -u omc >/dev/null 2>&1 ; then
useradd -d /opt/omc -m -s /bin/bash -pomc123 omc;
mkdir -p /opt/omc/ftp
else
echo "user omc exist";
fi
if [ ! -e "${NginxConfDir}/omc.conf" ]; then
mkdir -p ${NginxConfDir}
cp -f ${OMCEtcDir}/nginx/omc.conf ${NginxConfDir};
fi
#cp -f ${OMCEtcDir}/nginx/default ${NginxSiteAvailable}
if [ -e "${NginxSiteAvailable}/default" ]; then
sed -i 's/listen 80 default_server;/listen 1080 default_server;/g' ${NginxSiteAvailable}/default
sed -i 's/listen \[::\]:80 default_server;/listen \[::\]:1080 default_server;/g' ${NginxSiteAvailable}/default
fi
# disable auto upgrade
systemctl disable --now unattended-upgrades
@@ -144,12 +136,11 @@ systemctl enable restagent.service
systemctl enable crontask.service
systemctl enable sshsvc.service
systemctl enable captrace.service
#systemctl enable kvdb.service
systemctl daemon-reload
#systemctl stop nginx.service
# read environment parameter and to do
if [ "$M_PARAM" == "install" -o "$M_PARAM" == "upgrade" ]; then
if [ "$M_PARAM" = "install" -o "$M_PARAM" = "upgrade" ]; then
echo "M parameter: $M_PARAM"
if [ -n "$C_PARAM" ]; then
echo "C parameter: $C_PARAM"
@@ -164,15 +155,9 @@ if [ "$M_PARAM" == "install" -o "$M_PARAM" == "upgrade" ]; then
fi
fi
systemctl stop restagent.service
systemctl stop crontask.service
systemctl stop sshsvc.service
systemctl stop captrace.service
#systemctl stop kvdb.service
#systemctl start nginx.service
#systemctl start kvdb.service
echo -n "Starting OMC service ... "
systemctl start crontask.service
systemctl start sshsvc.service
systemctl start captrace.service
systemctl start restagent.service
echo "done"