installerbuilder/README.md

214 lines
4.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Installer Builder
Installer Builder 是一个强大的跨平台安装包构建工具。它支持Windows和Linux平台可以生成MSI、DEB、RPM和压缩包格式的安装包。通过简单的配置文件您可以定义安装包的内容、安装脚本和依赖项。
## 功能特点
- 支持多种平台Windows、Linux
- 支持多种安装包格式MSI、DEB、RPM、ZIP、TAR.GZ
- 通过YAML配置文件定义安装包内容和行为
- 支持自定义安装脚本
- 支持并行构建多个安装包
- 提供命令行界面易于集成到CI/CD流程中
## 安装
### 从源代码构建
1. 克隆仓库:
```bash
git clone https://git.kingecg.top/kingecg/installerbuilder.git
cd installerbuilder
```
2. 构建项目:
```bash
make build
```
3. 安装二进制文件(可选):
```bash
make install
```
### 使用预编译的二进制文件
从[发布页面](https://git.kingecg.top/kingecg/installerbuilder/releases)下载适合您平台的预编译二进制文件。
## 快速开始
1. 初始化配置文件:
```bash
installer-builder init > installer.yaml
```
2. 编辑配置文件,定义安装包内容和行为。
3. 构建安装包:
```bash
installer-builder build -c installer.yaml
```
## 配置文件示例
```yaml
name: my-application
version: 1.0.0
description: My Application Description
author: Author Name
license: MIT
build:
outputDir: dist
targets:
- windows
- linux
formats:
- msi
- deb
- rpm
- zip
contents:
files:
- source: bin/myapp
destination: bin/myapp
mode: "0755"
- source: README.md
destination: doc/README.md
mode: "0644"
directories:
- path: logs
mode: "0755"
- path: config
mode: "0755"
scripts:
- type: postinstall
content: |
#!/bin/sh
echo "Installation completed successfully!"
platforms:
windows:
msi:
upgradeCode: 12345678-1234-1234-1234-123456789012
manufacturer: My Company
installDir: MyApplication
programMenuDir: MyApplication
shortcuts:
- name: My Application
target: "[INSTALLDIR]bin\\myapp.exe"
description: Launch My Application
icon: "[INSTALLDIR]icons\\app.ico"
linux:
deb:
section: utils
priority: optional
architecture: amd64
depends:
- libc6
rpm:
group: Applications/System
vendor: My Company
url: https://example.com
requires:
- glibc
autoReqProv: true
```
## 命令行参考
```
Installer Builder - 一个跨平台的安装包构建工具
用法:
installer-builder [命令]
可用命令:
build 构建安装包
init 初始化配置文件模板
validate 验证配置文件
version 显示版本信息
help 显示帮助信息
标志:
-h, --help 显示帮助信息
-v, --verbose 启用详细日志输出
-q, --quiet 只显示错误信息
-c, --config 指定配置文件路径
```
### build 命令
```
根据配置文件构建安装包。
用法:
installer-builder build [标志]
标志:
-t, --target 只构建指定平台的安装包
-a, --arch 只构建指定架构的安装包
-o, --output 指定输出目录
--clean 构建前清理输出目录
-p, --parallel 并行构建的数量
```
### validate 命令
```
验证配置文件的格式和内容是否正确。
用法:
installer-builder validate [标志]
标志:
--strict 启用严格验证模式
```
### init 命令
```
创建一个基本的配置文件模板。
用法:
installer-builder init
```
## 依赖项
### 构建工具依赖
- Windows MSI: [WiX Toolset](https://wixtoolset.org/)
- Linux DEB: dpkg-deb
- Linux RPM: rpmbuild
## 贡献
欢迎贡献代码、报告问题或提出改进建议。请遵循以下步骤:
1. Fork 项目
2. 创建您的特性分支 (`git checkout -b feature/amazing-feature`)
3. 提交您的更改 (`git commit -m 'Add some amazing feature'`)
4. 推送到分支 (`git push origin feature/amazing-feature`)
5. 打开一个 Pull Request
## 许可证
本项目采用 MIT 许可证 - 详见 [LICENSE](LICENSE) 文件。
## 联系方式
如有问题或建议,请通过以下方式联系我们:
- 项目主页:[https://git.kingecg.top/kingecg/installerbuilder](https://git.kingecg.top/kingecg/installerbuilder)
- 问题跟踪:[https://git.kingecg.top/kingecg/installerbuilder/issues](https://git.kingecg.top/kingecg/installerbuilder/issues)