Skip to content

alex-testlab/WLSCopy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WSL Management Tool

A modular desktop GUI tool for managing WSL distributions with copy/migration and management features.

Modules

  • wsl_operations.py: WSL command operations (shutdown, export, unregister, import, set-default, start, terminate)
  • gui.py: GUI interface and logic with notebook tabs for copy and management
  • utils.py: Common utilities and validation functions
  • main.py: Application entry point

Features

Copy/Migration Workflow

Copy an existing WSL distribution through a complete workflow:

  1. Shutdown the source distribution
  2. Export it to a tar file
  3. Unregister the source distribution
  4. Import the tar file as a new distribution
  5. Set the new distribution as default

Management Features

Manage all installed WSL distributions:

  • View all available distributions
  • Start a distribution
  • Stop (shutdown) a distribution
  • Terminate a distribution forcefully
  • Delete (unregister) a distribution with confirmation
  • Set a distribution as default

Requirements

  • Windows with WSL installed
  • Python 3.x
  • tkinter (usually included with Python)

Installation

  1. Ensure WSL is installed on your Windows system
  2. Install Python 3.x
  3. Install dependencies: pip install tkinter (usually pre-installed)

Usage

Running the Application

python src/main.py

Copy Distribution Tab

  1. Select a source WSL distribution from the dropdown
  2. Enter a name for the new distribution
  3. Choose an export/import directory using the Browse button
  4. Click "Copy WSL Distribution" to start the process
  5. Monitor progress in the progress bar
  6. The new distribution will be created and set as default

Manage Distributions Tab

  1. View the list of available WSL distributions
  2. Click "Refresh" to update the list
  3. Select a distribution from the list
  4. Use the buttons to perform actions:
    • Start: Launch the selected distribution
    • Stop: Shutdown the selected distribution gracefully
    • Terminate: Forcefully terminate the selected distribution
    • Delete: Unregister the selected distribution (requires confirmation)
    • Set Default: Make the selected distribution the default

Validation and Error Handling

  • Distribution names must contain only letters, numbers, hyphens, and underscores
  • Prevents creating distributions with existing names
  • Validates directory existence and write permissions
  • Provides user-friendly error messages for all operations
  • Confirmation dialogs for destructive operations

Testing

Run tests with pytest:

pytest tests/

Architecture

The application follows a modular design:

  • wsl_operations.py: Pure functions for WSL command execution
  • gui.py: GUI logic separated from business logic
  • utils.py: Shared validation and utility functions
  • main.py: Simple entry point

This separation ensures maintainability and testability.

About

Move the WSL virtual machine to any directory, including simple virtual machine state management.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages