mirror of
https://github.com/xiaozhou233/JuiceAgent.git
synced 2026-12-05 13:05:53 +08:00
Compare commits
4
Commits
6eb1925ec3
...
4b9d371357
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b9d371357 | ||
|
|
c710547cc8 | ||
|
|
4bb0d6ecd1 | ||
|
|
0e1280ef7f |
No files matched your search
@@ -93,3 +93,42 @@ jobs:
|
||||
path: dist/JuiceAgent_*.zip
|
||||
if-no-files-found: error
|
||||
retention-days: 14
|
||||
|
||||
build-linux:
|
||||
name: Build (Linux, GCC)
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install build tools
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
build-essential cmake ninja-build
|
||||
|
||||
- name: Configure
|
||||
run: |
|
||||
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cmake --build build
|
||||
|
||||
echo "compiler: $(command -v g++)"
|
||||
echo "target: $(gcc -dumpmachine)"
|
||||
|
||||
echo "--- build/bin ---"
|
||||
ls -1 build/bin
|
||||
|
||||
- name: Package release tarball
|
||||
run: ./script/package.sh
|
||||
|
||||
- name: Upload build artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: JuiceAgent-linux-x64
|
||||
path: dist/JuiceAgent_*.tar.gz
|
||||
if-no-files-found: error
|
||||
retention-days: 14
|
||||
@@ -77,8 +77,15 @@ The runner compiles the modules, refreshes `tests/resources` from `build/bin`
|
||||
|
||||
(`script/package.bat` wraps this but ends with `pause`.)
|
||||
|
||||
`tests/`, `build/`, `dist/` and `*.log` are gitignored; `dist/*.zip` is **not**
|
||||
committed.
|
||||
On Linux, `script/package.sh` packs `injector`, `libloader.so` and
|
||||
`libagent.so` into `dist/JuiceAgent_vX.Y.Z_x64_linux.tar.gz`:
|
||||
|
||||
```bash
|
||||
./script/package.sh
|
||||
```
|
||||
|
||||
`tests/`, `build/`, `dist/` and `*.log` are gitignored; `dist/*.zip` and
|
||||
`dist/*.tar.gz` are **not** committed.
|
||||
|
||||
## Hard rules (each of these was learned by breaking the build or a target JVM)
|
||||
|
||||
@@ -197,9 +204,14 @@ Tracked text files are **LF in the index, CRLF in the working tree** (no
|
||||
|
||||
## CI
|
||||
|
||||
`.github/workflows/ci.yml` runs on `windows-latest`: JDK 25 (Temurin) +
|
||||
MinGW-w64 (MSYS2) + Ninja, then `configure -> build -> tests -> package`, and
|
||||
uploads `dist/JuiceAgent_*.zip` as an artifact (14-day retention).
|
||||
`.github/workflows/ci.yml` has two jobs:
|
||||
|
||||
- `build-and-test` on `windows-latest`: JDK 25 (Temurin) + MinGW-w64 (MSYS2) +
|
||||
Ninja, then `configure -> build -> tests -> package`, uploading
|
||||
`dist/JuiceAgent_*.zip` as an artifact (14-day retention).
|
||||
- `build-linux` on `ubuntu-latest`: GCC + Ninja, then
|
||||
`configure -> build -> package` only — the integration tests are Windows-only —
|
||||
uploading `dist/JuiceAgent_*.tar.gz`.
|
||||
|
||||
CI-specific notes:
|
||||
|
||||
|
||||
@@ -4,6 +4,11 @@
|
||||
|
||||
JuiceAgent is an advanced JVMTI-based injection framework for runtime JAR loading, bytecode transformation, and runtime JVM instrumentation. It injects into a running JVM process even when `DisableAttachMechanism=true`, without requiring `-javaagent` startup arguments or the attach mechanism.
|
||||
|
||||
Two platforms are supported:
|
||||
|
||||
- **Windows x64** — reflective DLL injection (`injector.exe` + `libinject.dll`).
|
||||
- **Linux x64** — `ptrace` attach plus a remote `dlopen` call that makes the target JVM load `libloader.so` itself.
|
||||
|
||||
**Warning**: This project is still experimental and is not recommended for production use. Use it at your own risk.
|
||||
|
||||
> **Tips**: Some antivirus software may flag JuiceAgent as malware. See [Antivirus False Positive Notice](docs/Antivirus-False-Positive.md) for details.
|
||||
@@ -32,7 +37,7 @@ Welcome to join our QQ/Discord group for more information and support:
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
@@ -47,6 +52,7 @@ Welcome to join our QQ/Discord group for more information and support:
|
||||
- [Features](#features)
|
||||
- [Project Structure](#project-structure)
|
||||
- [Quick Start](#quick-start)
|
||||
- [Linux Support](#linux-support)
|
||||
- [JuiceAgent API](#juiceagent-api)
|
||||
- [Examples](#examples)
|
||||
- [How To Build](#how-to-build)
|
||||
@@ -76,6 +82,14 @@ With JuiceAgent, developers can:
|
||||
|
||||
The `JuiceAgent-API` jar is embedded in the native binaries, so no separate download is required.
|
||||
|
||||
On Linux the pipeline is the same, only the injection step changes. The injector
|
||||
attaches to the target process with `ptrace`, saves its registers, and performs a
|
||||
remote `dlopen` so the JVM loads `libloader.so` in-process (no `LD_PRELOAD`, no
|
||||
`-javaagent`). `libloader.so` then starts from an ELF constructor, resolves its
|
||||
runtime directory (`JuiceAgent_ConfigPath`, or `$HOME/.juiceagent` by default),
|
||||
and drives the agent exactly like the Windows loader. See
|
||||
[Linux Support](#linux-support).
|
||||
|
||||
## Features
|
||||
|
||||
- Load external JARs into the Bootstrap or System ClassLoader
|
||||
@@ -90,10 +104,10 @@ The `JuiceAgent-API` jar is embedded in the native binaries, so no separate down
|
||||
|
||||
## Project Structure
|
||||
|
||||
- `src/libloader` — `libloader.dll`. Injected into the target JVM. Attaches to the JVM, parses `config.toml`, injects the embedded `JuiceAgent-API`, and bootstraps the agent.
|
||||
- `src/libagent` — `libagent.dll`. The JVMTI agent. Registers callbacks (e.g. `ClassFileLoadHook`) and implements the native side of `JuiceAgent-API`.
|
||||
- `src/injector` — `injector.exe`. Command-line driver that loads `libinject.dll` and injects `libloader.dll` into the target process.
|
||||
- `src/libinject` — `libinject.dll`. Reflective DLL injector. Exposes a native `inject` function and JNI bindings (`cn.xiaozhou233.juiceagent.injector.InjectorNative`).
|
||||
- `src/libloader` — `libloader.dll` (Windows) / `libloader.so` (Linux). Injected into the target JVM. Attaches to the JVM, parses `config.toml`, injects the embedded `JuiceAgent-API`, and bootstraps the agent.
|
||||
- `src/libagent` — `libagent.dll` (Windows) / `libagent.so` (Linux). The JVMTI agent. Registers callbacks (e.g. `ClassFileLoadHook`) and implements the native side of `JuiceAgent-API`.
|
||||
- `src/injector` — `injector.exe` (Windows) / `injector` (Linux). Command-line driver that loads the loader into the target process.
|
||||
- `src/libinject` — `libinject.dll` (Windows only). Reflective DLL injector. Exposes a native `inject` function and JNI bindings (`cn.xiaozhou233.juiceagent.injector.InjectorNative`).
|
||||
|
||||
## Quick Start
|
||||
|
||||
@@ -103,6 +117,10 @@ The `JuiceAgent-API` jar is embedded in the native binaries, so no separate down
|
||||
|
||||
Download `JuiceAgent_vx.x.x_x64.zip` from the [releases](https://github.com/xiaozhou233/JuiceAgent/releases) page.
|
||||
|
||||
> **Linux users**: Linux builds are **not** attached to GitHub Releases. Download
|
||||
> them from the [Jenkins job](https://jenkins.xiaozhou233.cn/job/JuiceAgent/)
|
||||
> instead — see [Linux Support](#linux-support).
|
||||
|
||||
Extract the ZIP file to a directory:
|
||||
|
||||
- YourDir
|
||||
@@ -181,6 +199,73 @@ See [Inject](docs/Inject.md)
|
||||
|
||||
The target JVM will load the specified JAR and execute the specified entry class and method.
|
||||
|
||||
## Linux Support
|
||||
|
||||
JuiceAgent also works on Linux x64. Instead of reflective DLL injection, the
|
||||
Linux injector uses `ptrace` to attach to the target process and then performs a
|
||||
**remote `dlopen`**: it saves the thread state, makes the target call
|
||||
`dlopen("libloader.so", RTLD_NOW)`, restores the state and detaches. The JVM
|
||||
therefore loads the loader itself — no `LD_PRELOAD` and no `-javaagent` — and the
|
||||
rest of the pipeline is identical to Windows.
|
||||
|
||||
### Download
|
||||
|
||||
Linux builds are **not** published on GitHub Releases. Download the latest
|
||||
successful build from the Jenkins job:
|
||||
|
||||
```text
|
||||
https://jenkins.xiaozhou233.cn/job/JuiceAgent/
|
||||
```
|
||||
|
||||
Grab the build artifact (`JuiceAgent_vX.Y.Z_x64_linux.tar.gz`) from the most
|
||||
recent successful build, then extract `injector`, `libloader.so` and
|
||||
`libagent.so` from it.
|
||||
|
||||
### Components
|
||||
|
||||
- `libloader.so` — loaded into the target JVM, starts from an ELF constructor.
|
||||
- `libagent.so` — the JVMTI agent. This is the default
|
||||
`JuiceAgentNativeLibraryPath` on Linux (instead of `libagent.dll`).
|
||||
- `injector` — attaches to the target PID and performs the remote `dlopen`.
|
||||
|
||||
### Configuration location
|
||||
|
||||
On Linux the loader does **not** look in the current working directory. It
|
||||
resolves the runtime directory in this order:
|
||||
|
||||
1. `JuiceAgent_ConfigPath` — if the environment variable is set and non-empty, it
|
||||
is used as-is.
|
||||
2. `$HOME/.juiceagent` — the default; created automatically if it does not exist.
|
||||
|
||||
`config.toml` is read from that directory. The schema is identical to Windows
|
||||
and relative paths (`JarPath`, `InjectionDir`, ...) are resolved against it, so a
|
||||
typical layout is:
|
||||
|
||||
```text
|
||||
~/.juiceagent/
|
||||
├── config.toml
|
||||
├── MyCustomJar.jar
|
||||
└── injection/
|
||||
└── Dependencies.jar
|
||||
```
|
||||
|
||||
To point the loader at another directory:
|
||||
|
||||
```bash
|
||||
export JuiceAgent_ConfigPath=/opt/juiceagent
|
||||
```
|
||||
|
||||
### Requirements
|
||||
|
||||
- Run the injector as the same user as the target JVM (or as `root`), and make
|
||||
sure `ptrace` is permitted. If injection fails with `EPERM`, check
|
||||
`/proc/sys/kernel/yama/ptrace_scope`.
|
||||
- The target JVM and the loader must both be x64.
|
||||
|
||||
> **Note**: The Linux injector binary is not open source yet. The `injector`
|
||||
> target in this repository is a placeholder that only prints a notice; the
|
||||
> loader and the agent are fully open source and build from this tree.
|
||||
|
||||
## JuiceAgent API
|
||||
|
||||
The following native functions are exposed to Java through the `cn.xiaozhou233.juiceagent.api.JuiceAgent` class (see the [JuiceAgent-API](https://github.com/xiaozhou233/JuiceAgent-API) project for the Java API definition):
|
||||
@@ -210,7 +295,7 @@ The following native functions are exposed to Java through the `cn.xiaozhou233.j
|
||||
### Requirements
|
||||
|
||||
- Java 8+
|
||||
- MinGW
|
||||
- MinGW-w64 (Windows) or GCC/Clang (Linux)
|
||||
- CMake 3.15+
|
||||
- Ninja
|
||||
|
||||
@@ -234,7 +319,9 @@ cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
|
||||
cmake --build build
|
||||
```
|
||||
|
||||
The generated binaries will be placed in `build/bin`.
|
||||
The generated binaries will be placed in `build/bin`. On Linux this produces
|
||||
`libloader.so`, `libagent.so` and `injector`; on Windows the `.dll` / `.exe`
|
||||
equivalents.
|
||||
|
||||
## Full Disclaimer
|
||||
|
||||
|
||||
+70
-7
@@ -6,6 +6,11 @@
|
||||
|
||||
JuiceAgent 是一个基于 JVMTI 的高级注入框架,用于运行时 JAR 加载、字节码变换和运行时 JVM 插桩。它可以在 `DisableAttachMechanism=true` 的情况下注入到正在运行的 JVM 进程中,无需 `-javaagent` 启动参数,也无需使用 attach 机制。
|
||||
|
||||
目前支持两个平台:
|
||||
|
||||
- **Windows x64**——反射式 DLL 注入(`injector.exe` + `libinject.dll`)。
|
||||
- **Linux x64**——通过 `ptrace` 附加目标进程,再用一次远程 `dlopen` 让目标 JVM 自己加载 `libloader.so`。
|
||||
|
||||
**警告**:本项目仍处于实验阶段,不建议用于生产环境。使用风险自负。
|
||||
|
||||
> **提示**:部分杀毒软件可能将 JuiceAgent 误报为恶意软件。详情见[杀毒软件误报说明](docs/Antivirus-False-Positive.md)。
|
||||
@@ -29,7 +34,7 @@ JuiceAgent 是一个基于 JVMTI 的高级注入框架,用于运行时 JAR 加
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
@@ -44,6 +49,7 @@ JuiceAgent 是一个基于 JVMTI 的高级注入框架,用于运行时 JAR 加
|
||||
- [特性](#特性)
|
||||
- [项目结构](#项目结构)
|
||||
- [快速开始](#快速开始)
|
||||
- [Linux 支持](#linux-支持)
|
||||
- [JuiceAgent API](#juiceagent-api)
|
||||
- [示例](#示例)
|
||||
- [如何构建](#如何构建)
|
||||
@@ -73,6 +79,8 @@ JuiceAgent 是 [JuiceAgent-API](https://github.com/xiaozhou233/JuiceAgent-API)
|
||||
|
||||
`JuiceAgent-API` jar 内嵌于原生二进制中,无需单独下载。
|
||||
|
||||
Linux 上的流程与此相同,只有注入这一步不同。注入器通过 `ptrace` 附加到目标进程,保存线程状态,发起一次远程 `dlopen` 让 JVM 在自身进程内加载 `libloader.so`(无需 `LD_PRELOAD`,也无需 `-javaagent`)。随后 `libloader.so` 从 ELF constructor 启动,解析运行时目录(`JuiceAgent_ConfigPath`,默认 `$HOME/.juiceagent`),之后与 Windows 加载器完全一致地驱动 agent。详见 [Linux 支持](#linux-支持)。
|
||||
|
||||
## 特性
|
||||
|
||||
- 将外部 JAR 加载到 Bootstrap 或 System ClassLoader
|
||||
@@ -87,10 +95,10 @@ JuiceAgent 是 [JuiceAgent-API](https://github.com/xiaozhou233/JuiceAgent-API)
|
||||
|
||||
## 项目结构
|
||||
|
||||
- `src/libloader` — `libloader.dll`。注入到目标 JVM,附加 JVM、解析 `config.toml`、注入内嵌的 `JuiceAgent-API` 并引导 agent。
|
||||
- `src/libagent` — `libagent.dll`。JVMTI agent。注册回调(例如 `ClassFileLoadHook`)并实现 `JuiceAgent-API` 的原生侧。
|
||||
- `src/injector` — `injector.exe`。命令行驱动,加载 `libinject.dll` 并将 `libloader.dll` 注入到目标进程。
|
||||
- `src/libinject` — `libinject.dll`。反射式 DLL 注入器,导出原生 `inject` 函数并提供 JNI 绑定(`cn.xiaozhou233.juiceagent.injector.InjectorNative`)。
|
||||
- `src/libloader` — `libloader.dll`(Windows)/ `libloader.so`(Linux)。注入到目标 JVM,附加 JVM、解析 `config.toml`、注入内嵌的 `JuiceAgent-API` 并引导 agent。
|
||||
- `src/libagent` — `libagent.dll`(Windows)/ `libagent.so`(Linux)。JVMTI agent。注册回调(例如 `ClassFileLoadHook`)并实现 `JuiceAgent-API` 的原生侧。
|
||||
- `src/injector` — `injector.exe`(Windows)/ `injector`(Linux)。命令行驱动,将加载器注入到目标进程。
|
||||
- `src/libinject` — `libinject.dll`(仅 Windows)。反射式 DLL 注入器,导出原生 `inject` 函数并提供 JNI 绑定(`cn.xiaozhou233.juiceagent.injector.InjectorNative`)。
|
||||
|
||||
## 快速开始
|
||||
|
||||
@@ -100,6 +108,10 @@ JuiceAgent 是 [JuiceAgent-API](https://github.com/xiaozhou233/JuiceAgent-API)
|
||||
|
||||
从 [releases](https://github.com/xiaozhou233/JuiceAgent/releases) 页面下载 `JuiceAgent_vx.x.x_x64.zip`。
|
||||
|
||||
> **Linux 用户注意**:Linux 构建**不会**发布在 GitHub Release 上,请从
|
||||
> [Jenkins](https://jenkins.xiaozhou233.cn/job/JuiceAgent/) 下载,详见
|
||||
> [Linux 支持](#linux-支持)。
|
||||
|
||||
解压 ZIP 到一个目录:
|
||||
|
||||
- YourDir
|
||||
@@ -178,6 +190,57 @@ Input PID:
|
||||
|
||||
目标 JVM 将加载指定的 JAR 并执行指定的入口类和入口方法。
|
||||
|
||||
## Linux 支持
|
||||
|
||||
JuiceAgent 同样支持 Linux x64。与反射式 DLL 注入不同,Linux 注入器使用 `ptrace` 附加目标进程,然后执行一次**远程 `dlopen`**:保存线程状态,让目标进程调用 `dlopen("libloader.so", RTLD_NOW)`,恢复状态并 detach。这样由 JVM 自己加载加载器——无需 `LD_PRELOAD`,也无需 `-javaagent`——其后的流程与 Windows 完全一致。
|
||||
|
||||
### 下载
|
||||
|
||||
Linux 构建**不会**发布在 GitHub Release 上,请从 Jenkins 任务下载最新一次成功的构建:
|
||||
|
||||
```text
|
||||
https://jenkins.xiaozhou233.cn/job/JuiceAgent/
|
||||
```
|
||||
|
||||
选择最近一次成功的构建,下载其产物(`JuiceAgent_vX.Y.Z_x64_linux.tar.gz`),从中解出
|
||||
`injector`、`libloader.so` 和 `libagent.so`。
|
||||
|
||||
### 组件
|
||||
|
||||
- `libloader.so` —— 加载进目标 JVM,从 ELF constructor 启动。
|
||||
- `libagent.so` —— JVMTI agent。在 Linux 上它是 `JuiceAgentNativeLibraryPath` 的默认值(而不是 `libagent.dll`)。
|
||||
- `injector` —— 附加到目标 PID 并执行远程 `dlopen`。
|
||||
|
||||
### 配置位置
|
||||
|
||||
Linux 上加载器**不会**在当前工作目录中查找配置,而是按以下顺序确定运行时目录:
|
||||
|
||||
1. `JuiceAgent_ConfigPath` —— 环境变量存在且非空时直接使用。
|
||||
2. `$HOME/.juiceagent` —— 默认值,目录不存在时会自动创建。
|
||||
|
||||
`config.toml` 从该目录读取,配置结构(schema)与 Windows 完全一致,相对路径(`JarPath`、`InjectionDir` 等)也以该目录为基准解析。典型目录结构:
|
||||
|
||||
```text
|
||||
~/.juiceagent/
|
||||
├── config.toml
|
||||
├── MyCustomJar.jar
|
||||
└── injection/
|
||||
└── Dependencies.jar
|
||||
```
|
||||
|
||||
如需指定其他目录:
|
||||
|
||||
```bash
|
||||
export JuiceAgent_ConfigPath=/opt/juiceagent
|
||||
```
|
||||
|
||||
### 环境要求
|
||||
|
||||
- 以与目标 JVM 相同的用户(或 `root`)运行注入器,并确保允许 `ptrace`。如果注入失败并返回 `EPERM`,请检查 `/proc/sys/kernel/yama/ptrace_scope`。
|
||||
- 目标 JVM 与加载器都必须是 x64。
|
||||
|
||||
> **注意**:Linux 注入器二进制目前尚未开源。本仓库中的 `injector` 目标只是一个占位程序,仅打印提示信息;加载器与 agent 完全开源,可直接从本仓库构建。
|
||||
|
||||
## JuiceAgent API
|
||||
|
||||
以下原生函数通过 `cn.xiaozhou233.juiceagent.api.JuiceAgent` 类暴露给 Java(Java API 定义见 [JuiceAgent-API](https://github.com/xiaozhou233/JuiceAgent-API) 项目):
|
||||
@@ -207,7 +270,7 @@ Input PID:
|
||||
### 环境要求
|
||||
|
||||
- Java 8+
|
||||
- MinGW
|
||||
- MinGW-w64(Windows)或 GCC/Clang(Linux)
|
||||
- CMake 3.15+
|
||||
- Ninja
|
||||
|
||||
@@ -231,7 +294,7 @@ cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
|
||||
cmake --build build
|
||||
```
|
||||
|
||||
生成的二进制文件将放在 `build/bin` 中。
|
||||
生成的二进制文件将放在 `build/bin` 中。Linux 下会生成 `libloader.so`、`libagent.so` 和 `injector`;Windows 下为对应的 `.dll` / `.exe`。
|
||||
|
||||
## 完整免责声明
|
||||
|
||||
|
||||
Executable
+63
@@ -0,0 +1,63 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Linux counterpart of script/package.bat.
|
||||
#
|
||||
# Packs the Linux build in build/bin into
|
||||
# dist/JuiceAgent_v<major>.<minor>.<patch>_x64_linux.tar.gz
|
||||
#
|
||||
# Usage: ./script/package.sh
|
||||
#
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_DIR="$(cd -- "${SCRIPT_DIR}/.." && pwd)"
|
||||
|
||||
VERSION_FILE="${PROJECT_DIR}/Version.txt"
|
||||
BIN_DIR="${PROJECT_DIR}/build/bin"
|
||||
OUTPUT_DIR="${PROJECT_DIR}/dist"
|
||||
|
||||
# Read one "Key = value" entry from Version.txt.
|
||||
read_version_key() {
|
||||
local key="$1"
|
||||
sed -n -E "s/^[[:space:]]*${key}[[:space:]]*=[[:space:]]*([0-9]+)[[:space:]]*$/\1/p" \
|
||||
"${VERSION_FILE}" | head -n 1
|
||||
}
|
||||
|
||||
if [[ ! -f "${VERSION_FILE}" ]]; then
|
||||
echo "[ERROR] Version.txt not found: ${VERSION_FILE}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VERSION_MAJOR="$(read_version_key Major)"
|
||||
VERSION_MINOR="$(read_version_key Minor)"
|
||||
VERSION_PATCH="$(read_version_key Patch)"
|
||||
|
||||
if [[ -z "${VERSION_MAJOR}" || -z "${VERSION_MINOR}" || -z "${VERSION_PATCH}" ]]; then
|
||||
echo "[ERROR] Invalid Version.txt: Major, Minor and Patch are required" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Linux build artifacts (there is no libinject on this platform).
|
||||
PACKAGE_FILES=(
|
||||
injector
|
||||
libloader.so
|
||||
libagent.so
|
||||
)
|
||||
|
||||
for file_name in "${PACKAGE_FILES[@]}"; do
|
||||
if [[ ! -f "${BIN_DIR}/${file_name}" ]]; then
|
||||
echo "[ERROR] Required file not found: ${BIN_DIR}/${file_name}" >&2
|
||||
echo " Build first: cmake --preset release && cmake --build build" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
mkdir -p "${OUTPUT_DIR}"
|
||||
|
||||
OUTPUT_FILE="${OUTPUT_DIR}/JuiceAgent_v${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}_x64_linux.tar.gz"
|
||||
|
||||
rm -f "${OUTPUT_FILE}"
|
||||
|
||||
tar -czf "${OUTPUT_FILE}" -C "${BIN_DIR}" "${PACKAGE_FILES[@]}"
|
||||
|
||||
echo "[SUCCESS] Package created: ${OUTPUT_FILE}"
|
||||
Reference in new issue
Block a user