fix(installer): refresh rust windows install kit
This commit is contained in:
@@ -10,7 +10,8 @@ use sha2::{Digest, Sha256};
|
||||
|
||||
const DEFAULT_KIT_DIR: &str = "install-kit-awindows-20260427-211240";
|
||||
const MANIFEST_NAME: &str = "MANIFEST.txt";
|
||||
const ALLOWED_KIT_ONLY_FILES: &[&str] = &["README-INSTALL-KIT.txt"];
|
||||
const ALLOWED_KIT_ONLY_FILES: &[&str] =
|
||||
&["README-INSTALL-KIT.txt", "windows/aw-windows-telemetry.exe"];
|
||||
const ALLOWED_KIT_ONLY_PREFIXES: &[&str] = &["server-configs-"];
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
|
||||
@@ -10,10 +10,15 @@ use sha2::{Digest, Sha256};
|
||||
use zip::write::SimpleFileOptions;
|
||||
|
||||
const KIT_DIR: &str = "install-kit-awindows-20260427-211240";
|
||||
const README: &str = r#"ActivityWatch DetMir Windows Install Kit
|
||||
const WINDOWS_TELEMETRY_EXE_SOURCE: &str =
|
||||
"adk-rust/target/x86_64-pc-windows-gnu/release/aw-windows-telemetry.exe";
|
||||
const WINDOWS_TELEMETRY_EXE_DEST: &str = "windows/aw-windows-telemetry.exe";
|
||||
|
||||
const README: &str = r#"AWatch-rus Windows Install Kit
|
||||
|
||||
Includes:
|
||||
- windows/* (deploy scripts, collectors, common module, configs/examples)
|
||||
- windows/aw-windows-telemetry.exe (Rust Windows telemetry runtime)
|
||||
- ansible/* (Windows and AW server playbooks, examples, inventory, tasks)
|
||||
- aw-server/* (server installer, health orchestrator, RU patch loader, host groups, default settings)
|
||||
- scripts/* (install-kit rebuild/validation, quality gates, browser/web smoke checks)
|
||||
@@ -138,6 +143,12 @@ fn rebuild(root: &Path) -> Result<()> {
|
||||
{
|
||||
copy_file(root, &kit, rel)?;
|
||||
}
|
||||
copy_file_as(
|
||||
root,
|
||||
&kit,
|
||||
WINDOWS_TELEMETRY_EXE_SOURCE,
|
||||
WINDOWS_TELEMETRY_EXE_DEST,
|
||||
)?;
|
||||
|
||||
write_file_replace(&kit.join("README-INSTALL-KIT.txt"), README.as_bytes())
|
||||
.with_context(|| format!("write {}", kit.join("README-INSTALL-KIT.txt").display()))?;
|
||||
@@ -166,8 +177,12 @@ fn remove_server_config_dirs(kit: &Path) -> Result<()> {
|
||||
}
|
||||
|
||||
fn copy_file(root: &Path, kit: &Path, rel: &str) -> Result<()> {
|
||||
let src = root.join(rel);
|
||||
let dest = kit.join(rel);
|
||||
copy_file_as(root, kit, rel, rel)
|
||||
}
|
||||
|
||||
fn copy_file_as(root: &Path, kit: &Path, src_rel: &str, dest_rel: &str) -> Result<()> {
|
||||
let src = root.join(src_rel);
|
||||
let dest = kit.join(dest_rel);
|
||||
fs::create_dir_all(dest.parent().context("destination parent")?)
|
||||
.with_context(|| format!("create parent for {}", dest.display()))?;
|
||||
let bytes = fs::read(&src).with_context(|| format!("read {}", src.display()))?;
|
||||
|
||||
@@ -16,6 +16,7 @@ const MANIFEST_NAME: &str = "MANIFEST.txt";
|
||||
const REQUIRED_RELATIVE_FILES: &[&str] = &[
|
||||
"MANIFEST.txt",
|
||||
"README-INSTALL-KIT.txt",
|
||||
"windows/aw-windows-telemetry.exe",
|
||||
"windows/deploy-ensemble.ps1",
|
||||
"windows/validate-deployment.ps1",
|
||||
"ansible/deploy_aw_windows.yml",
|
||||
@@ -473,8 +474,8 @@ mod tests {
|
||||
);
|
||||
let report = validate(&cfg);
|
||||
assert!(report.ok, "{report:#?}");
|
||||
assert_eq!(report.manifest_completeness.tracked_files, 9);
|
||||
assert_eq!(report.archive_composition.files, 10);
|
||||
assert_eq!(report.manifest_completeness.tracked_files, 10);
|
||||
assert_eq!(report.archive_composition.files, 11);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -521,6 +522,7 @@ mod tests {
|
||||
let kit = root.join(DEFAULT_KIT_DIR);
|
||||
for rel in [
|
||||
"windows/deploy-ensemble.ps1",
|
||||
"windows/aw-windows-telemetry.exe",
|
||||
"windows/validate-deployment.ps1",
|
||||
"ansible/deploy_aw_windows.yml",
|
||||
"aw-server/install_aw_server.sh",
|
||||
@@ -537,6 +539,7 @@ mod tests {
|
||||
let files = [
|
||||
"README-INSTALL-KIT.txt",
|
||||
"windows/deploy-ensemble.ps1",
|
||||
"windows/aw-windows-telemetry.exe",
|
||||
"windows/validate-deployment.ps1",
|
||||
"ansible/deploy_aw_windows.yml",
|
||||
"aw-server/install_aw_server.sh",
|
||||
@@ -561,6 +564,7 @@ mod tests {
|
||||
("README-INSTALL-KIT.txt", b"readme".as_slice()),
|
||||
("MANIFEST.txt", b"manifest".as_slice()),
|
||||
("windows/deploy-ensemble.ps1", b"deploy".as_slice()),
|
||||
("windows/aw-windows-telemetry.exe", b"rust-exe".as_slice()),
|
||||
("windows/validate-deployment.ps1", b"validate".as_slice()),
|
||||
("ansible/deploy_aw_windows.yml", b"ansible".as_slice()),
|
||||
("aw-server/install_aw_server.sh", b"server".as_slice()),
|
||||
|
||||
@@ -14,8 +14,11 @@ const REQUIRED_FILES: &[&str] = &[
|
||||
"windows/AWatchRusCollectorGuardService.cs",
|
||||
"windows/aw-collector-guard.ps1",
|
||||
"windows/install-collector-guard-service.ps1",
|
||||
"windows/aw-windows-telemetry.exe",
|
||||
"windows/dlp-policy.native-cross-os.example.json",
|
||||
];
|
||||
const WINDOWS_TELEMETRY_EXE_SOURCE: &str =
|
||||
"adk-rust/target/x86_64-pc-windows-gnu/release/aw-windows-telemetry.exe";
|
||||
const GUARD_MARKER: &str = "collector guard self-test OK";
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
@@ -145,7 +148,11 @@ fn verify(root: &Path, installer: &Path, wineprefix: &Path) -> Report {
|
||||
let mut checked = Vec::new();
|
||||
for rel in REQUIRED_FILES {
|
||||
let extracted = install_dir.join(rel);
|
||||
let repo = root.join(rel);
|
||||
let repo = if *rel == "windows/aw-windows-telemetry.exe" {
|
||||
root.join(WINDOWS_TELEMETRY_EXE_SOURCE)
|
||||
} else {
|
||||
root.join(rel)
|
||||
};
|
||||
if !extracted.is_file() {
|
||||
errors.push(format!("Missing extracted file: {rel}"));
|
||||
continue;
|
||||
|
||||
@@ -9,7 +9,10 @@
|
||||
aw_windows_repo_root: "{{ playbook_dir | dirname }}"
|
||||
aw_windows_deploy_root: "C:\\Program Files\\AWatch-rus"
|
||||
aw_windows_rust_target_root: "{{ lookup('env', 'CARGO_TARGET_DIR') | default('/tmp/detmir-adk-rust-target', true) }}"
|
||||
aw_windows_telemetry_exe_source: "{{ aw_windows_rust_target_root }}/x86_64-pc-windows-gnu/release/aw-windows-telemetry.exe"
|
||||
aw_windows_telemetry_exe_source_candidates:
|
||||
- "{{ aw_windows_repo_root }}/windows/aw-windows-telemetry.exe"
|
||||
- "{{ aw_windows_rust_target_root }}/x86_64-pc-windows-gnu/release/aw-windows-telemetry.exe"
|
||||
aw_windows_telemetry_exe_source: ""
|
||||
aw_windows_server_scheme: "http"
|
||||
aw_windows_server_port: 5600
|
||||
aw_windows_package_version: "v0.13.2"
|
||||
@@ -198,9 +201,41 @@
|
||||
- web-category-rules.example.json
|
||||
- dlp-policy.example.json
|
||||
|
||||
- name: Проверить кандидаты Rust Windows telemetry binary
|
||||
ansible.builtin.stat:
|
||||
path: "{{ item }}"
|
||||
loop: "{{ aw_windows_telemetry_exe_source_candidates }}"
|
||||
delegate_to: localhost
|
||||
become: false
|
||||
register: aw_windows_telemetry_exe_candidate_stats
|
||||
|
||||
- name: Выбрать Rust Windows telemetry binary
|
||||
ansible.builtin.set_fact:
|
||||
aw_windows_telemetry_exe_source_effective: >-
|
||||
{{
|
||||
aw_windows_telemetry_exe_source
|
||||
if (aw_windows_telemetry_exe_source | string | length) > 0
|
||||
else (
|
||||
aw_windows_telemetry_exe_candidate_stats.results
|
||||
| selectattr('stat.exists')
|
||||
| map(attribute='item')
|
||||
| list
|
||||
| first
|
||||
| default('')
|
||||
)
|
||||
}}
|
||||
|
||||
- name: Проверить наличие Rust Windows telemetry binary
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
Не найден aw-windows-telemetry.exe. Соберите его командой:
|
||||
cargo build --release --target x86_64-pc-windows-gnu -p aw-windows-telemetry
|
||||
или используйте актуальный install-kit с windows/aw-windows-telemetry.exe.
|
||||
when: aw_windows_telemetry_exe_source_effective | length == 0
|
||||
|
||||
- name: Загрузить Rust Windows telemetry binary
|
||||
ansible.windows.win_copy:
|
||||
src: "{{ aw_windows_telemetry_exe_source }}"
|
||||
src: "{{ aw_windows_telemetry_exe_source_effective }}"
|
||||
dest: "{{ aw_windows_deploy_root }}\\windows\\aw-windows-telemetry.exe"
|
||||
|
||||
- name: Нормализовать кодировку PowerShell файлов (UTF-8 BOM для Windows PowerShell)
|
||||
|
||||
@@ -67,7 +67,7 @@ cyclonedx = {
|
||||
"timestamp": generated_at,
|
||||
"component": {
|
||||
"type": "application",
|
||||
"name": "DetMir AWatch-rus",
|
||||
"name": "AWatch-rus",
|
||||
"version": "release-readiness-v0.2",
|
||||
"bom-ref": "pkg:generic/detmir-awatch-rus@release-readiness-v0.2",
|
||||
},
|
||||
@@ -83,7 +83,7 @@ spdx = {
|
||||
"spdxVersion": "SPDX-2.3",
|
||||
"dataLicense": "CC0-1.0",
|
||||
"SPDXID": "SPDXRef-DOCUMENT",
|
||||
"name": "DetMir AWatch-rus release-readiness-v0.2 Rust SBOM",
|
||||
"name": "AWatch-rus release-readiness-v0.2 Rust SBOM",
|
||||
"documentNamespace": f"https://github.com/igor04091968/AWatch-rus/sbom/{commit}",
|
||||
"creationInfo": {
|
||||
"created": generated_at,
|
||||
|
||||
@@ -50,6 +50,7 @@ required_files=(
|
||||
windows/AWatchRusCollectorGuardService.cs
|
||||
windows/aw-collector-guard.ps1
|
||||
windows/install-collector-guard-service.ps1
|
||||
windows/aw-windows-telemetry.exe
|
||||
windows/dlp-policy.native-cross-os.example.json
|
||||
)
|
||||
|
||||
@@ -59,7 +60,11 @@ for rel in "${required_files[@]}"; do
|
||||
echo "Missing extracted file: $rel" >&2
|
||||
exit 1
|
||||
fi
|
||||
if ! cmp -s "$rel" "$extracted"; then
|
||||
repo_rel="$rel"
|
||||
if [[ "$rel" == "windows/aw-windows-telemetry.exe" ]]; then
|
||||
repo_rel="adk-rust/target/x86_64-pc-windows-gnu/release/aw-windows-telemetry.exe"
|
||||
fi
|
||||
if ! cmp -s "$repo_rel" "$extracted"; then
|
||||
echo "Extracted file differs from repo: $rel" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -47,6 +47,7 @@ Source: "..\..\deploy-ensemble.ps1"; DestDir: "{app}\windows"; Flags: ignorevers
|
||||
Source: "..\..\AWatchRusCollectorGuardService.cs"; DestDir: "{app}\windows"; Flags: ignoreversion
|
||||
Source: "..\..\aw-collector-guard.ps1"; DestDir: "{app}\windows"; Flags: ignoreversion
|
||||
Source: "..\..\install-collector-guard-service.ps1"; DestDir: "{app}\windows"; Flags: ignoreversion
|
||||
Source: "..\..\..\adk-rust\target\x86_64-pc-windows-gnu\release\aw-windows-telemetry.exe"; DestDir: "{app}\windows"; Flags: ignoreversion
|
||||
Source: "..\..\hardening-recovery.ps1"; DestDir: "{app}\windows"; Flags: ignoreversion
|
||||
Source: "..\..\validate-deployment.ps1"; DestDir: "{app}\windows"; Flags: ignoreversion
|
||||
Source: "..\..\migrate-awatch-rus-paths.ps1"; DestDir: "{app}\windows"; Flags: ignoreversion
|
||||
|
||||
Binary file not shown.
@@ -11,6 +11,12 @@
|
||||
|
||||
## Compile
|
||||
|
||||
Build the Rust Windows runtime first:
|
||||
|
||||
```sh
|
||||
cargo build --release --target x86_64-pc-windows-gnu -p aw-windows-telemetry
|
||||
```
|
||||
|
||||
From this folder:
|
||||
|
||||
```bat
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
- `windows/AWatchRusCollectorGuardService.cs`
|
||||
- `windows/aw-collector-guard.ps1`
|
||||
- `windows/install-collector-guard-service.ps1`
|
||||
- `windows/aw-windows-telemetry.exe`
|
||||
- `windows/hardening-recovery.ps1`
|
||||
- `windows/validate-deployment.ps1`
|
||||
- `windows/migrate-awatch-rus-paths.ps1`
|
||||
|
||||
Reference in New Issue
Block a user