From a76ef8cae79d53aa1fa9b4e5ebfd4e3803780a5f Mon Sep 17 00:00:00 2001 From: cpusoft Date: Fri, 3 Apr 2020 19:42:01 +0800 Subject: [PATCH] change sh and readme --- build/rpstir2-deploy.sh | 53 ++++++++++++++++++++++++++++++++++++++++ build/rpstir2-rebuild.sh | 47 +++-------------------------------- doc/README_CN.md | 2 +- 3 files changed, 58 insertions(+), 44 deletions(-) create mode 100644 build/rpstir2-deploy.sh diff --git a/build/rpstir2-deploy.sh b/build/rpstir2-deploy.sh new file mode 100644 index 0000000..30180ea --- /dev/null +++ b/build/rpstir2-deploy.sh @@ -0,0 +1,53 @@ +#!/bin/bash +configFile="../conf/project.conf" +source ./read-conf.sh + +cur=$(pwd) +rpstir2_build_dir=$(pwd) +cd .. +rpstir2_source_dir=$(pwd) +cd ${rpstir2_build_dir} +rpstir2_program_dir=$(ReadINIfile $configFile rpstir2 programdir) +rpstir2_data_dir=$(ReadINIfile $configFile rpstir2 datadir) +echo "source directory is " $rpstir2_source_dir +echo "build directory is " $rpstir2_build_dir +echo "program directory is " $rpstir2_program_dir + +mkdir -p ${rpstir2_program_dir} ${rpstir2_program_dir}/bin ${rpstir2_program_dir}/conf ${rpstir2_program_dir}/log +mkdir -p ${rpstir2_data_dir} ${rpstir2_data_dir}/rsyncrepo ${rpstir2_data_dir}/rrdprepo ${rpstir2_data_dir}/slurm ${rpstir2_data_dir}/tal + + +mkdir -p $GOPATH/src/golang.org/x +cd $GOPATH/src/golang.org/x +git clone https://github.com/golang/crypto.git +git clone https://github.com/golang/net.git +go get -u github.com/astaxie/beego/logs +go get -u github.com/go-xorm/xorm +go get -u github.com/go-sql-driver/mysql +go get -u github.com/go-xorm/core +go get -u github.com/parnurzeal/gorequest +go get -u github.com/ant0ine/go-json-rest +go get -u github.com/satori/go.uuid +go get -u github.com/cpusoft/go-json-rest +go get -u github.com/cpusoft/goutil + +cd $rpstir2_source_dir +oldgopath=$GOPATH +# linux / windows +CGO_ENABLED=0 +GOOS=linux +GOARCH=amd64 +GOPATH=$GOPATH:$rpstir2_source_dir +# see: go tool compile -help +go install -v -gcflags "-N -l" ./... +export GOPATH=$oldgopath +cd $cur +cp ${rpstir2_source_dir}/bin/* ${rpstir2_program_dir}/bin/ +cp ${rpstir2_build_dir}/rpstir2-command.sh ${rpstir2_program_dir}/bin/ +cp ${rpstir2_build_dir}/rpstir2-service.sh ${rpstir2_program_dir}/bin/ +cp ${rpstir2_build_dir}/read-conf.sh ${rpstir2_program_dir}/bin/ +cp -r ${rpstir2_source_dir}/conf/* ${rpstir2_program_dir}/conf/ +cp ${rpstir2_source_dir}/conf/tal/* ${rpstir2_data_dir}/tal +chmod +x ${rpstir2_program_dir}/bin/* + + diff --git a/build/rpstir2-rebuild.sh b/build/rpstir2-rebuild.sh index ed80959..915ae41 100644 --- a/build/rpstir2-rebuild.sh +++ b/build/rpstir2-rebuild.sh @@ -7,67 +7,28 @@ rpstir2_build_dir=$(pwd) cd .. rpstir2_source_dir=$(pwd) cd ${rpstir2_build_dir} -echo "source directory is " $rpstir2_source_dir -echo "build directory is " $rpstir2_build_dir - - - rpstir2_program_dir=$(ReadINIfile $configFile rpstir2 programdir) rpstir2_data_dir=$(ReadINIfile $configFile rpstir2 datadir) +echo "source directory is " $rpstir2_source_dir +echo "build directory is " $rpstir2_build_dir echo "program directory is " $rpstir2_program_dir -echo "data directory is " $rpstir2_data_dir -####################################### -echo "1. create program data dir, and recreate mysql tables" -# reset program and data dir, and copy default project.conf -cd ${rpstir2_source_dir} -svn update --accept tf -cd ${rpstir2_source_dir}/build -chmod +x *.sh -cd ${rpstir2_program_dir}/bin/ -./rpstir2-service.sh stop -cp ${rpstir2_build_dir}/rpstir2-command.sh ${rpstir2_program_dir}/bin/ -cp ${rpstir2_build_dir}/rpstir2-service.sh ${rpstir2_program_dir}/bin/ -cp ${rpstir2_build_dir}/read-conf.sh ${rpstir2_program_dir}/bin/ -cd ${rpstir2_program_dir}/bin/ -chmod +x * - - - - -######################################## -echo "2. update some go depencies" go get -u github.com/cpusoft/goutil -echo -e "\n" - -######################################## -echo "3. start to build rpstir2" cd $rpstir2_source_dir -echo "build dir is" $rpstir2_source_dir oldgopath=$GOPATH -echo "old gopath is " $oldgopath # linux / windows CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GOPATH=$GOPATH:$rpstir2_source_dir -echo "new gopath is " $GOPATH # see: go tool compile -help go install -v -gcflags "-N -l" ./... export GOPATH=$oldgopath -echo "reset old gopath is " $GOPATH cd $cur -echo "it will cp ${rpstir2_source_dir}/bin/* ${rpstir2_program_dir}/bin/" cp ${rpstir2_source_dir}/bin/* ${rpstir2_program_dir}/bin/ +cp ${rpstir2_build_dir}/rpstir2-command.sh ${rpstir2_program_dir}/bin/ +cp ${rpstir2_build_dir}/rpstir2-service.sh ${rpstir2_program_dir}/bin/ chmod +x ${rpstir2_program_dir}/bin/* -echo "build compelete and cd $cur" -cd ${rpstir2_program_dir}/bin/ -./rpstir2-service.sh start -echo -e "\n" - -echo -e "\n" -echo "rebuild complete" -echo -e "\n" diff --git a/doc/README_CN.md b/doc/README_CN.md index 8f65c9c..0d8a4b1 100644 --- a/doc/README_CN.md +++ b/doc/README_CN.md @@ -56,7 +56,7 @@ RPSTIR2支持的功能包括: RPSTIR2支持多种安装方式,建议采用方法1,简单修改配置后,即可运行。 1. 安装预编译版本 - 从https://github.com/bgpsecruity/rpstir2/releases/ 下载最新预编译版本到/root/rpki/rpstir2。 解压后进入/root/rpki/rpstir2/conf目录,修改配置文件project.conf,根据实际修改程序目录和数据目录,和MySQL参数 + 从https://github.com/bgpsecruity/rpstir2/releases/ 下载最新预编译版本到/root/rpki/,包括了rpstir2和data两个子目录。 解压后进入/root/rpki/rpstir2/conf目录,修改配置文件project.conf,根据实际修改程序目录和数据目录,和MySQL参数 ``` [rpstir2] programdir=/root/rpki/rpstir2