#!/bin/bash ################################################################# # Property of Caton Inc. # # Copyright 2022 - All rights reserved. # # # # For details, contact www.catontechnology.com/en/contact # ################################################################# set +e #AGENT_ID #AGENT_ID=${AGENT_ID} #PASSWORD #PASSWORD=${PASSWORD} updateonly="" minlogopen="" configpath=/etc configname=netScopeCfg configfullpath=${configpath}/${configname} echo -e "\033[32mStart installing NetScope ..........." if [ -f "${configfullpath}" ]; then echo -e "\033[31mNetScope config file existed :\033[33m ${configfullpath}" while true; do echo -e "\033[33mDo you want to overwrite the existing file?" read -p "Please answer yes or no : " yn /dev/null 2>&1; then echo -e "\033[31m${downloadmethod} is not installed. Please install ${downloadmethod} first \033[0m" echo -e "\033[0m" exit 1 else echo -e "\033[32m${downloadmethod} detection passed\033[0m" echo -e "\033[0m" fi #============== if [[ "${updateonly}" == "" ]]; then touch ${configfullpath} chmod 777 ${configfullpath} echo "{" >${configfullpath} echo "\"SaaSServerIp\":\"${SaaSServerIp}\", " >>${configfullpath} echo "\"SaasServerPort\":\"${SaasServerPort}\", " >>${configfullpath} echo "\"SaasServerPath\":\"${SaasServerPath}\", " >>${configfullpath} echo "\"AgentID\":\"${AgentID}\"," >>${configfullpath} echo "\"AgentPassWord\": \"${AgentPassWord}\"," >>${configfullpath} echo "\"publicIpApi\": \"${publicIpApi}\"," >>${configfullpath} echo "\"MtrLogEnable\": 0," >>${configfullpath} echo "\"zlogEnable\": 0," >>${configfullpath} echo "\"MtrThreadNumber\": 60," >>${configfullpath} echo "\"cacheNumber\": 60000," >>${configfullpath} echo "\"writeInterval\": 100000" >>${configfullpath} echo "}" >>${configfullpath} fi #============== cd /tmp/ mkdir --m=777 ${installpath} >/dev/null 2>&1 cd ${installpath} #============== ${downloadmethod} -o ./${pakagename} ${gzdownloadurlfix}${gzdownloadurl} tar ${pakageuntar} ${pakagename} -C . rm -f ${pakagename} chmod 777 ./install.sh if [[ "${minlogopen}" == "" ]]; then echo -e "\033[0mstart install" bash ./install.sh else echo -e "\033[0mOPEN minLog" bash ./install.sh minLog fi #============== echo -e "\033[32minstallation is complete" echo -e "\033[0m"