代码拉取完成,页面将自动刷新
# Copyright (c) 2021-2023 Alibaba Cloud Computing Ltd.
# SPDX-License-Identifier: MulanPSL-2.0
#!/bin/bash
# keentuned configuration and installation script
# code_home 代码仓的位置, 写到daemon这一级
code_home=`pwd`
# keentuned_home keentune依赖的配置文件位置
keentuned_home="/etc/keentune/keentuned"
Check_Exec() {
if [ $? -ne 0 ]; then
echo -e "exec [$1] failed";
exit 1
fi
}
# 1. Copy keentuned Configuration
if [ ! -d "$code_home" ]; then
echo "code_home must be specified"
exit 1
else
echo "code_home is ${code_home}, begin to Compile keentune"
fi
if [ ! -d /etc/keentune/keentuned/conf ]; then
mkdir -p /etc/keentune/keentuned/conf
Check_Exec "mkdir /etc/keentune/keentuned/conf"
fi
cp $code_home/keentuned.conf -f $keentuned_home/conf
Check_Exec "cp keentuned.conf"
/bin/cp -rf $code_home/daemon/examples/. $keentuned_home
if [ $? -ne 0 ]; then
cp -rf $code_home/daemon/examples/. $keentuned_home
Check_Exec "cp -rf examples to keentune home"
fi
#2. set go env
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct
echo "Step1. Complete environment configuration"
#3. go install
cd $code_home/daemon
go install .
Check_Exec "install keentune service"
go install ../cli
Check_Exec "install keentune cli"
go_path=`go env | grep -i "GOPATH" | awk -F'"' '{print$2}'`
if [ -f ${go_path}/bin/daemon ]; then
mv ${go_path}/bin/daemon -f /usr/bin/keentuned
echo "Step2. Build 'keentuned' daemon successfully"
else
echo "daemon not exist"
exit 1
fi
if [ -f ${go_path}/bin/cli ]; then
mv ${go_path}/bin/cli -f /usr/bin/keentune
echo "Step3. Build 'keentune' command successfully"
else
echo "cli not exist"
exit 1
fi
echo "Step4. Welcome to use!"
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。