Older/resource/build.sh

70 lines
1.4 KiB
Bash
Raw Normal View History

2023-07-21 16:17:01 +08:00
#!/bin/bash
base_path=$(pwd)
build_path=${base_path}/build
libraries_root="/opt/Libraries"
server_location=/root/HttpServer
function cmake_scan() {
if [ ! -d ${build_path} ]; then
mkdir ${build_path}
fi
/opt/Qt/Tools/CMake/bin/cmake \
-G Ninja \
-S ${base_path} \
-B ${build_path} \
-DCMAKE_BUILD_TYPE=Debug \
2023-12-30 00:10:51 +08:00
-DBOOST_ROOT=${libraries_root}/boost_1_84_0
2023-07-21 16:17:01 +08:00
}
function build() {
if [ ! -f "${build_path}/CMakeCache.txt" ]; then
cmake_scan
fi
if [ $? -ne 0 ]; then
exit 1
fi
/opt/Qt/Tools/CMake/bin/cmake \
--build ${build_path} \
--target all
2023-12-30 01:19:36 +08:00
if [ $? -ne 0 ]; then
exit 1
fi
build/UnitTest/UnitTest
2023-07-21 16:17:01 +08:00
}
2024-01-04 23:49:27 +08:00
function deploy() {
2023-07-21 16:17:01 +08:00
build
if [ $? -ne 0 ]; then
echo "build backend failed ..."
exit 1
fi
rsync -azv build/Server/HttpServer Server/conf root@amass.fun:${server_location}
ssh root@amass.fun "pkill HttpServer; source /etc/profile && \
2023-11-05 19:01:15 +08:00
openresty -p ${server_location} -s reload && \
2023-07-21 16:17:01 +08:00
cd ${server_location}; \
nohup ./HttpServer >logs/HttpServer.log 2>&1 &"
}
function main() {
local cmd=$1
shift 1
case $cmd in
deploy)
deploy
;;
build)
build
;;
*)
build
;;
esac
}
2023-11-18 18:08:16 +08:00
main $@
# curl -k --insecure https://127.0.0.1/lua
# openresty -p Server
2023-12-30 01:19:36 +08:00
# sudo openresty -p Server -s reload