fix(installer): refresh rust windows install kit

This commit is contained in:
igor04091968
2026-06-06 14:06:04 +03:00
parent bff85094ec
commit f3fd655ada
11 changed files with 89 additions and 14 deletions
@@ -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;