功能: 部署时自动打包上传工具
- 添加build_upload_tool()函数自动打包上传工具 - 检测已存在的可执行文件,避免重复打包 - 打包失败时给出友好提示,不影响部署流程 - 支持Windows exe和Linux可执行文件自动打包
This commit is contained in:
37
install.sh
37
install.sh
@@ -1137,6 +1137,40 @@ create_data_directories() {
|
|||||||
echo ""
|
echo ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
build_upload_tool() {
|
||||||
|
print_step "打包上传工具..."
|
||||||
|
|
||||||
|
cd "${PROJECT_DIR}/upload-tool"
|
||||||
|
|
||||||
|
# 检查build.sh是否存在
|
||||||
|
if [[ ! -f "build.sh" ]]; then
|
||||||
|
print_warning "build.sh不存在,跳过上传工具打包"
|
||||||
|
echo ""
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 添加执行权限
|
||||||
|
chmod +x build.sh
|
||||||
|
|
||||||
|
# 检查是否已存在exe或可执行文件
|
||||||
|
if [[ -f "dist/玩玩云上传工具.exe" ]] || [[ -f "dist/玩玩云上传工具" ]]; then
|
||||||
|
print_success "上传工具已存在,跳过打包"
|
||||||
|
echo ""
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 执行打包
|
||||||
|
print_info "开始打包上传工具(这可能需要几分钟)..."
|
||||||
|
if bash build.sh > /dev/null 2>&1; then
|
||||||
|
print_success "上传工具打包完成"
|
||||||
|
else
|
||||||
|
print_warning "上传工具打包失败,用户仍可正常使用SFTP上传"
|
||||||
|
print_info "如需上传工具,请手动运行: cd ${PROJECT_DIR}/upload-tool && bash build.sh"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
configure_nginx() {
|
configure_nginx() {
|
||||||
print_step "配置Nginx..."
|
print_step "配置Nginx..."
|
||||||
|
|
||||||
@@ -2173,6 +2207,9 @@ main() {
|
|||||||
# 创建数据目录
|
# 创建数据目录
|
||||||
create_data_directories
|
create_data_directories
|
||||||
|
|
||||||
|
# 打包上传工具
|
||||||
|
build_upload_tool
|
||||||
|
|
||||||
# 部署SSL证书
|
# 部署SSL证书
|
||||||
deploy_ssl
|
deploy_ssl
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user