mirror of
https://github.com/dockur/windows.git
synced 2024-11-24 09:13:45 +01:00
feat: Refactor platform code (#472)
This commit is contained in:
parent
fd1fd1c48f
commit
8bbd87df40
13
readme.md
13
readme.md
@ -291,6 +291,19 @@ docker run -it --rm --name windows -p 8006:8006 --device=/dev/kvm --cap-add NET_
|
|||||||
|
|
||||||
Please note that in this mode, the container and Windows will each have their own separate IPs. The container will keep the macvlan IP, and Windows will use the DHCP IP.
|
Please note that in this mode, the container and Windows will each have their own separate IPs. The container will keep the macvlan IP, and Windows will use the DHCP IP.
|
||||||
|
|
||||||
|
* ### How do I add multiple disks?
|
||||||
|
|
||||||
|
To create additional disks, modify your compose file like this:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
environment:
|
||||||
|
DISK2_SIZE: "32G"
|
||||||
|
DISK3_SIZE: "64G"
|
||||||
|
volumes:
|
||||||
|
- /home/example:/storage2
|
||||||
|
- /mnt/data/example:/storage3
|
||||||
|
```
|
||||||
|
|
||||||
* ### How do I pass-through a disk?
|
* ### How do I pass-through a disk?
|
||||||
|
|
||||||
It is possible to pass-through disk devices directly by adding them to your compose file in this way:
|
It is possible to pass-through disk devices directly by adding them to your compose file in this way:
|
||||||
|
@ -41,14 +41,14 @@ parseVersion() {
|
|||||||
;;
|
;;
|
||||||
"7" | "7e" | "win7" | "win7e" | "windows7" | "windows 7" )
|
"7" | "7e" | "win7" | "win7e" | "windows7" | "windows 7" )
|
||||||
VERSION="win7${PLATFORM,,}"
|
VERSION="win7${PLATFORM,,}"
|
||||||
DETECTED="win7${PLATFORM,,}-enterprise"
|
[ -z "$DETECTED" ] && DETECTED="win7${PLATFORM,,}-enterprise"
|
||||||
;;
|
;;
|
||||||
"7u" | "win7u" | "windows7u" | "windows 7u" )
|
"7u" | "win7u" | "windows7u" | "windows 7u" )
|
||||||
VERSION="win7${PLATFORM,,}-ultimate"
|
VERSION="win7${PLATFORM,,}-ultimate"
|
||||||
;;
|
;;
|
||||||
"vista" | "winvista" | "windowsvista" | "windows vista" )
|
"vista" | "winvista" | "windowsvista" | "windows vista" )
|
||||||
VERSION="winvista${PLATFORM,,}"
|
VERSION="winvista${PLATFORM,,}"
|
||||||
DETECTED="winvista${PLATFORM,,}-enterprise"
|
[ -z "$DETECTED" ] && DETECTED="winvista${PLATFORM,,}-enterprise"
|
||||||
;;
|
;;
|
||||||
"vistu" | "winvistu" | "windowsvistu" | "windows vistu" )
|
"vistu" | "winvistu" | "windowsvistu" | "windows vistu" )
|
||||||
VERSION="winvista${PLATFORM,,}-ultimate"
|
VERSION="winvista${PLATFORM,,}-ultimate"
|
||||||
@ -76,27 +76,27 @@ parseVersion() {
|
|||||||
;;
|
;;
|
||||||
"core11" | "core 11" )
|
"core11" | "core 11" )
|
||||||
VERSION="core11"
|
VERSION="core11"
|
||||||
DETECTED="win11${PLATFORM,,}"
|
[ -z "$DETECTED" ] && DETECTED="win11${PLATFORM,,}"
|
||||||
;;
|
;;
|
||||||
"tiny11" | "tiny 11" )
|
"tiny11" | "tiny 11" )
|
||||||
VERSION="tiny11"
|
VERSION="tiny11"
|
||||||
DETECTED="win11${PLATFORM,,}"
|
[ -z "$DETECTED" ] && DETECTED="win11${PLATFORM,,}"
|
||||||
;;
|
;;
|
||||||
"tiny10" | "tiny 10" )
|
"tiny10" | "tiny 10" )
|
||||||
VERSION="tiny10"
|
VERSION="tiny10"
|
||||||
DETECTED="win10${PLATFORM,,}-ltsc"
|
[ -z "$DETECTED" ] && DETECTED="win10${PLATFORM,,}-ltsc"
|
||||||
;;
|
;;
|
||||||
"iot11" | "11iot" | "win11-iot" | "win11${PLATFORM,,}-iot" | "win11${PLATFORM,,}-enterprise-iot-eval" )
|
"iot11" | "11iot" | "win11-iot" | "win11${PLATFORM,,}-iot" | "win11${PLATFORM,,}-enterprise-iot-eval" )
|
||||||
DETECTED="win11${PLATFORM,,}-iot"
|
|
||||||
VERSION="win11${PLATFORM,,}-enterprise-iot-eval"
|
VERSION="win11${PLATFORM,,}-enterprise-iot-eval"
|
||||||
|
[ -z "$DETECTED" ] && DETECTED="win11${PLATFORM,,}-iot"
|
||||||
;;
|
;;
|
||||||
"iot10" | "10iot" | "win10-iot" | "win10${PLATFORM,,}-iot" | "win10${PLATFORM,,}-enterprise-iot-eval" )
|
"iot10" | "10iot" | "win10-iot" | "win10${PLATFORM,,}-iot" | "win10${PLATFORM,,}-enterprise-iot-eval" )
|
||||||
DETECTED="win10${PLATFORM,,}-iot"
|
|
||||||
VERSION="win10${PLATFORM,,}-enterprise-iot-eval"
|
VERSION="win10${PLATFORM,,}-enterprise-iot-eval"
|
||||||
|
[ -z "$DETECTED" ] && DETECTED="win10${PLATFORM,,}-iot"
|
||||||
;;
|
;;
|
||||||
"ltsc10" | "10ltsc" | "win10-ltsc" | "win10${PLATFORM,,}-ltsc" | "win10${PLATFORM,,}-enterprise-ltsc-eval" )
|
"ltsc10" | "10ltsc" | "win10-ltsc" | "win10${PLATFORM,,}-ltsc" | "win10${PLATFORM,,}-enterprise-ltsc-eval" )
|
||||||
DETECTED="win10${PLATFORM,,}-ltsc"
|
|
||||||
VERSION="win10${PLATFORM,,}-enterprise-ltsc-eval"
|
VERSION="win10${PLATFORM,,}-enterprise-ltsc-eval"
|
||||||
|
[ -z "$DETECTED" ] && DETECTED="win10${PLATFORM,,}-ltsc"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ verifyFile() {
|
|||||||
local check="$4"
|
local check="$4"
|
||||||
|
|
||||||
if [ -n "$size" ] && [[ "$total" != "$size" ]] && [[ "$size" != "0" ]]; then
|
if [ -n "$size" ] && [[ "$total" != "$size" ]] && [[ "$size" != "0" ]]; then
|
||||||
warn "The downloaded file has an invalid size: $total bytes, while expected value was: $size bytes. Please report this at $SUPPORT/issues"
|
warn "The downloaded file has an unexpected size: $total bytes, while expected value was: $size bytes. Please report this at $SUPPORT/issues"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local hash=""
|
local hash=""
|
||||||
@ -431,10 +431,9 @@ downloadImage() {
|
|||||||
tried="y"
|
tried="y"
|
||||||
|
|
||||||
if getESD "$TMP/esd" "$version"; then
|
if getESD "$TMP/esd" "$version"; then
|
||||||
local prev="$ISO"
|
|
||||||
ISO="${ISO%.*}.esd"
|
ISO="${ISO%.*}.esd"
|
||||||
downloadFile "$ISO" "$ESD" "$ESD_SUM" "$ESD_SIZE" "$desc" && return 0
|
downloadFile "$ISO" "$ESD" "$ESD_SUM" "$ESD_SIZE" "$desc" && return 0
|
||||||
ISO="$prev"
|
ISO="$iso"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
@ -663,41 +662,27 @@ selectVersion() {
|
|||||||
detectVersion() {
|
detectVersion() {
|
||||||
|
|
||||||
local xml="$1"
|
local xml="$1"
|
||||||
local id=""
|
local id arch
|
||||||
local arch=""
|
|
||||||
local tag="ARCH"
|
local tag="ARCH"
|
||||||
local platform="x64"
|
local platform="x64"
|
||||||
|
local compat="$platform"
|
||||||
|
|
||||||
arch=$(sed -n "/$tag/{s/.*<$tag>\(.*\)<\/$tag>.*/\1/;p}" <<< "$xml")
|
arch=$(sed -n "/$tag/{s/.*<$tag>\(.*\)<\/$tag>.*/\1/;p}" <<< "$xml")
|
||||||
|
|
||||||
case "${arch,,}" in
|
case "${arch,,}" in
|
||||||
"0" )
|
"0" ) platform="x86"; compat="x64" ;;
|
||||||
platform="x86"
|
"9" ) platform="x64"; compat="$platform" ;;
|
||||||
if [[ "${PLATFORM,,}" != "x64" ]]; then
|
"12" )platform="arm64"; compat="$platform" ;;
|
||||||
error "You cannot boot $platform images on a $PLATFORM cpu!" && exit 67
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
"9" )
|
|
||||||
platform="x64"
|
|
||||||
if [[ "${PLATFORM,,}" != "x64" ]]; then
|
|
||||||
error "You cannot boot $platform images on a $PLATFORM cpu!" && exit 67
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
"12" )
|
|
||||||
platform="arm64"
|
|
||||||
if [[ "${PLATFORM,,}" != "arm64" ]]; then
|
|
||||||
error "You cannot boot ${platform^^} images on a $PLATFORM cpu!" && exit 67
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
if [[ "${compat,,}" != "${PLATFORM,,}" ]]; then
|
||||||
|
error "You cannot boot ${platform^^} images on a $PLATFORM cpu!"
|
||||||
|
exit 67
|
||||||
|
fi
|
||||||
|
|
||||||
id=$(selectVersion "DISPLAYNAME" "$xml" "$platform")
|
id=$(selectVersion "DISPLAYNAME" "$xml" "$platform")
|
||||||
[ -n "$id" ] && [[ "${id,,}" != *"unknown"* ]] && echo "$id" && return 0
|
[ -z "$id" ] && id=$(selectVersion "PRODUCTNAME" "$xml" "$platform")
|
||||||
|
[ -z "$id" ] && id=$(selectVersion "NAME" "$xml" "$platform")
|
||||||
id=$(selectVersion "PRODUCTNAME" "$xml" "$platform")
|
|
||||||
[ -n "$id" ] && [[ "${id,,}" != *"unknown"* ]] && echo "$id" && return 0
|
|
||||||
|
|
||||||
id=$(selectVersion "NAME" "$xml" "$platform")
|
|
||||||
[ -n "$id" ] && [[ "${id,,}" != *"unknown"* ]] && echo "$id" && return 0
|
[ -n "$id" ] && [[ "${id,,}" != *"unknown"* ]] && echo "$id" && return 0
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
@ -711,8 +696,8 @@ detectImage() {
|
|||||||
|
|
||||||
XML=""
|
XML=""
|
||||||
|
|
||||||
if [ -z "$DETECTED" ] && [[ "${version,,}" != "http"* ]]; then
|
if [ -z "$DETECTED" ] && [ -z "$CUSTOM" ]; then
|
||||||
[ -z "$CUSTOM" ] && DETECTED="$version"
|
[[ "${version,,}" != "http"* ]] && DETECTED="$version"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$DETECTED" ]; then
|
if [ -n "$DETECTED" ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user