refactor(detmir): retire python runtime paths
This commit is contained in:
@@ -3,6 +3,19 @@ set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
|
||||
rust_candidates=(
|
||||
"${AW_BROWSER_SMOKE_RUST:-}"
|
||||
"${CARGO_TARGET_DIR:-}/release/aw-browser-smoke"
|
||||
"$ROOT_DIR/adk-rust/target/release/aw-browser-smoke"
|
||||
"/usr/local/bin/aw-browser-smoke"
|
||||
)
|
||||
|
||||
for rust_bin in "${rust_candidates[@]}"; do
|
||||
if [[ -n "$rust_bin" && -x "$rust_bin" ]]; then
|
||||
exec "$rust_bin" --root "$ROOT_DIR" -- "$@"
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ -z "${NODE_PATH:-}" && -d /home/igor/.agents/skills/playwright/node_modules ]]; then
|
||||
export NODE_PATH=/home/igor/.agents/skills/playwright/node_modules
|
||||
fi
|
||||
|
||||
@@ -24,59 +24,5 @@ for candidate in "${rust_candidates[@]}"; do
|
||||
fi
|
||||
done
|
||||
|
||||
python3 - <<'PY'
|
||||
from pathlib import Path
|
||||
import hashlib
|
||||
import sys
|
||||
|
||||
root=Path('.')
|
||||
kit=Path('install-kit-awindows-20260427-211240')
|
||||
if not kit.exists():
|
||||
raise SystemExit('Install kit directory not found')
|
||||
|
||||
def sha(path: Path) -> str:
|
||||
return hashlib.sha256(path.read_bytes()).hexdigest()
|
||||
|
||||
all_compared=[]
|
||||
mismatches=[]
|
||||
missing_in_repo=[]
|
||||
allowed_kit_only_prefixes=('server-configs-' ,)
|
||||
allowed_kit_only_files={'README-INSTALL-KIT.txt'}
|
||||
|
||||
for kp in sorted(p for p in kit.rglob('*') if p.is_file() and p.name!='MANIFEST.txt'):
|
||||
rel=kp.relative_to(kit)
|
||||
rp=root/rel
|
||||
if not rp.exists():
|
||||
rel_str=str(rel)
|
||||
if rel_str in allowed_kit_only_files or rel_str.startswith(allowed_kit_only_prefixes):
|
||||
continue
|
||||
missing_in_repo.append(str(rel))
|
||||
continue
|
||||
all_compared.append(str(rel))
|
||||
if sha(kp)!=sha(rp):
|
||||
mismatches.append(str(rel))
|
||||
|
||||
ps_mismatches=[
|
||||
p for p in mismatches
|
||||
if p.startswith('windows/') and p.endswith(('.ps1', '.psm1', '.psd1'))
|
||||
]
|
||||
|
||||
print(f'Compared files: {len(all_compared)}')
|
||||
print(f'Missing in repo: {len(missing_in_repo)}')
|
||||
print(f'Mismatched content: {len(mismatches)}')
|
||||
if missing_in_repo:
|
||||
print('--- Missing in repo ---')
|
||||
for p in missing_in_repo:
|
||||
print(p)
|
||||
if mismatches:
|
||||
print('--- Mismatches ---')
|
||||
for p in mismatches:
|
||||
print(p)
|
||||
print(f'PowerShell mismatches: {len(ps_mismatches)}')
|
||||
if ps_mismatches:
|
||||
print('--- PowerShell mismatches ---')
|
||||
for p in ps_mismatches:
|
||||
print(p)
|
||||
if missing_in_repo or mismatches:
|
||||
sys.exit(1)
|
||||
PY
|
||||
echo "ERROR: Rust checker not found. Build it with: cd '$ROOT_DIR/adk-rust' && cargo build --release -p check-install-kit-vs-repo" >&2
|
||||
exit 127
|
||||
|
||||
@@ -23,150 +23,5 @@ for candidate in "${rust_candidates[@]}"; do
|
||||
fi
|
||||
done
|
||||
|
||||
KIT_DIR="install-kit-awindows-20260427-211240"
|
||||
ZIP_ARCHIVE="${KIT_DIR}.zip"
|
||||
TAR_ARCHIVE="${KIT_DIR}.tar.gz"
|
||||
SERVER_CONFIG_DIR="${KIT_DIR}/server-configs-192.168.100.18"
|
||||
OLD_SERVER_CONFIG_DIR="${KIT_DIR}/server-configs-192.168.100.21"
|
||||
TMP_SERVER_CONFIG_DIR="$(mktemp -d)"
|
||||
trap 'rm -rf "$TMP_SERVER_CONFIG_DIR"' EXIT
|
||||
|
||||
copy_file() {
|
||||
local src="$1"
|
||||
local dest="$2"
|
||||
mkdir -p "$(dirname "$dest")"
|
||||
cp "$src" "$dest"
|
||||
}
|
||||
|
||||
sync_tree() {
|
||||
local base="$1"
|
||||
shift
|
||||
for rel in "$@"; do
|
||||
copy_file "$rel" "${KIT_DIR}/${rel}"
|
||||
done
|
||||
}
|
||||
|
||||
if [[ -d "$OLD_SERVER_CONFIG_DIR" ]]; then
|
||||
cp "$OLD_SERVER_CONFIG_DIR"/*.deployment-config.json "$TMP_SERVER_CONFIG_DIR"/
|
||||
fi
|
||||
if [[ -d "$SERVER_CONFIG_DIR" ]]; then
|
||||
cp "$SERVER_CONFIG_DIR"/*.deployment-config.json "$TMP_SERVER_CONFIG_DIR"/
|
||||
fi
|
||||
|
||||
rm -rf "${KIT_DIR}/ansible" "${KIT_DIR}/aw-server" "${KIT_DIR}/windows" "${KIT_DIR}/scripts" "${KIT_DIR}/server-configs-"*
|
||||
|
||||
ansible_files=(
|
||||
ansible/README.md
|
||||
ansible/deploy_aw_pfsense_poller.yml
|
||||
ansible/deploy_aw_server.yml
|
||||
ansible/deploy_aw_windows.yml
|
||||
ansible/group_vars/all.example.yml
|
||||
ansible/group_vars/pfsense-poller.example.yml
|
||||
ansible/group_vars/proxmox-matrix.example.yml
|
||||
ansible/group_vars/proxmox.example.yml
|
||||
ansible/group_vars/windows.example.yml
|
||||
ansible/install_full_stack.yml
|
||||
ansible/inventory.example.ini
|
||||
ansible/provision_proxmox_ct_and_deploy_aw.yml
|
||||
ansible/provision_proxmox_ct_matrix_and_deploy_aw.yml
|
||||
ansible/tasks/provision_ct_and_deploy_aw.yml
|
||||
)
|
||||
|
||||
aw_server_files=(
|
||||
aw-server/activitywatch-server.service
|
||||
aw-server/apply_webui_ru_patch.sh
|
||||
aw-server/aw-host-groups.json
|
||||
aw-server/aw-ru-patch.js
|
||||
aw-server/aw-rus-healthd.py
|
||||
aw-server/aw-rus-healthd.service
|
||||
aw-server/aw-rus-healthd.timer
|
||||
aw-server/aw-browser-smoke.service
|
||||
aw-server/aw-browser-smoke.timer
|
||||
aw-server/aw-slo-monitor.py
|
||||
aw-server/aw-slo-monitor.service
|
||||
aw-server/aw-slo-monitor.timer
|
||||
aw-server/aw-server.env.example
|
||||
aw-server/aw-sw-cleanup.js
|
||||
aw-server/aw-worktime-api.py
|
||||
aw-server/aw-worktime-api.service
|
||||
aw-server/aw-worktime-prewarm.sh
|
||||
aw-server/aw-worktime-prewarm.service
|
||||
aw-server/aw-worktime-prewarm.timer
|
||||
aw-server/aw-worktime-panel.js
|
||||
aw-server/health-check.sh
|
||||
aw-server/install_aw_server.sh
|
||||
aw-server/settings/classes-worktime.json
|
||||
aw-server/settings/views-default.json
|
||||
)
|
||||
|
||||
windows_files=(
|
||||
windows/ActivityWatch.Windows.Common.psd1
|
||||
windows/ActivityWatch.Windows.Common.psm1
|
||||
windows/browser-domains-native-collector.ps1
|
||||
windows/deploy-domain-users.ps1
|
||||
windows/deploy-ensemble.ps1
|
||||
windows/deploy-single-user.ps1
|
||||
windows/AWatchRusCollectorGuardService.cs
|
||||
windows/aw-collector-guard.ps1
|
||||
windows/install-collector-guard-service.ps1
|
||||
windows/dlp-endpoint-signals-collector.ps1
|
||||
windows/dlp-policy.example.json
|
||||
windows/dlp-policy.native-cross-os.example.json
|
||||
windows/email-outbound-collector.ps1
|
||||
windows/hardening-recovery.ps1
|
||||
windows/migrate-awatch-rus-paths.ps1
|
||||
windows/validate-deployment.ps1
|
||||
windows/web-category-rules.example.json
|
||||
windows/worktime-session-collector.ps1
|
||||
)
|
||||
|
||||
scripts_files=(
|
||||
scripts/aw-webui-browser-smoke.mjs
|
||||
scripts/aw-webui-browser-smoke.sh
|
||||
scripts/check_install_kit_vs_repo.sh
|
||||
scripts/quality-gate.sh
|
||||
scripts/rebuild_install_kit.sh
|
||||
scripts/validate_install_kit.sh
|
||||
scripts/verify_innosetup_installer.sh
|
||||
)
|
||||
|
||||
sync_tree ansible "${ansible_files[@]}"
|
||||
sync_tree aw-server "${aw_server_files[@]}"
|
||||
sync_tree windows "${windows_files[@]}"
|
||||
sync_tree scripts "${scripts_files[@]}"
|
||||
|
||||
mkdir -p "$SERVER_CONFIG_DIR"
|
||||
if compgen -G "$TMP_SERVER_CONFIG_DIR/*.deployment-config.json" >/dev/null; then
|
||||
cp "$TMP_SERVER_CONFIG_DIR"/*.deployment-config.json "$SERVER_CONFIG_DIR"/
|
||||
fi
|
||||
|
||||
cat > "${KIT_DIR}/README-INSTALL-KIT.txt" <<'EOF'
|
||||
ActivityWatch DetMir Windows Install Kit
|
||||
|
||||
Includes:
|
||||
- windows/* (deploy scripts, collectors, common module, configs/examples)
|
||||
- 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 and browser/web smoke checks)
|
||||
- server-configs-192.168.100.18/* (working Windows/RDP config snapshots)
|
||||
|
||||
Source:
|
||||
- Local project snapshot at build time.
|
||||
EOF
|
||||
|
||||
python3 - <<'PY'
|
||||
from pathlib import Path
|
||||
import hashlib
|
||||
|
||||
root = Path('install-kit-awindows-20260427-211240')
|
||||
manifest = root / 'MANIFEST.txt'
|
||||
files = sorted(p for p in root.rglob('*') if p.is_file() and p.name != 'MANIFEST.txt')
|
||||
with manifest.open('w', encoding='utf-8') as handle:
|
||||
for path in files:
|
||||
digest = hashlib.sha256(path.read_bytes()).hexdigest()
|
||||
handle.write(f"{digest} {path.as_posix()}\n")
|
||||
PY
|
||||
|
||||
rm -f "$ZIP_ARCHIVE" "$TAR_ARCHIVE"
|
||||
zip -rq "$ZIP_ARCHIVE" "$KIT_DIR"
|
||||
tar -czf "$TAR_ARCHIVE" "$KIT_DIR"
|
||||
echo "ERROR: Rust install-kit builder not found. Build it with: cd '$ROOT_DIR/adk-rust' && cargo build --release -p rebuild-install-kit" >&2
|
||||
exit 127
|
||||
|
||||
@@ -32,75 +32,5 @@ for candidate in "${rust_candidates[@]}"; do
|
||||
fi
|
||||
done
|
||||
|
||||
required_files=(
|
||||
"$MANIFEST"
|
||||
"$KIT_DIR/README-INSTALL-KIT.txt"
|
||||
"$KIT_DIR/windows/deploy-ensemble.ps1"
|
||||
"$KIT_DIR/windows/validate-deployment.ps1"
|
||||
"$KIT_DIR/ansible/deploy_aw_windows.yml"
|
||||
"$KIT_DIR/aw-server/install_aw_server.sh"
|
||||
"$KIT_DIR/scripts/rebuild_install_kit.sh"
|
||||
"$KIT_DIR/scripts/validate_install_kit.sh"
|
||||
"$KIT_DIR/scripts/check_install_kit_vs_repo.sh"
|
||||
"$KIT_DIR/scripts/quality-gate.sh"
|
||||
)
|
||||
|
||||
echo "[1/4] Required files presence"
|
||||
for file in "${required_files[@]}"; do
|
||||
[[ -f "$file" ]] || { echo "Missing required file: $file"; exit 1; }
|
||||
done
|
||||
|
||||
echo "[2/4] Manifest checksum verification"
|
||||
sha256sum -c "$MANIFEST" >/dev/null
|
||||
|
||||
echo "[3/4] Manifest completeness"
|
||||
python3 - <<'PY'
|
||||
from pathlib import Path
|
||||
import sys
|
||||
kit=Path('install-kit-awindows-20260427-211240')
|
||||
manifest=kit/'MANIFEST.txt'
|
||||
listed=[]
|
||||
for line in manifest.read_text().splitlines():
|
||||
line=line.strip()
|
||||
if not line:
|
||||
continue
|
||||
parts=line.split(' ',1)
|
||||
if len(parts)!=2:
|
||||
print(f'Invalid MANIFEST line: {line}')
|
||||
sys.exit(1)
|
||||
listed.append(parts[1])
|
||||
listed_set=set(listed)
|
||||
actual_set={str(p) for p in kit.rglob('*') if p.is_file() and p.name!='MANIFEST.txt'}
|
||||
missing=sorted(listed_set-actual_set)
|
||||
extra=sorted(actual_set-listed_set)
|
||||
if missing or extra:
|
||||
print('Missing files listed in MANIFEST:', missing)
|
||||
print('Files not listed in MANIFEST:', extra)
|
||||
sys.exit(1)
|
||||
print(f'MANIFEST complete: {len(actual_set)} files tracked')
|
||||
PY
|
||||
|
||||
echo "[4/4] Archive composition check"
|
||||
python3 - <<'PY'
|
||||
from pathlib import Path
|
||||
import tarfile, zipfile, sys
|
||||
kit_prefix='install-kit-awindows-20260427-211240/'
|
||||
zip_path=Path('install-kit-awindows-20260427-211240.zip')
|
||||
tar_path=Path('install-kit-awindows-20260427-211240.tar.gz')
|
||||
if not zip_path.exists() or not tar_path.exists():
|
||||
print('Archives not found')
|
||||
sys.exit(1)
|
||||
with zipfile.ZipFile(zip_path) as z:
|
||||
zip_files=sorted(i for i in z.namelist() if not i.endswith('/'))
|
||||
with tarfile.open(tar_path, 'r:gz') as t:
|
||||
tar_files=sorted(m.name for m in t.getmembers() if m.isfile())
|
||||
if zip_files != tar_files:
|
||||
print('ZIP and TAR contents differ')
|
||||
sys.exit(1)
|
||||
if not all(f.startswith(kit_prefix) for f in zip_files):
|
||||
print('Unexpected archive prefix layout')
|
||||
sys.exit(1)
|
||||
print(f'Archives match: {len(zip_files)} files')
|
||||
PY
|
||||
|
||||
echo "validate_install_kit: OK"
|
||||
echo "ERROR: Rust validator not found. Build it with: cd '$ROOT_DIR/adk-rust' && cargo build --release -p validate-install-kit" >&2
|
||||
exit 127
|
||||
|
||||
Reference in New Issue
Block a user