From da637796ae397a09a3980d31b2e92a51b73e28e6 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Thu, 6 Jun 2024 11:19:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=95=B0=E6=8D=AE=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E8=AF=BB?= =?UTF-8?q?=E5=8F=96=E5=88=9D=E5=A7=8B=E5=8E=82=E5=95=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/etc/default/omc.conf | 4 ++++ misc/setomc.sh | 15 +++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 config/etc/default/omc.conf diff --git a/config/etc/default/omc.conf b/config/etc/default/omc.conf new file mode 100644 index 00000000..00f89090 --- /dev/null +++ b/config/etc/default/omc.conf @@ -0,0 +1,4 @@ +## Command Configuration +VENDORS=CoreNet_EMS + +## Other diff --git a/misc/setomc.sh b/misc/setomc.sh index f6ff7dbf..3dfa8e08 100644 --- a/misc/setomc.sh +++ b/misc/setomc.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Read the value of the variable from file +source /usr/local/omc/etc/omc.conf + C_ARG_LOWER="agt" C_ARG_UPPER="AGT" M_ARG_LOWER="*" @@ -10,9 +13,21 @@ check_args() { c) C_ARG_LOWER=$(echo $OPTARG | tr '[:upper:]' '[:lower:]') C_ARG_UPPER=$(echo $OPTARG | tr '[:lower:]' '[:upper:]') + # Modifying Script Variables + if [ "${C_ARG_LOWER}" == "ba" ]; then + C_ARG_UPPER="BA" + sed -i 's/VENDORS=.*/VENDORS=BA/' /usr/local/omc/etc/omc.conf + elif [ "${C_ARG_LOWER}" == "agt" ]; then + C_ARG_UPPER="AGT" + sed -i 's/VENDORS=.*/VENDORS=AGT/' /usr/local/omc/etc/omc.conf + fi ;; m) M_ARG=$(echo $OPTARG | tr '[:upper:]' '[:lower:]') + if [ "${VENDORS}" == "BA" ]; then + C_ARG_LOWER="ba" + C_ARG_UPPER="BA" + fi ;; \?) echo "Invalid option: -$OPTARG" >&2