Skip to content

Commit

Permalink
change sh and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
cpusoft committed Apr 3, 2020
1 parent 8a627c4 commit a76ef8c
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 44 deletions.
53 changes: 53 additions & 0 deletions build/rpstir2-deploy.sh
Original file line number Diff line number Diff line change
@@ -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/*


47 changes: 4 additions & 43 deletions build/rpstir2-rebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

2 changes: 1 addition & 1 deletion doc/README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a76ef8c

Please sign in to comment.