Skip to content

Instantly share code, notes, and snippets.

@reillysiemens
Last active December 28, 2018 05:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reillysiemens/cf85081188e2615588ef2970398403e4 to your computer and use it in GitHub Desktop.
Save reillysiemens/cf85081188e2615588ef2970398403e4 to your computer and use it in GitHub Desktop.
Create a Windows 10 USB image from Fedora 29

Instructions

The URL https://git.io/this-time-for-real-tho links to the win10-usb.sh script below. It created something bootable from my Fedora 29 workstation.

Try to run

curl -L https://git.io/this-time-for-real-tho | sh

and if that doesn't work try explicitly setting an environment variable for the location of the .iso file

curl -L https://git.io/this-time-for-real-tho | target_iso='/path/to/wherever/you/put/the/darn.iso' sh

Note:

This will likely take quite a while to finish.

#!/bin/sh
set -e
: ${target_dev='sda'}
: ${target_iso='/home/liveuser/Downloads/Win10_1809Oct_English_x64.iso'}
: ${exfat_dependencies='exfat-utils fuse-exfat'}
: ${bios_dst='/usr/lib/syslinux/bios'}
: ${bios_src='/usr/share/syslinux'}
: ${bootiso_url='https://git.io/bootiso'}
: ${bootiso='/tmp/bootiso'}
: ${bootiso_args="--mrsync -t exfat -d ${target_dev} ${target_iso}"}
name='win10-usb'; esc='\\e'; reset="${esc}[0m"
green() { local string="${1}"; echo -e "${esc}[32m${string}${reset}"; }
blue() { local string="${1}"; echo -e "${esc}[34m${string}${reset}"; }
magenta() { local string="${1}"; echo -e "${esc}[35m${string}${reset}"; }
log() { local string="${1}"; echo -e "[$(blue $name)] ${string}"; }
install_exfat_dependencies() {
# Fedora does not have these installed by default.
log "Enabling $(magenta "RPM Fusion repos")..."
sudo dnf install -y "https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm" "https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm"
log "Installing $(magenta "exFAT") dependencies..."
sudo dnf install -y ${exfat_dependencies}
}
patch_bios() {
# Fedora does not put c32 bios module files in the expected location.
log "Patching $(magenta "c32 bios module files") into the expected location..."
sudo mkdir -pv $bios_dst
sudo rsync -av $bios_src $bios_dst
}
download_bootiso() {
# Download the bootiso script and make it executable.
log "Downloading $(green "bootiso") script from $(magenta "${bootiso_url}") to $(magenta "${bootiso}")..."
curl -L $bootiso_url > $bootiso
chmod +x $bootiso
}
main() {
# Do the thing.
patch_bios
install_exfat_dependencies
download_bootiso
log "Executing $(magenta "${bootiso} ${bootiso_args}")..."
$bootiso $bootiso_args
log "$(green "Hopefully everything worked out!") 🤞"
}
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment