Skip to content

Instantly share code, notes, and snippets.

@ammar0xff
Last active September 2, 2024 16:05
Show Gist options
  • Select an option

  • Save ammar0xff/c2205135f27e5377bf0f7101182256a2 to your computer and use it in GitHub Desktop.

Select an option

Save ammar0xff/c2205135f27e5377bf0f7101182256a2 to your computer and use it in GitHub Desktop.

Revisions

  1. ammar0xff revised this gist Sep 2, 2024. No changes.
  2. ammar0xff revised this gist Sep 2, 2024. 1 changed file with 8 additions and 8 deletions.
    16 changes: 8 additions & 8 deletions windows_usb_via_linux.sh
    Original file line number Diff line number Diff line change
    @@ -26,32 +26,32 @@ if [ ! -b "$usb_drive" ]; then
    fi

    # Download Ventoy
    echo "${green}[*] Downloading Ventoy...${ENDCOLOR}"
    echo -e "${green}[*] Downloading Ventoy...${ENDCOLOR}"
    wget -O ventoy.tar.gz "$ventoy_url"

    # Extract Ventoy
    echo "${green}[*] Extracting Ventoy...${ENDCOLOR}"
    echo -e "${green}[*] Extracting Ventoy...${ENDCOLOR}"
    tar -xf ventoy.tar.gz

    # Warn user about data loss
    echo "${yellow}WARNING: Ventoy installation will erase all data on the USB drive!${ENDCOLOR}"
    echo -e "${yellow}WARNING: Ventoy installation will erase all data on the USB drive!${ENDCOLOR}"
    echo "Press Enter to continue or Ctrl+C to abort."
    read -r

    # Install Ventoy (replace with ventoy2disk.sh if needed for your specific version)
    echo "${green}[*] Installing Ventoy...${ENDCOLOR}"
    echo -e "${green}[*] Installing Ventoy...${ENDCOLOR}"
    sudo ./ventoy2Disk.sh -i "$usb_drive"

    # Download Windows 10 ISO
    echo "${green}[*] Downloading Windows 10 ISO...${ENDCOLOR}"
    echo -e "${green}[*] Downloading Windows 10 ISO...${ENDCOLOR}"
    wget -O WIN10_x64.iso "$windows10_iso_url"

    # Move Windows 10 ISO to USB drive
    echo "${green}[*] Moving Windows 10 ISO to USB drive...${ENDCOLOR}"
    echo -e "${green}[*] Moving Windows 10 ISO to USB drive...${ENDCOLOR}"
    sudo mv WIN10_x64.iso /media/ventoy/

    # Clean Up
    echo "${green}[*] Cleaning Up...${ENDCOLOR}"
    echo -e "${green}[*] Cleaning Up...${ENDCOLOR}"
    rm -rf ventoy.tar.gz ventoy

    echo "${green}[*] Done creating your windows installation media Sucsessfully. ${ENDCOLOR}"
    echo -e "${green}[*] Done creating your windows installation media Sucsessfully. ${ENDCOLOR}"
  3. ammar0xff revised this gist Sep 2, 2024. 1 changed file with 1 addition and 14 deletions.
    15 changes: 1 addition & 14 deletions windows_usb_via_linux.sh
    Original file line number Diff line number Diff line change
    @@ -1,22 +1,9 @@

    #!/bin/bash

    # Colors
    Black='\033[0;30m'
    White='\033[1;37m'
    green='\033[0;32m'
    yellow='\033[1;33m'
    Red='\033[0;31m'
    Blue='\033[0;34m'
    Purple='\033[0;35m'
    Cyan='\033[0;36m'
    Brown_Orange='\033[0;33m'
    Dark_Gray='\033[1;30m'
    Light_Green='\033[1;32m'
    Light_Red='\033[1;31m'
    Light_Cyan='\033[1;36m'
    Light_Gray='\033[0;37m'
    Light_Purple='\033[1;35m'
    Light_Blue='\033[1;34m'
    ENDCOLOR="\e[0m"

    # Define download URLs
  4. ammar0xff created this gist Sep 2, 2024.
    70 changes: 70 additions & 0 deletions windows_usb_via_linux.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,70 @@

    #!/bin/bash
    # Colors
    Black='\033[0;30m'
    White='\033[1;37m'
    green='\033[0;32m'
    yellow='\033[1;33m'
    Red='\033[0;31m'
    Blue='\033[0;34m'
    Purple='\033[0;35m'
    Cyan='\033[0;36m'
    Brown_Orange='\033[0;33m'
    Dark_Gray='\033[1;30m'
    Light_Green='\033[1;32m'
    Light_Red='\033[1;31m'
    Light_Cyan='\033[1;36m'
    Light_Gray='\033[0;37m'
    Light_Purple='\033[1;35m'
    Light_Blue='\033[1;34m'
    ENDCOLOR="\e[0m"

    # Define download URLs
    ventoy_url="https://yer.dl.sourceforge.net/project/ventoy/v1.0.99/ventoy-1.0.99-linux.tar.gz?viasf=1"
    windows10_iso_url="https://dn721103.ca.archive.org/0/items/en-us_windows_10_consumer_editions_version_22h2_updated_feb_2023_x64_dvd_c29e4bb3/en-us_windows_10_consumer_editions_version_22h2_updated_feb_2023_x64_dvd_c29e4bb3.iso"

    # Check if wget is installed
    if ! command -v wget &> /dev/null; then
    echo "${Red}[*] Error: wget is not installed. Please install wget and try again.${ENDCOLOR}"
    exit 1
    fi

    # Get the first USB drive path
    usb_drive="/dev/sdb" # Replace X with your actual USB drive letter

    # Check if USB drive is present
    if [ ! -b "$usb_drive" ]; then
    echo "${Red}[*] Error: No USB drive found at $usb_drive.${ENDCOLOR}"
    exit 1
    fi

    # Download Ventoy
    echo "${green}[*] Downloading Ventoy...${ENDCOLOR}"
    wget -O ventoy.tar.gz "$ventoy_url"

    # Extract Ventoy
    echo "${green}[*] Extracting Ventoy...${ENDCOLOR}"
    tar -xf ventoy.tar.gz

    # Warn user about data loss
    echo "${yellow}WARNING: Ventoy installation will erase all data on the USB drive!${ENDCOLOR}"
    echo "Press Enter to continue or Ctrl+C to abort."
    read -r

    # Install Ventoy (replace with ventoy2disk.sh if needed for your specific version)
    echo "${green}[*] Installing Ventoy...${ENDCOLOR}"
    sudo ./ventoy2Disk.sh -i "$usb_drive"

    # Download Windows 10 ISO
    echo "${green}[*] Downloading Windows 10 ISO...${ENDCOLOR}"
    wget -O WIN10_x64.iso "$windows10_iso_url"

    # Move Windows 10 ISO to USB drive
    echo "${green}[*] Moving Windows 10 ISO to USB drive...${ENDCOLOR}"
    sudo mv WIN10_x64.iso /media/ventoy/

    # Clean Up
    echo "${green}[*] Cleaning Up...${ENDCOLOR}"
    rm -rf ventoy.tar.gz ventoy

    echo "${green}[*] Done creating your windows installation media Sucsessfully. ${ENDCOLOR}"