From 58207338fe6b98b5eee54757d99e40f8621e0f04 Mon Sep 17 00:00:00 2001
From: panchenbo <panchenbo@kylinsec.com.cn>
Date: Mon, 10 Apr 2023 10:15:12 +0800
Subject: [PATCH] add support for KylinSec platform

---
 .../build/script/package_opengauss.sh               | 10 ++++++----
 openGauss-server-2.1.0/src/get_PlatForm_str.sh      | 13 +++++++++++++
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/openGauss-server-2.1.0/build/script/package_opengauss.sh b/openGauss-server-2.1.0/build/script/package_opengauss.sh
index f6447b2..8b82cb1 100755
--- a/openGauss-server-2.1.0/build/script/package_opengauss.sh
+++ b/openGauss-server-2.1.0/build/script/package_opengauss.sh
@@ -62,10 +62,12 @@ elif [ X"$kernel" == X"euleros" ]; then
     dist_version="EulerOS"
 elif [ X"$kernel" == X"kylin" ]; then
     dist_version="Kylin"
+elif [ X"$kernel" == X"kylinsec" ]; then
+    dist_version="KylinSec"
 elif [ X"$kernel" = X"ubuntu" ]; then
     dist_version="Ubuntu"
 else
-    echo "We only support openEuler(aarch64), EulerOS(aarch64), CentOS, Kylin(aarch64) and Ubuntu(x86) platform."
+    echo "We only support openEuler(aarch64), EulerOS(aarch64), CentOS, Kylin(aarch64), KylinSec(aarch64) and Ubuntu(x86) platform."
     echo "Kernel is $kernel"
     exit 1
 fi
@@ -122,8 +124,8 @@ done
 ##add platform architecture information
 PLATFORM_ARCH=$(uname -p)
 if [ "$PLATFORM_ARCH"X == "aarch64"X ] ; then
-    if [ "$dist_version" != "openEuler" ] && [ "$dist_version" != "EulerOS" ] && [ "$dist_version" != "Kylin" ] ; then
-        echo "We only support NUMA on openEuler(aarch64), EulerOS(aarch64), Kylin(aarch64) platform."
+    if [ "$dist_version" != "openEuler" ] && [ "$dist_version" != "EulerOS" ] && [ "$dist_version" != "Kylin" ] && [ "$dist_version" != "KylinSec" ] ; then
+        echo "We only support NUMA on openEuler(aarch64), EulerOS(aarch64), Kylin(aarch64), KylinSec(aarch64) platform."
         exit 1
     fi
 
@@ -220,7 +222,7 @@ ROOT_DIR=$(dirname "$ROOT_DIR")
 PLAT_FORM_STR=$(sh "${ROOT_DIR}/src/get_PlatForm_str.sh")
 if [ "${PLAT_FORM_STR}"x == "Failed"x ]
 then
-    echo "We only support openEuler(aarch64), EulerOS(aarch64), CentOS, Kylin(aarch64) platform."
+    echo "We only support openEuler(aarch64), EulerOS(aarch64), CentOS, Kylin(aarch64), KylinSec(aarch64) platform."
     exit 1;
 fi
 
diff --git a/openGauss-server-2.1.0/src/get_PlatForm_str.sh b/openGauss-server-2.1.0/src/get_PlatForm_str.sh
index 9fff29a..ce73a9c 100755
--- a/openGauss-server-2.1.0/src/get_PlatForm_str.sh
+++ b/openGauss-server-2.1.0/src/get_PlatForm_str.sh
@@ -29,6 +29,9 @@ then
 elif [ -f "/etc/kylin-release" ]
 then
 	kernel=$(cat /etc/kylin-release | awk -F ' ' '{print $1}' | tr A-Z a-z)
+elif [ -f "/etc/kylinsec-release" ]
+then
+        kernel=$(cat /etc/kylinsec-release | awk -F ' ' '{print $1}' | tr A-Z a-z)
 else
 	kernel=$(lsb_release -d | awk -F ' ' '{print $2}'| tr A-Z a-z)
 fi
@@ -135,6 +138,16 @@ then
     plat_form_str=kylin_"$cpu_bit"
 fi
 
+##################################################################################
+# kylinsec platform
+# the result form like this: kylinsec_aarch64
+##################################################################################
+if [ "$kernel"x = "kylinsec"x ]
+then
+    plat_form_str=kylinsec_"$cpu_bit"
+fi
+
+
 ##################################################################################
 # ubuntu platform
 # the result form like this: ubuntu_x86_64
-- 
2.27.0

