pre_checks

Path: /preinstall_components/pre_checks.py

Overview

This script performs a series of pre-installation checks to ensure the system is ready for Talon installation, including disabling Windows Defender, verifying Windows edition, testing network connectivity, checking filesystem write permissions, and running a PowerShell test script.

Purpose & Use Cases

Validate that the host system meets all prerequisites before installing Talon.

Provide clear, user-friendly error messages and guidance when a check fails, allowing continuation or troubleshooting.

Dependencies

utilities.util_defender_check

utilities.util_windows_check

Configuration & Parameters

Parameter Type Description Default
TEST_SCRIPT_URL string URL used to download the dry-run PowerShell test script https://code.ravendevteam.org/talon/dry_run_test.ps1

Usage Example

python pre_checks.py

Behavior & Implementation

When executed, pre_checks.py sequentially:

1. Calls ensure_defender_disabled() to disable Windows Defender if running.
2. Runs check_windows_11_home_or_pro() to confirm a supported Windows edition.
3. Executes a HEAD request to the Raven Dev Team code server to verify network reachability.
4. Attempts to create and write to a talon directory under the system TEMP path to ensure write permissions.
5. Downloads a PowerShell script via download_file() and runs it, checking for a “Hello, World!” response.

Side effects include creating temporary directories/files, showing error popups, and logging outputs.

Error Handling

Each check catches exceptions, logs an error via logger.error(), and displays an error popup with show_error_popup(), allowing the user to continue or address the issue manually.

Security Considerations

The script downloads and runs a PowerShell script with -ExecutionPolicy Bypass, so ensure TEST_SCRIPT_URL points to a trusted source. All HTTPS requests use a custom SSL context to validate certificates. Disabling Windows Defender requires administrative privileges.

Logging

Uses utilities.util_logger.logger at ERROR level for failures and DEBUG level for verbose outputs such as the PowerShell script’s stdout (e.g., “Test script output: …”).

Testing & Validation

Run pre_checks.py on a test machine; simulate failures by disabling network access, removing TEMP directory write permissions, or blocking PowerShell execution. Verify error popups appear and logs are recorded.

Author

Author: Raven Development Team