Pārlūkot izejas kodu

chore: add zmq install script

Signed-off-by: Jiyong Huang <huangjy@emqx.io>
Jiyong Huang 2 gadi atpakaļ
vecāks
revīzija
6ca113cede

+ 0 - 5
build-plugins.sh

@@ -26,11 +26,6 @@ OS=$(sed -n '/^ID=/p' /etc/os-release | sed -r 's/ID=(.*)/\1/g')
 
 
 pre(){
 pre(){
     mkdir -p _plugins/$OS/$PLUGIN_TYPE
     mkdir -p _plugins/$OS/$PLUGIN_TYPE
-    if [  $(cat etc/$PLUGIN_TYPE/$PLUGIN_NAME.json | jq -r ".libs") != 'null' ]; then
-        for lib in $(cat etc/$PLUGIN_TYPE/$PLUGIN_NAME.json | jq -r ".libs[]"); do
-            go get $lib;
-        done
-    fi
 }
 }
 
 
 post(){
 post(){

+ 63 - 0
extensions/sinks/zmq/install.sh

@@ -0,0 +1,63 @@
+#!/bin/sh
+#
+# Copyright 2023 EMQ Technologies Co., Ltd.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+set +e -x -u
+
+DISTRO='unknow'
+
+Get_Dist_Name()
+{
+    if grep -Eqii "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then
+        DISTRO='CentOS'
+    elif grep -Eqi "Red Hat Enterprise Linux Server" /etc/issue || grep -Eq "Red Hat Enterprise Linux Server" /etc/*-release; then
+        DISTRO='RHEL'
+    elif grep -Eqi "Aliyun" /etc/issue || grep -Eq "Aliyun" /etc/*-release; then
+        DISTRO='Aliyun'
+    elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then
+        DISTRO='Fedora'
+    elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
+        DISTRO='Debian'
+    elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
+        DISTRO='Ubuntu'
+    elif grep -Eqi "Raspbian" /etc/issue || grep -Eq "Raspbian" /etc/*-release; then
+        DISTRO='Raspbian'
+    elif grep -Eqi "Alpine" /etc/issue || grep -Eq "Alpine" /etc/*-release; then
+        DISTRO='Alpine'
+    else
+        DISTRO='unknow'
+    fi
+    echo $DISTRO;
+}
+
+
+Get_Dist_Name
+
+case $DISTRO in \
+    Debian|Ubuntu|Raspbian ) \
+	apt update \
+	&& apt upgrade \
+        && apt install -y libczmq-dev 2> /dev/null \
+    ;; \
+    Alpine ) \
+        apk add libzmq 2> /dev/null \
+    ;; \
+    *) \
+        yum install -y zeromq 2> /dev/null \
+    ;; \
+esac
+    
+echo "install success";

+ 63 - 0
extensions/sources/zmq/install.sh

@@ -0,0 +1,63 @@
+#!/bin/sh
+#
+# Copyright 2023 EMQ Technologies Co., Ltd.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+set +e -x -u
+
+DISTRO='unknow'
+
+Get_Dist_Name()
+{
+    if grep -Eqii "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then
+        DISTRO='CentOS'
+    elif grep -Eqi "Red Hat Enterprise Linux Server" /etc/issue || grep -Eq "Red Hat Enterprise Linux Server" /etc/*-release; then
+        DISTRO='RHEL'
+    elif grep -Eqi "Aliyun" /etc/issue || grep -Eq "Aliyun" /etc/*-release; then
+        DISTRO='Aliyun'
+    elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then
+        DISTRO='Fedora'
+    elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
+        DISTRO='Debian'
+    elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
+        DISTRO='Ubuntu'
+    elif grep -Eqi "Raspbian" /etc/issue || grep -Eq "Raspbian" /etc/*-release; then
+        DISTRO='Raspbian'
+    elif grep -Eqi "Alpine" /etc/issue || grep -Eq "Alpine" /etc/*-release; then
+        DISTRO='Alpine'
+    else
+        DISTRO='unknow'
+    fi
+    echo $DISTRO;
+}
+
+
+Get_Dist_Name
+
+case $DISTRO in \
+    Debian|Ubuntu|Raspbian ) \
+	apt update \
+	&& apt upgrade \
+        && apt install -y libczmq-dev 2> /dev/null \
+    ;; \
+    Alpine ) \
+        apk add libzmq 2> /dev/null \
+    ;; \
+    *) \
+        yum install -y zeromq 2> /dev/null \
+    ;; \
+esac
+    
+echo "install success";