#!/bin/bash

### https://golang.google.cn/dl/go1.16.6.windows-amd64.msi

echo "Go 环境安装"
mkdir -p /root/mysoft
cd /root/mysoft
mkdir -p /home/gopath

wget 'https://golang.google.cn/dl/go1.22.4.linux-amd64.tar.gz'
tar -zxvf /root/mysoft/go1.22.4.linux-amd64.tar.gz -C /root/mysoft
mv /root/mysoft/go /usr/local/go1.22.4.linux-amd64


echo "Go 加入系统变量"
echo '# go env' >> /etc/profile
echo 'export GOPATH=/home/gopath' >> /etc/profile
echo 'export GOROOT=/usr/local/go1.22.4.linux-amd64' >> /etc/profile
echo 'export PATH=$PATH:$GOROOT/bin:$GOPATH/bin' >> /etc/profile
echo 'export GO111MODULE=on' >> /etc/profile
source /etc/profile

go version

echo "GO 代理设置"
go env -w GOPROXY=https://goproxy.cn,direct

go env

# echo "luajit环境安装"
# cd /root/mysoft
# wget https://luajit.org/download/LuaJIT-2.0.5.tar.gz
# tar -xzvf LuaJIT-2.0.5.tar.gz
# mv LuaJIT-2.0.5 luajit
# cd luajit
# make
# make install
# cat /etc/ld.so.conf
# echo "/usr/local/lib" >> /etc/ld.so.conf
# ldconfig

# echo "lua-cjson环境安装"
# cd /root/mysoft
# wget https://www.kyne.com.au/~mark/software/download/lua-cjson-2.1.0.tar.gz
# tar -xzvf lua-cjson-2.1.0.tar.gz
# cd lua-cjson-2.1.0

# echo "替换cjson Makefile 文件"
# sed -i "21c LUA_INCLUDE_DIR =   \/root\/mysoft\/luajit\/src" Makefile
# make
# cp cjson.so /usr/local/lib/lua/5.1/

# echo "下面的步骤请先确保server的目录和common目录平级 server目录为/home/slg/server common目录为/home/slg/common"
# cd /home/slg/server/Trunk/bin
# sh cover_golua.sh






