36
.dockerignore
Archivo normal
36
.dockerignore
Archivo normal
@@ -0,0 +1,36 @@
|
||||
# Ignore ISO files in the build context
|
||||
isos/
|
||||
*.iso
|
||||
|
||||
# Ignore output directory
|
||||
output/
|
||||
|
||||
# Git files
|
||||
.git
|
||||
.gitignore
|
||||
.gitattributes
|
||||
|
||||
# Documentation that's not needed in the image
|
||||
README.md
|
||||
*.md
|
||||
|
||||
# Docker files
|
||||
docker-compose.yml
|
||||
.dockerignore
|
||||
|
||||
# IDE and editor files
|
||||
.vscode/
|
||||
.idea/
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
|
||||
# OS files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# Temporary files
|
||||
*.tmp
|
||||
*.temp
|
||||
tmp/
|
||||
temp/
|
||||
24
.gitignore
vendido
Archivo normal
24
.gitignore
vendido
Archivo normal
@@ -0,0 +1,24 @@
|
||||
# ISO files
|
||||
isos/*.iso
|
||||
*.iso
|
||||
|
||||
# Output directory
|
||||
output/*
|
||||
!output/.gitkeep
|
||||
|
||||
# Docker volumes
|
||||
volumes/
|
||||
|
||||
# Editor files
|
||||
.vscode/
|
||||
.idea/
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
|
||||
# OS files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# Logs
|
||||
*.log
|
||||
3
.gitmodules
vendido
Archivo normal
3
.gitmodules
vendido
Archivo normal
@@ -0,0 +1,3 @@
|
||||
[submodule "WoeUSB"]
|
||||
path = WoeUSB
|
||||
url = https://github.com/WoeUSB/WoeUSB.git
|
||||
56
Dockerfile
Archivo normal
56
Dockerfile
Archivo normal
@@ -0,0 +1,56 @@
|
||||
FROM ubuntu:22.04
|
||||
|
||||
# Metadata
|
||||
LABEL maintainer="WoeUSB Docker Project"
|
||||
LABEL description="WoeUSB - Microsoft Windows USB installation media preparer for GNU+Linux"
|
||||
LABEL version="1.0"
|
||||
|
||||
# Prevent interactive prompts during package installation
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# Install all required and optional dependencies
|
||||
RUN apt-get update && \
|
||||
apt-get install -y \
|
||||
# Required dependencies
|
||||
bash \
|
||||
coreutils \
|
||||
util-linux \
|
||||
grep \
|
||||
gawk \
|
||||
findutils \
|
||||
grub-pc-bin \
|
||||
grub2-common \
|
||||
parted \
|
||||
wget \
|
||||
dosfstools \
|
||||
ntfs-3g \
|
||||
wimtools \
|
||||
# Optional dependencies
|
||||
p7zip-full \
|
||||
gettext \
|
||||
# Additional useful tools
|
||||
sudo \
|
||||
udev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Create a non-root user for running the application
|
||||
RUN useradd -m -s /bin/bash woeusb && \
|
||||
echo "woeusb ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy WoeUSB files
|
||||
COPY WoeUSB/ /app/
|
||||
|
||||
# Make the woeusb script executable
|
||||
RUN chmod +x /app/sbin/woeusb
|
||||
|
||||
# Add woeusb to PATH
|
||||
ENV PATH="/app/sbin:${PATH}"
|
||||
|
||||
# Set the default user
|
||||
USER woeusb
|
||||
|
||||
# Default command
|
||||
CMD ["/bin/bash"]
|
||||
127
QUICKSTART.md
Archivo normal
127
QUICKSTART.md
Archivo normal
@@ -0,0 +1,127 @@
|
||||
# WoeUSB Docker - Quick Start Guide
|
||||
|
||||
## 🚀 Fastest Way to Get Started
|
||||
|
||||
### Step 1: Prepare Everything
|
||||
```bash
|
||||
# Create directories
|
||||
mkdir -p isos output
|
||||
|
||||
# Copy your Windows ISO to the isos folder
|
||||
cp /path/to/your/Windows.iso isos/
|
||||
```
|
||||
|
||||
### Step 2: Build the Docker Image
|
||||
```bash
|
||||
docker-compose build
|
||||
```
|
||||
|
||||
### Step 3: Find Your USB Device
|
||||
```bash
|
||||
lsblk
|
||||
```
|
||||
Look for your USB drive (e.g., `/dev/sdb`). **Make sure you identify the correct device!**
|
||||
|
||||
### Step 4: Use the Helper Script (Easiest Method)
|
||||
|
||||
#### Interactive Mode (Recommended for Beginners)
|
||||
```bash
|
||||
./woeusb-docker.sh
|
||||
```
|
||||
|
||||
Follow the menu to:
|
||||
1. List ISO files
|
||||
2. See USB devices
|
||||
3. Build the image
|
||||
4. Create bootable USB
|
||||
|
||||
#### Command Line Mode (For Advanced Users)
|
||||
```bash
|
||||
# List available ISOs
|
||||
./woeusb-docker.sh list-isos
|
||||
|
||||
# List USB devices
|
||||
./woeusb-docker.sh list-devices
|
||||
|
||||
# Create bootable USB with FAT32
|
||||
./woeusb-docker.sh create isos/Windows10.iso /dev/sdb FAT
|
||||
|
||||
# Create bootable USB with NTFS (for large files)
|
||||
./woeusb-docker.sh create isos/Windows11.iso /dev/sdb NTFS
|
||||
```
|
||||
|
||||
### Step 5: Manual Method (Alternative)
|
||||
|
||||
If you prefer not to use the helper script:
|
||||
|
||||
```bash
|
||||
# Run interactively
|
||||
docker-compose run --rm woeusb
|
||||
|
||||
# Inside the container
|
||||
sudo woeusb --device /isos/YourWindows.iso /dev/sdb
|
||||
```
|
||||
|
||||
## ⚡ One-Liner Examples
|
||||
|
||||
### FAT32 (Most Compatible)
|
||||
```bash
|
||||
docker run -it --rm --privileged \
|
||||
-v $(pwd)/isos:/isos:ro \
|
||||
--device=/dev/sdb:/dev/sdb \
|
||||
woeusb:latest \
|
||||
sudo woeusb --device /isos/Windows10.iso /dev/sdb
|
||||
```
|
||||
|
||||
### NTFS (For Files > 4GB)
|
||||
```bash
|
||||
docker run -it --rm --privileged \
|
||||
-v $(pwd)/isos:/isos:ro \
|
||||
--device=/dev/sdb:/dev/sdb \
|
||||
woeusb:latest \
|
||||
sudo woeusb --device --target-filesystem NTFS /isos/Windows11.iso /dev/sdb
|
||||
```
|
||||
|
||||
## 🆘 Common Issues
|
||||
|
||||
### "Device busy" error
|
||||
```bash
|
||||
# Unmount the USB first
|
||||
sudo umount /dev/sdb*
|
||||
```
|
||||
|
||||
### "Permission denied"
|
||||
```bash
|
||||
# Make sure to use sudo inside the container
|
||||
sudo woeusb --device /isos/windows.iso /dev/sdb
|
||||
```
|
||||
|
||||
### Can't find USB device in container
|
||||
Edit `docker-compose.yml` and add your device:
|
||||
```yaml
|
||||
devices:
|
||||
- /dev/sdb:/dev/sdb # Your USB device
|
||||
```
|
||||
|
||||
## ⏱️ How Long Does It Take?
|
||||
|
||||
- **USB 2.0**: 20-40 minutes
|
||||
- **USB 3.0**: 10-20 minutes
|
||||
- **USB 3.1/3.2**: 5-15 minutes
|
||||
|
||||
Time varies based on ISO size and USB speed.
|
||||
|
||||
## 📝 Notes
|
||||
|
||||
- Always verify your USB device path before starting
|
||||
- The USB drive will be completely erased
|
||||
- Keep the ISO file in the `isos/` directory
|
||||
- Use NTFS if your `install.wim` file is larger than 4GB
|
||||
|
||||
## 🎯 Full Documentation
|
||||
|
||||
See [README.md](README.md) for complete documentation.
|
||||
|
||||
---
|
||||
|
||||
**Need Help?** Check the [Troubleshooting](README.md#-troubleshooting) section in the full README.
|
||||
316
README.md
Archivo normal
316
README.md
Archivo normal
@@ -0,0 +1,316 @@
|
||||
# WoeUSB Docker
|
||||
|
||||
A Docker containerized version of [WoeUSB](https://github.com/WoeUSB/WoeUSB) - A Microsoft Windows® USB installation media preparer for GNU+Linux.
|
||||
|
||||
## 📋 Table of Contents
|
||||
|
||||
- [Features](#-features)
|
||||
- [Prerequisites](#-prerequisites)
|
||||
- [Quick Start](#-quick-start)
|
||||
- [Usage](#-usage)
|
||||
- [Important Notes](#-important-notes)
|
||||
- [Troubleshooting](#-troubleshooting)
|
||||
- [License](#-license)
|
||||
|
||||
## ✨ Features
|
||||
|
||||
- **Docker containerized** - No need to install dependencies on your host system
|
||||
- **All dependencies included** - Required and optional dependencies pre-installed
|
||||
- **Easy to use** - Simple docker-compose setup
|
||||
- **Portable** - Works on any Linux system with Docker installed
|
||||
- **Isolated environment** - Keeps your host system clean
|
||||
|
||||
## 📦 Prerequisites
|
||||
|
||||
- Docker Engine 20.10 or higher
|
||||
- Docker Compose V2 (or docker-compose 1.29+)
|
||||
- A Windows ISO file
|
||||
- A USB drive (will be erased)
|
||||
- Root/sudo privileges (required for USB operations)
|
||||
|
||||
## 🚀 Quick Start
|
||||
|
||||
### 1. Clone or Download This Repository
|
||||
|
||||
```bash
|
||||
cd /path/to/docker-woeusb
|
||||
```
|
||||
|
||||
### 2. Create Required Directories
|
||||
|
||||
```bash
|
||||
mkdir -p isos output
|
||||
```
|
||||
|
||||
### 3. Place Your Windows ISO
|
||||
|
||||
Copy your Windows installation ISO file to the `isos/` directory:
|
||||
|
||||
```bash
|
||||
cp /path/to/your/windows.iso isos/
|
||||
```
|
||||
|
||||
### 4. Identify Your USB Device
|
||||
|
||||
**⚠️ WARNING: The target device will be completely erased!**
|
||||
|
||||
Find your USB device:
|
||||
|
||||
```bash
|
||||
lsblk
|
||||
# or
|
||||
sudo fdisk -l
|
||||
```
|
||||
|
||||
Look for your USB drive (e.g., `/dev/sdb`, `/dev/sdc`). Make sure you identify the correct device!
|
||||
|
||||
### 5. Update docker-compose.yml
|
||||
|
||||
Edit `docker-compose.yml` and uncomment/add your USB device under the `devices` section:
|
||||
|
||||
```yaml
|
||||
devices:
|
||||
- /dev/sdb:/dev/sdb # Replace sdb with your actual USB device
|
||||
```
|
||||
|
||||
### 6. Build the Docker Image
|
||||
|
||||
```bash
|
||||
docker-compose build
|
||||
```
|
||||
|
||||
### 7. Run the Container
|
||||
|
||||
```bash
|
||||
docker-compose run --rm woeusb
|
||||
```
|
||||
|
||||
## 🔧 Usage
|
||||
|
||||
Once inside the container, you can use WoeUSB with the following syntax:
|
||||
|
||||
### Basic Syntax
|
||||
|
||||
```bash
|
||||
sudo woeusb [options] <source> <target>
|
||||
```
|
||||
|
||||
### Method 1: Device Mode (Recommended)
|
||||
|
||||
Creates a bootable USB drive by formatting the entire device:
|
||||
|
||||
```bash
|
||||
sudo woeusb --device /isos/windows.iso /dev/sdb
|
||||
```
|
||||
|
||||
**Parameters:**
|
||||
- `/isos/windows.iso` - Path to your Windows ISO file
|
||||
- `/dev/sdb` - Your USB device (replace with actual device)
|
||||
|
||||
### Method 2: Partition Mode
|
||||
|
||||
Creates bootable media on an existing partition:
|
||||
|
||||
```bash
|
||||
sudo woeusb --partition /isos/windows.iso /dev/sdb1
|
||||
```
|
||||
|
||||
### Common Options
|
||||
|
||||
```bash
|
||||
# Show help
|
||||
woeusb --help
|
||||
|
||||
# Use FAT32 filesystem (default)
|
||||
sudo woeusb --device --target-filesystem FAT /isos/windows.iso /dev/sdb
|
||||
|
||||
# Use NTFS filesystem (for files > 4GB)
|
||||
sudo woeusb --device --target-filesystem NTFS /isos/windows.iso /dev/sdb
|
||||
|
||||
# Verbose output
|
||||
sudo woeusb --device -v /isos/windows.iso /dev/sdb
|
||||
```
|
||||
|
||||
### Example Session
|
||||
|
||||
```bash
|
||||
# Start the container
|
||||
docker-compose run --rm woeusb
|
||||
|
||||
# Inside the container, list available ISOs
|
||||
ls -lh /isos
|
||||
|
||||
# Check USB device
|
||||
lsblk
|
||||
|
||||
# Create bootable USB
|
||||
sudo woeusb --device /isos/Windows10.iso /dev/sdb
|
||||
|
||||
# Exit container when done
|
||||
exit
|
||||
```
|
||||
|
||||
## ⚠️ Important Notes
|
||||
|
||||
### Security Considerations
|
||||
|
||||
- The container runs in **privileged mode** to access USB devices
|
||||
- The container has **full access to specified devices**
|
||||
- Always double-check the target device before proceeding
|
||||
- Data on the target USB drive will be **completely erased**
|
||||
|
||||
### Device Access
|
||||
|
||||
- You must specify USB devices in `docker-compose.yml` before starting
|
||||
- Devices must be added to the `devices` section under the service
|
||||
- You can add multiple devices if needed:
|
||||
|
||||
```yaml
|
||||
devices:
|
||||
- /dev/sdb:/dev/sdb
|
||||
- /dev/sdc:/dev/sdc
|
||||
```
|
||||
|
||||
### Filesystem Types
|
||||
|
||||
- **FAT32**: Maximum file size is 4GB
|
||||
- Use for most Windows installation media
|
||||
- Best compatibility
|
||||
|
||||
- **NTFS**: No file size limit
|
||||
- Use when `install.wim` is larger than 4GB
|
||||
- Requires UEFI:NTFS bootloader (automatically downloaded)
|
||||
|
||||
### Supported Windows Versions
|
||||
|
||||
- Windows Vista and later
|
||||
- Windows 7, 8, 8.1, 10, 11
|
||||
- Windows PE
|
||||
- Any language or edition variant
|
||||
|
||||
## 🐛 Troubleshooting
|
||||
|
||||
### Container Can't Access USB Device
|
||||
|
||||
**Solution**: Make sure the device is added to `docker-compose.yml` and you're running with `--privileged`:
|
||||
|
||||
```bash
|
||||
docker-compose run --rm woeusb
|
||||
```
|
||||
|
||||
### "Device is busy" Error
|
||||
|
||||
**Solution**: Unmount the USB device first:
|
||||
|
||||
```bash
|
||||
# On host system
|
||||
sudo umount /dev/sdb*
|
||||
```
|
||||
|
||||
### Permission Denied
|
||||
|
||||
**Solution**: Ensure you're using `sudo` inside the container:
|
||||
|
||||
```bash
|
||||
sudo woeusb --device /isos/windows.iso /dev/sdb
|
||||
```
|
||||
|
||||
### ISO File Not Found
|
||||
|
||||
**Solution**: Make sure the ISO is in the `isos/` directory and properly mounted:
|
||||
|
||||
```bash
|
||||
# Check mounted volumes
|
||||
ls -lh /isos
|
||||
```
|
||||
|
||||
### Split WIM File Error
|
||||
|
||||
If you see errors about install.wim being too large for FAT32:
|
||||
|
||||
**Solution 1**: Use NTFS filesystem:
|
||||
```bash
|
||||
sudo woeusb --device --target-filesystem NTFS /isos/windows.iso /dev/sdb
|
||||
```
|
||||
|
||||
**Solution 2**: WoeUSB will automatically split the WIM file if `wimtools` is installed (included in this Docker image).
|
||||
|
||||
### Out of Space
|
||||
|
||||
**Solution**: Ensure your USB drive has enough capacity:
|
||||
- Windows 7: Minimum 4GB
|
||||
- Windows 8/10/11: Minimum 8GB recommended
|
||||
|
||||
## 📁 Directory Structure
|
||||
|
||||
```
|
||||
docker-woeusb/
|
||||
├── Dockerfile # Docker image definition
|
||||
├── docker-compose.yml # Docker Compose configuration
|
||||
├── README.md # This file
|
||||
├── WoeUSB/ # WoeUSB source files
|
||||
│ ├── sbin/
|
||||
│ │ └── woeusb # Main WoeUSB script
|
||||
│ └── share/ # Shared resources
|
||||
├── isos/ # Place your Windows ISO files here
|
||||
└── output/ # Optional output directory
|
||||
```
|
||||
|
||||
## 🔍 Advanced Usage
|
||||
|
||||
### Running Without Docker Compose
|
||||
|
||||
```bash
|
||||
# Build image
|
||||
docker build -t woeusb:latest .
|
||||
|
||||
# Run container
|
||||
docker run -it --rm --privileged \
|
||||
-v $(pwd)/isos:/isos:ro \
|
||||
-v $(pwd)/output:/output \
|
||||
--device=/dev/sdb:/dev/sdb \
|
||||
woeusb:latest
|
||||
```
|
||||
|
||||
### Environment Variables
|
||||
|
||||
You can set environment variables in `docker-compose.yml`:
|
||||
|
||||
```yaml
|
||||
environment:
|
||||
- RUFUS_UEFI_NTFS_VERSION=b30e3b387a3ca7a5e2fddebcc2c8f9538a89b868
|
||||
- DD_BLOCK_SIZE=4194304
|
||||
```
|
||||
|
||||
### Accessing Container Shell
|
||||
|
||||
```bash
|
||||
# Start an interactive shell
|
||||
docker-compose run --rm woeusb /bin/bash
|
||||
|
||||
# Or using docker directly
|
||||
docker run -it --rm --privileged woeusb:latest /bin/bash
|
||||
```
|
||||
|
||||
## 📝 License
|
||||
|
||||
This Docker configuration is provided as-is for use with WoeUSB.
|
||||
|
||||
WoeUSB itself is free software licensed under the GNU General Public License version 3 (or any later version). See the [WoeUSB project](https://github.com/WoeUSB/WoeUSB) for complete license information.
|
||||
|
||||
## 🙏 Credits
|
||||
|
||||
- **WoeUSB Project**: [https://github.com/WoeUSB/WoeUSB](https://github.com/WoeUSB/WoeUSB)
|
||||
- Original WinUSB by Colin GILLE
|
||||
- Maintained by the WoeUSB community
|
||||
- Docker configuration by the community
|
||||
|
||||
## 🔗 Useful Links
|
||||
|
||||
- [WoeUSB GitHub Repository](https://github.com/WoeUSB/WoeUSB)
|
||||
- [WoeUSB Wiki](https://github.com/WoeUSB/WoeUSB/wiki)
|
||||
- [Report Issues](https://github.com/WoeUSB/WoeUSB/issues)
|
||||
|
||||
---
|
||||
|
||||
**Note**: Always verify your USB device path before running WoeUSB to avoid data loss on the wrong device!
|
||||
1
WoeUSB
Submódulo
1
WoeUSB
Submódulo
Submodule WoeUSB added at 4c1f1c9718
31
docker-compose.yml
Archivo normal
31
docker-compose.yml
Archivo normal
@@ -0,0 +1,31 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
woeusb:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
image: woeusb:latest
|
||||
container_name: woeusb
|
||||
privileged: true
|
||||
stdin_open: true
|
||||
tty: true
|
||||
volumes:
|
||||
# Mount directory for Windows ISO files
|
||||
- ./isos:/isos:ro
|
||||
# Mount directory for output/working files
|
||||
- ./output:/output
|
||||
devices:
|
||||
# This will require manual editing to add your specific USB device
|
||||
# Example: /dev/sdb, /dev/sdc, etc.
|
||||
# Uncomment and modify the following line:
|
||||
# - /dev/sdb:/dev/sdb
|
||||
environment:
|
||||
# Set RUFUS_UEFI_NTFS_VERSION if you need a specific version
|
||||
- RUFUS_UEFI_NTFS_VERSION=b30e3b387a3ca7a5e2fddebcc2c8f9538a89b868
|
||||
networks:
|
||||
- woeusb_network
|
||||
|
||||
networks:
|
||||
woeusb_network:
|
||||
driver: bridge
|
||||
2
isos/.gitkeep
Archivo normal
2
isos/.gitkeep
Archivo normal
@@ -0,0 +1,2 @@
|
||||
# This file keeps the isos directory in git
|
||||
# Place your Windows ISO files here
|
||||
2
output/.gitkeep
Archivo normal
2
output/.gitkeep
Archivo normal
@@ -0,0 +1,2 @@
|
||||
# This file keeps the output directory in git
|
||||
# Optional output directory for any generated files
|
||||
283
woeusb-docker.sh
Archivo ejecutable
283
woeusb-docker.sh
Archivo ejecutable
@@ -0,0 +1,283 @@
|
||||
#!/bin/bash
|
||||
# WoeUSB Docker Helper Script
|
||||
# This script helps you easily create Windows bootable USB drives using WoeUSB in Docker
|
||||
|
||||
set -e
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Function to print colored messages
|
||||
print_info() {
|
||||
echo -e "${BLUE}[INFO]${NC} $1"
|
||||
}
|
||||
|
||||
print_success() {
|
||||
echo -e "${GREEN}[SUCCESS]${NC} $1"
|
||||
}
|
||||
|
||||
print_warning() {
|
||||
echo -e "${YELLOW}[WARNING]${NC} $1"
|
||||
}
|
||||
|
||||
print_error() {
|
||||
echo -e "${RED}[ERROR]${NC} $1"
|
||||
}
|
||||
|
||||
# Function to list available ISOs
|
||||
list_isos() {
|
||||
print_info "Available ISO files in ./isos/"
|
||||
if [ -z "$(ls -A isos/*.iso 2>/dev/null)" ]; then
|
||||
print_warning "No ISO files found in ./isos/ directory"
|
||||
echo "Please copy your Windows ISO file to the ./isos/ directory"
|
||||
return 1
|
||||
fi
|
||||
ls -lh isos/*.iso 2>/dev/null || true
|
||||
}
|
||||
|
||||
# Function to list USB devices
|
||||
list_usb_devices() {
|
||||
print_info "Available block devices:"
|
||||
echo ""
|
||||
lsblk -o NAME,SIZE,TYPE,MOUNTPOINT,VENDOR,MODEL | grep -E "disk|NAME"
|
||||
echo ""
|
||||
print_warning "⚠️ WARNING: The target device will be COMPLETELY ERASED!"
|
||||
}
|
||||
|
||||
# Function to check if device exists
|
||||
check_device() {
|
||||
local device=$1
|
||||
if [ ! -b "$device" ]; then
|
||||
print_error "Device $device does not exist or is not a block device"
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
# Function to unmount device
|
||||
unmount_device() {
|
||||
local device=$1
|
||||
print_info "Unmounting $device partitions if mounted..."
|
||||
sudo umount ${device}* 2>/dev/null || true
|
||||
print_success "Device unmounted"
|
||||
}
|
||||
|
||||
# Function to build Docker image
|
||||
build_image() {
|
||||
print_info "Building WoeUSB Docker image..."
|
||||
docker-compose build
|
||||
print_success "Docker image built successfully"
|
||||
}
|
||||
|
||||
# Function to run WoeUSB
|
||||
run_woeusb() {
|
||||
local iso=$1
|
||||
local device=$2
|
||||
local filesystem=${3:-FAT}
|
||||
|
||||
# Check if ISO exists
|
||||
if [ ! -f "$iso" ]; then
|
||||
print_error "ISO file not found: $iso"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Get ISO filename for container path
|
||||
local iso_name=$(basename "$iso")
|
||||
|
||||
# Update docker-compose.yml with device
|
||||
print_info "Configuring Docker Compose with device $device..."
|
||||
|
||||
# Unmount device
|
||||
unmount_device "$device"
|
||||
|
||||
# Run WoeUSB
|
||||
print_info "Running WoeUSB..."
|
||||
print_info "ISO: $iso_name"
|
||||
print_info "Device: $device"
|
||||
print_info "Filesystem: $filesystem"
|
||||
echo ""
|
||||
|
||||
docker run -it --rm --privileged \
|
||||
-v "$(pwd)/isos:/isos:ro" \
|
||||
-v "$(pwd)/output:/output" \
|
||||
--device="$device:$device" \
|
||||
woeusb:latest \
|
||||
sudo woeusb --device --target-filesystem "$filesystem" "/isos/$iso_name" "$device"
|
||||
|
||||
print_success "Process completed!"
|
||||
}
|
||||
|
||||
# Main menu
|
||||
show_menu() {
|
||||
echo ""
|
||||
echo "=================================="
|
||||
echo " WoeUSB Docker Helper Script"
|
||||
echo "=================================="
|
||||
echo ""
|
||||
echo "1. List available ISO files"
|
||||
echo "2. List USB devices"
|
||||
echo "3. Build Docker image"
|
||||
echo "4. Create bootable USB (FAT32)"
|
||||
echo "5. Create bootable USB (NTFS)"
|
||||
echo "6. Interactive shell"
|
||||
echo "7. Exit"
|
||||
echo ""
|
||||
}
|
||||
|
||||
# Interactive mode
|
||||
interactive_mode() {
|
||||
while true; do
|
||||
show_menu
|
||||
read -p "Select an option [1-7]: " choice
|
||||
|
||||
case $choice in
|
||||
1)
|
||||
list_isos
|
||||
;;
|
||||
2)
|
||||
list_usb_devices
|
||||
;;
|
||||
3)
|
||||
build_image
|
||||
;;
|
||||
4)
|
||||
list_isos
|
||||
echo ""
|
||||
read -p "Enter ISO filename (from ./isos/): " iso_file
|
||||
list_usb_devices
|
||||
echo ""
|
||||
read -p "Enter target device (e.g., /dev/sdb): " target_device
|
||||
|
||||
if check_device "$target_device"; then
|
||||
read -p "⚠️ Are you sure you want to erase $target_device? (yes/no): " confirm
|
||||
if [ "$confirm" = "yes" ]; then
|
||||
run_woeusb "isos/$iso_file" "$target_device" "FAT"
|
||||
else
|
||||
print_info "Operation cancelled"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
5)
|
||||
list_isos
|
||||
echo ""
|
||||
read -p "Enter ISO filename (from ./isos/): " iso_file
|
||||
list_usb_devices
|
||||
echo ""
|
||||
read -p "Enter target device (e.g., /dev/sdb): " target_device
|
||||
|
||||
if check_device "$target_device"; then
|
||||
read -p "⚠️ Are you sure you want to erase $target_device? (yes/no): " confirm
|
||||
if [ "$confirm" = "yes" ]; then
|
||||
run_woeusb "isos/$iso_file" "$target_device" "NTFS"
|
||||
else
|
||||
print_info "Operation cancelled"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
6)
|
||||
read -p "Enter device to mount (e.g., /dev/sdb) or press Enter to skip: " device
|
||||
if [ -n "$device" ]; then
|
||||
docker run -it --rm --privileged \
|
||||
-v "$(pwd)/isos:/isos:ro" \
|
||||
-v "$(pwd)/output:/output" \
|
||||
--device="$device:$device" \
|
||||
woeusb:latest /bin/bash
|
||||
else
|
||||
docker run -it --rm --privileged \
|
||||
-v "$(pwd)/isos:/isos:ro" \
|
||||
-v "$(pwd)/output:/output" \
|
||||
woeusb:latest /bin/bash
|
||||
fi
|
||||
;;
|
||||
7)
|
||||
print_info "Goodbye!"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
print_error "Invalid option"
|
||||
;;
|
||||
esac
|
||||
|
||||
echo ""
|
||||
read -p "Press Enter to continue..."
|
||||
done
|
||||
}
|
||||
|
||||
# Command line mode
|
||||
if [ $# -eq 0 ]; then
|
||||
# No arguments, run interactive mode
|
||||
interactive_mode
|
||||
else
|
||||
# Parse command line arguments
|
||||
case "$1" in
|
||||
list-isos)
|
||||
list_isos
|
||||
;;
|
||||
list-devices)
|
||||
list_usb_devices
|
||||
;;
|
||||
build)
|
||||
build_image
|
||||
;;
|
||||
create)
|
||||
if [ $# -lt 3 ]; then
|
||||
print_error "Usage: $0 create <iso-file> <device> [filesystem]"
|
||||
print_error "Example: $0 create isos/windows10.iso /dev/sdb FAT"
|
||||
exit 1
|
||||
fi
|
||||
iso_path=$2
|
||||
device=$3
|
||||
filesystem=${4:-FAT}
|
||||
|
||||
if check_device "$device"; then
|
||||
print_warning "⚠️ Device $device will be COMPLETELY ERASED!"
|
||||
read -p "Are you sure you want to continue? (yes/no): " confirm
|
||||
if [ "$confirm" = "yes" ]; then
|
||||
run_woeusb "$iso_path" "$device" "$filesystem"
|
||||
else
|
||||
print_info "Operation cancelled"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
shell)
|
||||
device=${2:-}
|
||||
if [ -n "$device" ]; then
|
||||
docker run -it --rm --privileged \
|
||||
-v "$(pwd)/isos:/isos:ro" \
|
||||
-v "$(pwd)/output:/output" \
|
||||
--device="$device:$device" \
|
||||
woeusb:latest /bin/bash
|
||||
else
|
||||
docker run -it --rm --privileged \
|
||||
-v "$(pwd)/isos:/isos:ro" \
|
||||
-v "$(pwd)/output:/output" \
|
||||
woeusb:latest /bin/bash
|
||||
fi
|
||||
;;
|
||||
help|--help|-h)
|
||||
echo "WoeUSB Docker Helper Script"
|
||||
echo ""
|
||||
echo "Usage:"
|
||||
echo " $0 # Interactive mode"
|
||||
echo " $0 list-isos # List available ISO files"
|
||||
echo " $0 list-devices # List available USB devices"
|
||||
echo " $0 build # Build Docker image"
|
||||
echo " $0 create <iso> <device> [filesystem] # Create bootable USB"
|
||||
echo " $0 shell [device] # Open interactive shell"
|
||||
echo ""
|
||||
echo "Examples:"
|
||||
echo " $0 create isos/windows10.iso /dev/sdb FAT"
|
||||
echo " $0 create isos/windows11.iso /dev/sdb NTFS"
|
||||
echo " $0 shell /dev/sdb"
|
||||
;;
|
||||
*)
|
||||
print_error "Unknown command: $1"
|
||||
echo "Run '$0 help' for usage information"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
Referencia en una nueva incidencia
Block a user