From 860b53b06a6c4cbb10a82e0b699b18ae5f2539d3 Mon Sep 17 00:00:00 2001 From: simonzhangsz Date: Tue, 3 Sep 2024 16:12:18 +0800 Subject: [PATCH] add: dkpg support environment parameter to do DB install/upgrade --- debbuild/22.04/DEBIAN/postinst | 17 +++++++++++++++++ debbuild/DEBIAN/postinst | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/debbuild/22.04/DEBIAN/postinst b/debbuild/22.04/DEBIAN/postinst index 0fc7594..9306f42 100644 --- a/debbuild/22.04/DEBIAN/postinst +++ b/debbuild/22.04/DEBIAN/postinst @@ -147,6 +147,23 @@ 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 + echo "M parameter: $M_PARAM" + if [ -n "$C_PARAM" ]; then + echo "C parameter: $C_PARAM" + ${OMCRootDir}/bin/setomc.sh -m $M_PARAM -c $C_PARAM + else + ${OMCRootDir}/bin/setomc.sh -m $M_PARAM + fi + # exit while failed to run setomc.sh + if [ $? -ne 0 ]; then + echo "setomc.sh execution failed. Exiting." + exit 1 + fi +fi + systemctl stop restagent.service systemctl stop crontask.service systemctl stop sshsvc.service diff --git a/debbuild/DEBIAN/postinst b/debbuild/DEBIAN/postinst index 5ae4ac9..35f557e 100644 --- a/debbuild/DEBIAN/postinst +++ b/debbuild/DEBIAN/postinst @@ -147,6 +147,23 @@ 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 + echo "M parameter: $M_PARAM" + if [ -n "$C_PARAM" ]; then + echo "C parameter: $C_PARAM" + ${OMCRootDir}/bin/setomc.sh -m $M_PARAM -c $C_PARAM + else + ${OMCRootDir}/bin/setomc.sh -m $M_PARAM + fi + # exit while failed to run setomc.sh + if [ $? -ne 0 ]; then + echo "setomc.sh execution failed. Exiting." + exit 1 + fi +fi + systemctl stop restagent.service systemctl stop crontask.service systemctl stop sshsvc.service