Skip to content

Commit

Permalink
Convert Windows 11 ISO to QCOW2
Browse files Browse the repository at this point in the history
  • Loading branch information
au2001 committed Mar 2, 2024
1 parent 64f281e commit 9e81e6e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
14 changes: 11 additions & 3 deletions container-disk-windows11/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
ARG FILE_NAME=Win11_English

FROM debian AS download

ARG FILE_NAME

WORKDIR /disk

RUN apt-get update && apt-get install -y uuid-runtime curl
RUN apt-get update && apt-get install -y uuid-runtime curl qemu-utils

ADD ./download.sh ./
RUN ./download.sh
RUN ./download.sh $FILE_NAME.iso

RUN qemu-img convert -f raw -O qcow2 $FILE_NAME.iso $FILE_NAME.qcow2

FROM scratch

COPY --chown=107:107 --from=download /disk/*.iso /disk/
ARG FILE_NAME

COPY --chown=107:107 --from=download /disk/$FILE_NAME.qcow2 /disk/
3 changes: 2 additions & 1 deletion container-disk-windows11/download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
SESSION_ID=`uuidgen`
USER_AGENT='Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:123.0) Gecko/20100101 Firefox/123.0'
URL_REGEX='href="(https://software\.download\.prss\.microsoft\.com/[^"]+)"'
FILE_NAME="${1:-Win11_English.iso}"

# Necessary request otherwise Microsoft rejects the next query
curl -s "https://vlscppe.microsoft.com/tags?org_id=y6jn8c31&session_id=$SESSION_ID" -A "$USER_AGENT" -H 'Referer: https://www.microsoft.com/' -H 'Upgrade-Insecure-Requests: 1' -H 'Sec-Fetch-Dest: iframe' -H 'Sec-Fetch-Mode: navigate' -H 'Sec-Fetch-Site: same-site' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' > /dev/null
Expand All @@ -20,4 +21,4 @@ fi

URL="${BASH_REMATCH[1]}"

curl -s -o Win11_English.iso "$URL"
curl -s -o "$FILE_NAME" "$URL"

0 comments on commit 9e81e6e

Please sign in to comment.