Compare commits

...

29 Commits
v3.11 ... v3.12

Author SHA1 Message Date
renovate[bot]
e7b831232a chore(deps): update qemux/qemu-docker docker tag to v5.16 (#600)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-06-14 03:11:31 +02:00
alexeadem
d18b4bff79 docs: Removed Kubevirt dependancy (#597) 2024-06-13 19:25:12 +02:00
Kroese
e23f042c5f docs: Add markdown alerts (#598) 2024-06-13 18:15:03 +02:00
arisudesu
d22372f47e fix: Username customization in localized Windows XP versions (#596) 2024-06-13 16:30:33 +02:00
Kroese
135f8a01ef docs: Languages (#594) 2024-06-13 01:54:44 +02:00
renovate[bot]
8b4fe1b278 chore(deps): update qemux/qemu-docker docker tag to v5.15 (#590)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-06-12 23:43:12 +02:00
ipitio
01935566ee docs: Add GHCR badge (#580) 2024-06-11 23:21:55 +02:00
Kroese
923839abfc docs: Readme (#587) 2024-06-11 21:47:13 +02:00
Kroese
77c12a0113 docs: Add icons (#586) 2024-06-11 20:56:49 +02:00
Kroese
2ec0e71daf docs: KVM information (#585) 2024-06-11 20:00:19 +02:00
Kroese
577369a54f feat: Check diskspace before download (#583) 2024-06-11 02:10:36 +02:00
Kroese
5bf54a4158 feat: Make resolution configurable (#582) 2024-06-10 19:38:32 +02:00
Kroese
2f5f01dbb2 fix: Detection of EFI images (#577) 2024-06-09 23:17:42 +02:00
Kroese
0bb55b7bc1 docs: KVM troubleshooting (#576) 2024-06-09 22:55:49 +02:00
renovate[bot]
bc03034bb0 chore(deps): update qemux/qemu-docker docker tag to v5.12 (#574)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-06-09 17:53:09 +02:00
Kroese
c4546bf687 docs: Reordered readme (#573) 2024-06-09 12:17:46 +02:00
Kroese
95ae5a853f docs: Mention macOS container (#571) 2024-06-08 18:37:31 +02:00
Kroese
074dcde8f7 docs: USB disk drives (#570) 2024-06-08 18:27:00 +02:00
renovate[bot]
2e638b679a chore(deps): update qemux/qemu-docker docker tag to v5.11 (#566)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-06-05 18:19:33 +02:00
Kroese
6b0ef457bd docs: Warn about USB disk drives (#565) 2024-06-04 23:06:23 +02:00
Kroese
b67f58bf6a docs: Add warning about USB drives (#564) 2024-06-04 22:55:01 +02:00
Kroese
d0848b36cf fix: Error logging for Samba daemon (#562) 2024-06-04 15:55:28 +02:00
renovate[bot]
71b2c5c110 chore(deps): update qemux/qemu-docker docker tag to v5.10 (#558)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-06-03 02:00:40 +02:00
Luis Muñiz
900b520f23 feat: Only create readme.txt when folder is empty (#552) 2024-05-31 07:24:46 +02:00
renovate[bot]
09c07d0634 chore(deps): update qemux/qemu-docker docker tag to v5.09 (#555) 2024-05-30 22:58:22 +02:00
Kroese
651bbe74eb fix: Display driver for Windows 8 / Server 2012 2024-05-29 21:54:08 +02:00
Kroese
fa3b17e871 fix: Use NetBIOS on i440fx machines 2024-05-28 18:20:27 +02:00
Kroese
4ed3437983 fix: Refactor code for legacy machines (#548) 2024-05-28 16:39:57 +02:00
Kroese
beaeddac0b feat: Added support for Windows Server 2003 (#547) 2024-05-28 01:00:16 +02:00
9 changed files with 503 additions and 309 deletions

View File

@@ -1,5 +1,5 @@
FROM scratch
COPY --from=qemux/qemu-docker:5.08 / /
COPY --from=qemux/qemu-docker:5.16 / /
ARG VERSION_ARG="0.0"
ARG DEBCONF_NOWARNINGS="yes"

View File

@@ -27,9 +27,6 @@ spec:
protocol: TCP
- containerPort: 3389
protocol: UDP
resources:
limits:
devices.kubevirt.io/kvm: 1
securityContext:
privileged: true
env:
@@ -42,10 +39,15 @@ spec:
volumeMounts:
- mountPath: /storage
name: storage
- mountPath: /dev/kvm
name: dev-kvm
volumes:
- name: storage
persistentVolumeClaim:
claimName: windows-pvc
- name: dev-kvm
hostPath:
path: /dev/kvm
---
apiVersion: v1
kind: Service
@@ -60,14 +62,11 @@ spec:
protocol: TCP
port: 8006
targetPort: 8006
nodePort: 48006
- name: tcp-3389
protocol: TCP
port: 3389
targetPort: 3389
nodePort: 43389
- name: udp-3389
protocol: UDP
port: 3389
targetPort: 3389
nodePort: 43388

124
readme.md
View File

@@ -7,24 +7,25 @@
[![Build]][build_url]
[![Version]][tag_url]
[![Size]][tag_url]
[![Package]][pkg_url]
[![Pulls]][hub_url]
</div></h1>
Windows inside a Docker container.
## Features
## Features
- Multi-language
- ISO downloader
- KVM acceleration
- Web-based viewer
## Video
## Video 📺
[![Youtube](https://img.youtube.com/vi/xhGYobuG508/0.jpg)](https://www.youtube.com/watch?v=xhGYobuG508)
## Usage
## Usage 🐳
Via Docker Compose:
@@ -58,9 +59,9 @@ Via Kubernetes:
kubectl apply -f kubernetes.yml
```
## FAQ
## FAQ 💬
* ### How do I use it?
### How do I use it?
Very simple! These are the steps:
@@ -72,7 +73,7 @@ kubectl apply -f kubernetes.yml
Enjoy your brand new machine, and don't forget to star this repo!
* ### How do I select the Windows version?
### How do I select the Windows version?
By default, Windows 11 will be installed. But you can add the `VERSION` environment variable to your compose file, in order to specify an alternative Windows version to be downloaded:
@@ -107,28 +108,34 @@ kubectl apply -f kubernetes.yml
| `tiny11` | Tiny 11 | 3.8 GB |
| `tiny10` | Tiny 10 | 3.6 GB |
To install ARM64 versions of Windows use [dockur/windows-arm](https://github.com/dockur/windows-arm/).
> [!TIP]
> To install ARM64 versions of Windows use [dockur/windows-arm](https://github.com/dockur/windows-arm/).
* ### How do I select the Windows language?
### How do I select the Windows language?
By default, the English version of Windows will be downloaded. But you can add the `LANGUAGE` environment variable to your compose file, in order to specify an alternative language:
```yaml
environment:
LANGUAGE: "Chinese"
LANGUAGE: "French"
```
You can choose between: 🇦🇪 Arabic, 🇧🇬 Bulgarian, 🇨🇳 Chinese, 🇭🇷 Croatian, 🇨🇿 Czech, 🇩🇰 Danish, 🇳🇱 Dutch, 🇬🇧 English, 🇪🇪 Estionian, 🇫🇮 Finnish, 🇫🇷 French, 🇩🇪 German, 🇬🇷 Greek, 🇮🇱 Hebrew, 🇭🇺 Hungarian, 🇮🇹 Italian, 🇯🇵 Japanese, 🇰🇷 Korean, 🇱🇻 Latvian, 🇱🇹 Lithuanian, 🇳🇴 Norwegian, 🇵🇱 Polish, 🇵🇹 Portuguese, 🇷🇴 Romanian, 🇷🇺 Russian, 🇷🇸 Serbian, 🇸🇰 Slovak, 🇸🇮 Slovenian, 🇪🇸 Spanish, 🇸🇪 Swedish, 🇹🇭 Thai, 🇹🇷 Turkish and 🇺🇦 Ukrainian.
You can choose between `Arabic`, `Bulgarian`, `Chinese`, `Croatian`, `Czech`, `Danish`, `Dutch`, `Estonian`, `Finnish`, `French`, `German`, `Greek`, `Hebrew`, `Hungarian`, `Italian`, `Japanese`, `Korean`, `Latvian`, `Lithuanian`, `Norwegian`, `Polish`, `Portuguese`, `Romanian`, `Russian`, `Serbian`, `Slovak`, `Slovenian`, `Spanish`, `Swedish`, `Turkish`, `Thai` and `Ukrainian`.
### How do I select the keyboard layout?
If you want to use a keyboard layout or locale that is not the default for the selected language, you can add the `KEYBOARD` and `REGION` variables with a culture code, like this:
If you want to use a keyboard layout or locale that is not the default for your selected language, you can add the `KEYBOARD` and `REGION` variables with a culture code, like this:
```yaml
environment:
REGION: "en-US"
KEYBOARD: "en-US"
```
* ### How do I change the storage location?
> [!NOTE]
> Changing these values will have no effect after the installation already has been performed. Use the control panel inside Windows in that case.
### How do I change the storage location?
To change the storage location, include the following bind mount in your compose file:
@@ -139,7 +146,7 @@ kubectl apply -f kubernetes.yml
Replace the example path `/var/win` with the desired storage folder.
* ### How do I change the size of the disk?
### How do I change the size of the disk?
To expand the default size of 64 GB, add the `DISK_SIZE` setting to your compose file and set it to your preferred capacity:
@@ -148,9 +155,10 @@ kubectl apply -f kubernetes.yml
DISK_SIZE: "256G"
```
This can also be used to resize the existing disk to a larger capacity without any data loss.
> [!TIP]
> This can also be used to resize the existing disk to a larger capacity without any data loss.
* ### How do I share files with the host?
### How do I share files with the host?
Open 'File Explorer' and click on the 'Network' section, you will see a computer called `host.lan`. Double-click it and it will show a folder called `Data`, which can be binded to any folder on your host via the compose file:
@@ -159,9 +167,12 @@ kubectl apply -f kubernetes.yml
- /home/user/example:/shared
```
The example folder `/home/user/example` will be available as ` \\host.lan\Data`. You can optionally map this path to a drive letter in Windows, for easier access.
The example folder `/home/user/example` will be available as ` \\host.lan\Data`.
> [!TIP]
> You can map this path to a drive letter in Windows, for easier access.
* ### How do I install a custom image?
### How do I install a custom image?
In order to download an unsupported ISO image that is not selectable from the list above, specify the URL of that ISO in the `VERSION` environment variable, for example:
@@ -179,7 +190,7 @@ kubectl apply -f kubernetes.yml
Replace the example path `/home/user/example.iso` with the filename of your desired ISO file, the value of `VERSION` will be ignored in this case.
* ### How do I run a script after installation?
### How do I run a script after installation?
To run your own script after installation, you can create a file called `install.bat` and place it in a folder together with any additional files it needs (software to be installed for example). Then bind that folder in your compose file like this:
@@ -190,7 +201,7 @@ kubectl apply -f kubernetes.yml
The example folder `/home/user/example` will be copied to `C:\OEM` during installation and the containing `install.bat` will be executed during the last step.
* ### How do I perform a manual installation?
### How do I perform a manual installation?
It's best to stick to the automatic installation, as it adjusts various settings to prevent common issues when running Windows inside a virtual environment.
@@ -201,18 +212,7 @@ kubectl apply -f kubernetes.yml
MANUAL: "Y"
```
* ### How do I verify if my system supports KVM?
To verify if your system supports KVM, run the following commands:
```bash
sudo apt install cpu-checker
sudo kvm-ok
```
If you receive an error from `kvm-ok` indicating that KVM acceleration can't be used, check the virtualization settings in the BIOS.
* ### How do I change the amount of CPU or RAM?
### How do I change the amount of CPU or RAM?
By default, the container will be allowed to use a maximum of 2 CPU cores and 4 GB of RAM.
@@ -224,7 +224,7 @@ kubectl apply -f kubernetes.yml
CPU_CORES: "4"
```
* ### How do I configure the username and password?
### How do I configure the username and password?
By default, a user called `Docker` is created during the installation, with an empty password.
@@ -236,7 +236,7 @@ kubectl apply -f kubernetes.yml
PASSWORD: "gates"
```
* ### How do I connect using RDP?
### How do I connect using RDP?
The web-viewer is mainly meant to be used during installation, as its picture quality is low, and it has no audio or clipboard for example.
@@ -244,7 +244,7 @@ kubectl apply -f kubernetes.yml
There is a RDP client for [Android](https://play.google.com/store/apps/details?id=com.microsoft.rdc.androidx) available from the Play Store and one for [iOS](https://apps.apple.com/nl/app/microsoft-remote-desktop/id714464092?l=en-GB) in the Apple Store. For Linux you can use [FreeRDP](https://www.freerdp.com/) and on Windows just type `mstsc` in the search box.
* ### How do I assign an individual IP address to the container?
### How do I assign an individual IP address to the container?
By default, the container uses bridge networking, which shares the IP address with the host.
@@ -278,9 +278,10 @@ kubectl apply -f kubernetes.yml
An added benefit of this approach is that you won't have to perform any port mapping anymore, since all ports will be exposed by default.
Please note that this IP address won't be accessible from the Docker host due to the design of macvlan, which doesn't permit communication between the two. If this is a concern, you need to create a [second macvlan](https://blog.oddbit.com/post/2018-03-12-using-docker-macvlan-networks/#host-access) as a workaround.
> [!IMPORTANT]
> This IP address won't be accessible from the Docker host due to the design of macvlan, which doesn't permit communication between the two. If this is a concern, you need to create a [second macvlan](https://blog.oddbit.com/post/2018-03-12-using-docker-macvlan-networks/#host-access) as a workaround.
* ### How can Windows acquire an IP address from my router?
### How can Windows acquire an IP address from my router?
After configuring the container for macvlan (see above), it is possible for Windows to become part of your home network by requesting an IP from your router, just like a real PC.
@@ -295,9 +296,10 @@ kubectl apply -f kubernetes.yml
- 'c *:* rwm'
```
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.
> [!NOTE]
> In this mode, the container and Windows will each have their own separate IPs.
* ### How do I add multiple disks?
### How do I add multiple disks?
To create additional disks, modify your compose file like this:
@@ -310,7 +312,7 @@ kubectl apply -f kubernetes.yml
- /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:
@@ -322,7 +324,7 @@ kubectl apply -f kubernetes.yml
Use `/disk1` if you want it to become your main drive, and use `/disk2` and higher to add them as secondary drives.
* ### How do I pass-through a USB device?
### How do I pass-through a USB device?
To pass-through a USB device, first lookup its vendor and product id via the `lsusb` command, then add them to your compose file like this:
@@ -333,22 +335,52 @@ kubectl apply -f kubernetes.yml
- /dev/bus/usb
```
* ### Is this project legal?
> [!IMPORTANT]
> In case the device is a USB disk drive, please wait until after the installation is completed before connecting it. Otherwise the installation may fail, as the order of the disks can get rearranged.
Yes, this project contains only open-source code and does not distribute any copyrighted material. Any product keys found in the code are just generic placeholders provided by Microsoft for trial purposes. So under all applicable laws, this project would be considered legal.
### How do I verify if my system supports KVM?
## Stars
To verify that your system supports KVM, run the following commands:
```bash
sudo apt install cpu-checker
sudo kvm-ok
```
If you receive an error from `kvm-ok` indicating that KVM acceleration can't be used, please check whether:
- the virtualization extensions (`Intel VT-x` or `AMD SVM`) are enabled in your BIOS.
- you are running an operating system that supports them, like Linux or Windows 11 (macOS and Windows 10 do not unfortunately).
- you enabled "nested virtualization" if you are running the container inside a virtual machine.
- you are not using a cloud provider, as most of them do not allow nested virtualization for their VPS's.
If you didn't receive any error from `kvm-ok` at all, but the container still complains that `/dev/kvm` is missing, it might help to add `privileged: true` to your compose file (or `--privileged` to your `run` command), to rule out any permission issue.
### How do I run macOS in a container?
You can use [dockur/macos](https://github.com/dockur/macos) for that. It shares many of the same features, except for the automatic installation.
### Is this project legal?
Yes, this project contains only open-source code and does not distribute any copyrighted material. Any product keys found in the code are just generic placeholders provided by Microsoft for trial purposes. So under all applicable laws, this project will be considered legal.
## Stars 🌟
[![Stars](https://starchart.cc/dockur/windows.svg?variant=adaptive)](https://starchart.cc/dockur/windows)
## Disclaimer
## Disclaimer ⚖️
The product names, logos, brands, and other trademarks referred to within this project are the property of their respective trademark holders. This project is not affiliated, sponsored, or endorsed by Microsoft Corporation.
*The product names, logos, brands, and other trademarks referred to within this project are the property of their respective trademark holders. This project is not affiliated, sponsored, or endorsed by Microsoft Corporation.*
[build_url]: https://github.com/dockur/windows/
[hub_url]: https://hub.docker.com/r/dockurr/windows/
[tag_url]: https://hub.docker.com/r/dockurr/windows/tags
[pkg_url]: https://github.com/dockur/windows/pkgs/container/windows
[Build]: https://github.com/dockur/windows/actions/workflows/build.yml/badge.svg
[Size]: https://img.shields.io/docker/image-size/dockurr/windows/latest?color=066da5&label=size
[Pulls]: https://img.shields.io/docker/pulls/dockurr/windows.svg?style=flat&label=pulls&logo=docker
[Version]: https://img.shields.io/docker/v/dockurr/windows/latest?arch=amd64&sort=semver&color=066da5
[Package]: https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Fipitio%2Fghcr-pulls%2Fmaster%2Findex.json&query=%24%5B%3F(%40.owner%3D%3D%22dockur%22%20%26%26%20%40.repo%3D%3D%22windows%22%20%26%26%20%40.image%3D%3D%22windows%22)%5D.pulls&logo=github&style=flat&color=066da5&label=pulls

View File

@@ -1,6 +1,8 @@
#!/usr/bin/env bash
set -Eeuo pipefail
: "${XRES:=""}"
: "${YRES:=""}"
: "${VERIFY:=""}"
: "${REGION:=""}"
: "${MANUAL:=""}"
@@ -72,7 +74,7 @@ parseVersion() {
;;
"25" | "2025" | "win25" | "win2025" | "windows2025" | "windows 2025" )
VERSION="win2025-eval"
;;
;;
"22" | "2022" | "win22" | "win2022" | "windows2022" | "windows 2022" )
VERSION="win2022-eval"
;;
@@ -88,6 +90,9 @@ parseVersion() {
"2008" | "2008r2" | "win2008" | "win2008r2" | "windows2008" | "windows 2008" )
VERSION="win2008r2"
;;
"2003" | "2003r2" | "win2003" | "win2003r2" | "windows2003" | "windows 2003" )
VERSION="win2003r2"
;;
"core11" | "core 11" )
VERSION="core11"
[ -z "$DETECTED" ] && DETECTED="win11x64"
@@ -370,12 +375,13 @@ printVersion() {
"win95"* ) desc="Windows 95" ;;
"win2k"* ) desc="Windows 2000" ;;
"winvista"* ) desc="Windows Vista" ;;
"win2025"* ) desc="Windows Server 2025" ;;
"win2022"* ) desc="Windows Server 2022" ;;
"win2019"* ) desc="Windows Server 2019" ;;
"win2016"* ) desc="Windows Server 2016" ;;
"win2012"* ) desc="Windows Server 2012" ;;
"win2003"* ) desc="Windows Server 2003" ;;
"win2008"* ) desc="Windows Server 2008" ;;
"win2012"* ) desc="Windows Server 2012" ;;
"win2016"* ) desc="Windows Server 2016" ;;
"win2019"* ) desc="Windows Server 2019" ;;
"win2022"* ) desc="Windows Server 2022" ;;
"win2025"* ) desc="Windows Server 2025" ;;
esac
if [ -z "$desc" ]; then
@@ -434,12 +440,15 @@ printEdition() {
"winvista"* )
edition="Business"
;;
"win2025"* | "win2022"* | "win2019"* | "win2016"* | "win2012"* | "win2008"* )
"win2025"* | "win2022"* | "win2019"* | "win2016"* )
edition="Standard"
;;
"win2012"* | "win2008"* | "win2003"* )
edition="Standard"
;;
esac
[ -n "$edition" ] && result="$result $edition"
[ -n "$edition" ] && result+=" $edition"
echo "$result"
return 0
@@ -510,6 +519,9 @@ fromFile() {
*"server2008"* | *"server_2008"* )
id="win2008r2"
;;
*"server2003"* | *"server_2003"* )
id="win2003r2"
;;
esac
if [ -n "$id" ]; then
@@ -663,7 +675,7 @@ getMido() {
"win2025-eval" )
size=5307996160
sum="16442d1c0509bcbb25b715b1b322a15fb3ab724a42da0f384b9406ca1c124ed4"
;;
;;
"win2022-eval" )
size=5044094976
sum="3e4fa6d8507b554856fc9ca6079cc402df11a8b79344871669f0251535255325"
@@ -719,13 +731,13 @@ getLink1() {
[[ "${lang,,}" != "en" ]] && [[ "${lang,,}" != "en-us" ]] && return 0
size=4821989376
sum="e8f1431c4e6289b3997c20eadbb2576670300bb6e1cf8948b5d7af179010a962"
url="26100.1.240331-1435.ge_release_CLIENT_ENTERPRISES_OEM_x64FRE_en-us.iso"
url="11/26100.1.240331-1435.ge_release_CLIENT_ENTERPRISES_OEM_x64FRE_en-us.iso"
;;
"win11x64-ltsc" | "win11x64-enterprise-ltsc-eval" )
[[ "${lang,,}" != "en" ]] && [[ "${lang,,}" != "en-us" ]] && return 0
size=4821989376
sum="e8f1431c4e6289b3997c20eadbb2576670300bb6e1cf8948b5d7af179010a962"
url="26100.1.240331-1435.ge_release_CLIENT_ENTERPRISES_OEM_x64FRE_en-us.iso"
url="11/26100.1.240331-1435.ge_release_CLIENT_ENTERPRISES_OEM_x64FRE_en-us.iso"
;;
"win10x64" | "win10x64-enterprise" | "win10x64-enterprise-eval" )
size=5675616256
@@ -901,6 +913,11 @@ getLink2() {
sum="9c36fed4255bd05a8506b2da88f9aad73643395e155e609398aacd2b5276289c"
url="Windows%20Vista/en_windows_vista_with_sp2_x86_dvd_342266.iso"
;;
"win2003r2" )
size=652367872
sum="74245cba888f935b138b106c2744bec7f392925b472358960a0b5643cd6abb32"
url="Windows%20Server%202003%20R2/en_win_srv_2003_r2_standard_x64_with_sp2_cd1_x13-05757.iso"
;;
"winxpx86" )
size=617756672
sum="62b6c91563bad6cd12a352aa018627c314cfc5162d8e9f8af0756a642e602a46"
@@ -1287,7 +1304,7 @@ getLink4() {
"zh-hk" | "zh-tw" ) url="zh-tw_windows_server_2025_preview_x64_dvd_9b147dcd.iso" ;;
"zh" | "zh-"* ) url="zh-cn_windows_server_2025_preview_x64_dvd_a12bb0bf.iso" ;;
esac
;;
;;
"win2022" | "win2022-eval" )
case "${culture,,}" in
"cs" | "cs-"* ) url="cs-cz_windows_server_2022_updated_april_2024_x64_dvd_164349f3.iso" ;;
@@ -1962,120 +1979,19 @@ migrateFiles() {
return 0
}
detectLegacy() {
local dir="$1"
local find find2 desc
find=$(find "$dir" -maxdepth 1 -type d -iname win95 | head -n 1)
if [ -n "$find" ]; then
DETECTED="win95"
desc=$(printEdition "$DETECTED" "Windows 95")
info "Detected: $desc" && return 0
fi
find=$(find "$dir" -maxdepth 1 -type d -iname win98 | head -n 1)
if [ -n "$find" ]; then
DETECTED="win98"
desc=$(printEdition "$DETECTED" "Windows 98")
info "Detected: $desc" && return 0
fi
find=$(find "$dir" -maxdepth 1 -type d -iname win9x | head -n 1)
if [ -n "$find" ]; then
DETECTED="win9x"
desc=$(printEdition "$DETECTED" "Windows ME")
info "Detected: $desc" && return 0
fi
find=$(find "$dir" -maxdepth 1 -type d -iname win51 | head -n 1)
find2=$(find "$dir" -maxdepth 1 -type f -iname setupxp.htm | head -n 1)
if [ -n "$find" ] || [ -n "$find2" ] || [ -f "$dir/WIN51AP" ] || [ -f "$dir/WIN51IC" ]; then
[ -d "$dir/AMD64" ] && DETECTED="winxpx64" || DETECTED="winxpx86"
desc=$(printEdition "$DETECTED" "Windows XP")
info "Detected: $desc" && return 0
fi
if [ -f "$dir/CDROM_NT.5" ]; then
DETECTED="win2kx86"
desc=$(printEdition "$DETECTED" "Windows 2000")
info "Detected: $desc" && return 0
fi
if [ -f "$dir/WIN51AA" ] || [ -f "$dir/WIN51AD" ] || [ -f "$dir/WIN51AS" ] || [ -f "$dir/WIN51MA" ] || [ -f "$dir/WIN51MD" ]; then
desc="Windows Server 2003"
info "Detected: $desc" && error "$desc is not supported yet!" && exit 54
fi
if [ -f "$dir/WIN51IA" ] || [ -f "$dir/WIN51IB" ] || [ -f "$dir/WIN51ID" ] || [ -f "$dir/WIN51IL" ] || [ -f "$dir/WIN51IS" ]; then
desc="Windows Server 2003"
info "Detected: $desc" && error "$desc is not supported yet!" && exit 54
fi
return 1
}
prepareLegacy() {
local iso="$1"
local dir="$2"
local file="$dir/boot.img"
ETFS=$(basename "$file")
[ -f "$file" ] && [ -s "$file" ] && return 0
rm -f "$file"
local len offset
len=$(isoinfo -d -i "$iso" | grep "Nsect " | grep -o "[^ ]*$")
offset=$(isoinfo -d -i "$iso" | grep "Bootoff " | grep -o "[^ ]*$")
dd "if=$iso" "of=$file" bs=2048 "count=$len" "skip=$offset" status=none && return 0
return 1
}
prepare9x() {
local iso="$1"
local dir="$2"
local file="$dir/boot.img"
ETFS=$(basename "$file")
[ -f "$file" ] && [ -s "$file" ] && return 0
rm -f "$file"
local src="[BOOT]/Boot-1.44M.img"
[ ! -f "$dir/$src" ] && error "Boot floppy not found!" && return 1
cp "$dir/$src" "$file" && return 0
return 1
}
prepare2k() {
prepareInstall() {
local dir="$2"
ETFS="[BOOT]/Boot-NoEmul.img"
return 0
}
prepareXP() {
local dir="$2"
local arch="x86"
local target="$dir/I386"
local desc="$3"
local arch="$4"
local key="$5"
local driver="$6"
local drivers="$TMP/drivers"
ETFS="[BOOT]/Boot-NoEmul.img"
if [ -d "$dir/AMD64" ]; then
arch="amd64"
target="$dir/AMD64"
if [ ! -f "$dir/$ETFS" ] || [ ! -s "$dir/$ETFS" ]; then
error "Failed to locate file \"$ETFS\" in $desc ISO image!" && return 1
fi
local msg="Adding drivers to image..."
@@ -2084,20 +2000,23 @@ prepareXP() {
mkdir -p "$drivers"
if ! tar -xf /drivers.txz -C "$drivers" --warning=no-timestamp; then
error "Failed to extract driver!" && return 1
error "Failed to extract drivers!" && return 1
fi
cp "$drivers/viostor/xp/$arch/viostor.sys" "$target"
local target
[[ "${arch,,}" == "x86" ]] && target="$dir/I386" || target="$dir/AMD64"
cp "$drivers/viostor/$driver/$arch/viostor.sys" "$target"
mkdir -p "$dir/\$OEM\$/\$1/Drivers/viostor"
cp "$drivers/viostor/xp/$arch/viostor.cat" "$dir/\$OEM\$/\$1/Drivers/viostor"
cp "$drivers/viostor/xp/$arch/viostor.inf" "$dir/\$OEM\$/\$1/Drivers/viostor"
cp "$drivers/viostor/xp/$arch/viostor.sys" "$dir/\$OEM\$/\$1/Drivers/viostor"
cp "$drivers/viostor/$driver/$arch/viostor.cat" "$dir/\$OEM\$/\$1/Drivers/viostor"
cp "$drivers/viostor/$driver/$arch/viostor.inf" "$dir/\$OEM\$/\$1/Drivers/viostor"
cp "$drivers/viostor/$driver/$arch/viostor.sys" "$dir/\$OEM\$/\$1/Drivers/viostor"
mkdir -p "$dir/\$OEM\$/\$1/Drivers/NetKVM"
cp "$drivers/NetKVM/xp/$arch/netkvm.cat" "$dir/\$OEM\$/\$1/Drivers/NetKVM"
cp "$drivers/NetKVM/xp/$arch/netkvm.inf" "$dir/\$OEM\$/\$1/Drivers/NetKVM"
cp "$drivers/NetKVM/xp/$arch/netkvm.sys" "$dir/\$OEM\$/\$1/Drivers/NetKVM"
cp "$drivers/NetKVM/$driver/$arch/netkvm.cat" "$dir/\$OEM\$/\$1/Drivers/NetKVM"
cp "$drivers/NetKVM/$driver/$arch/netkvm.inf" "$dir/\$OEM\$/\$1/Drivers/NetKVM"
cp "$drivers/NetKVM/$driver/$arch/netkvm.sys" "$dir/\$OEM\$/\$1/Drivers/NetKVM"
if [ ! -f "$target/TXTSETUP.SIF" ]; then
error "The file TXTSETUP.SIF could not be found!" && return 1
@@ -2129,24 +2048,14 @@ prepareXP() {
rm -rf "$drivers"
local key pid file setup
local pid file setup
setup=$(find "$target" -maxdepth 1 -type f -iname setupp.ini | head -n 1)
pid=$(<"$setup")
pid="${pid:(-4)}"
pid="${pid:0:3}"
if [[ "$pid" == "270" ]]; then
warn "this version of Windows XP requires a volume license key (VLK), it will ask for one during installation."
fi
if [[ "${arch,,}" == "x86" ]]; then
# Windows XP Professional x86 generic key (no activation, trial-only)
# This is not a pirated key, it comes from the official MS documentation.
key="DR8GV-C8V6J-BYXHG-7PYJR-DB66Y"
else
# Windows XP Professional x64 generic key (no activation, trial-only)
# This is not a pirated key, it comes from the official MS documentation.
key="B2RBK-7KPT9-4JP6X-QQFWM-PJD6G"
warn "this version of $desc requires a volume license key (VLK), it will ask for one during installation."
fi
local oem=""
@@ -2166,6 +2075,12 @@ prepareXP() {
fi
fi
[ -z "$YRES" ] && YRES="720"
[ -z "$XRES" ] && XRES="1280"
XHEX=$(printf '%x\n' "$XRES")
YHEX=$(printf '%x\n' "$YRES")
local username="Docker"
local password="*"
@@ -2214,6 +2129,11 @@ prepareXP() {
echo "[Identification]"
echo " JoinWorkgroup = WORKGROUP"
echo ""
echo "[Display]"
echo " BitsPerPel=32"
echo " XResolution=$XRES"
echo " YResolution=$YRES"
echo ""
echo "[Networking]"
echo " InstallDefaultComponents=Yes"
echo ""
@@ -2229,6 +2149,17 @@ prepareXP() {
echo ""
} | unix2dos > "$target/WINNT.SIF"
if [[ "$driver" == "2k3" ]]; then
{ echo "[Components]"
echo " TerminalServer=On"
echo ""
echo "[LicenseFilePrintData]"
echo " AutoMode=PerServer"
echo " AutoUsers=5"
echo ""
} | unix2dos >> "$target/WINNT.SIF"
fi
{ echo "Windows Registry Editor Version 5.00"
echo ""
echo "[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Security]"
@@ -2261,20 +2192,72 @@ prepareXP() {
echo ""
echo "[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Video\{23A77BF7-ED96-40EC-AF06-9B1F4867732A}\0000]"
echo "\"DefaultSettings.BitsPerPel\"=dword:00000020"
echo "\"DefaultSettings.XResolution\"=dword:00000780"
echo "\"DefaultSettings.YResolution\"=dword:00000438"
echo "\"DefaultSettings.XResolution\"=dword:00000$XHEX"
echo "\"DefaultSettings.YResolution\"=dword:00000$YHEX"
echo ""
echo "[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Control\VIDEO\{23A77BF7-ED96-40EC-AF06-9B1F4867732A}\0000]"
echo "\"DefaultSettings.BitsPerPel\"=dword:00000020"
echo "\"DefaultSettings.XResolution\"=dword:00000$XHEX"
echo "\"DefaultSettings.YResolution\"=dword:00000$YHEX"
echo ""
echo "[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce]"
echo "\"ScreenSaver\"=\"reg add \\\"HKCU\\\\Control Panel\\\\Desktop\\\" /f /v \\\"SCRNSAVE.EXE\\\" /t REG_SZ /d \\\"off\\\"\""
echo "\"ScreenSaverOff\"=\"reg add \\\"HKCU\\\\Control Panel\\\\Desktop\\\" /f /v \\\"ScreenSaveActive\\\" /t REG_SZ /d \\\"0\\\"\""
echo "$oem"
echo ""
} | unix2dos > "$dir/\$OEM\$/install.reg"
if [[ "$driver" == "2k3" ]]; then
{ echo "[HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\srvWiz]"
echo "@=dword:00000000"
echo ""
echo "[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ServerOOBE\SecurityOOBE]"
echo "\"DontLaunchSecurityOOBE\"=dword:00000000"
echo ""
} | unix2dos >> "$dir/\$OEM\$/install.reg"
fi
{ echo "Set WshShell = WScript.CreateObject(\"WScript.Shell\")"
echo "Set WshNetwork = WScript.CreateObject(\"WScript.Network\")"
echo "Set oMachine = GetObject(\"WinNT://\" & WshNetwork.ComputerName)"
echo "Set oInfoUser = GetObject(\"WinNT://\" & WshNetwork.ComputerName & \"/Administrator,user\")"
echo "Set oUser = oMachine.MoveHere(oInfoUser.ADsPath,\"$username\")"
echo "Set Domain = GetObject(\"WinNT://\" & WshNetwork.ComputerName)"
echo ""
echo "Function DecodeSID(binSID)"
echo " ReDim o(LenB(binSID))"
echo ""
echo " For i = 1 To LenB(binSID)"
echo " o(i-1) = AscB(MidB(binSID, i, 1))"
echo " Next"
echo ""
echo " sid = \"S-\" & CStr(o(0)) & \"-\" & OctetArrayToString _"
echo " (Array(o(2), o(3), o(4), o(5), o(6), o(7)))"
echo " For i = 8 To (4 * o(1) + 4) Step 4"
echo " sid = sid & \"-\" & OctetArrayToString _"
echo " (Array(o(i+3), o(i+2), o(i+1), o(i)))"
echo " Next"
echo ""
echo " DecodeSID = sid"
echo "End Function"
echo ""
echo "Function OctetArrayToString(arr)"
echo " v = 0"
echo " For i = 0 To UBound(arr)"
echo " v = v * 256 + arr(i)"
echo " Next"
echo ""
echo " OctetArrayToString = CStr(v)"
echo "End Function"
echo ""
echo "For Each DomainItem in Domain"
echo " If DomainItem.Class = \"User\" Then"
echo " sid = DecodeSID(DomainItem.Get(\"objectSID\"))"
echo " If Left(sid, 9) = \"S-1-5-21-\" And Right(sid, 4) = \"-500\" Then"
echo " LocalAdminADsPath = DomainItem.ADsPath"
echo " Exit For"
echo " End If"
echo " End If"
echo "Next"
echo ""
echo "Call Domain.MoveHere(LocalAdminADsPath, \"$username\")"
echo ""
} | unix2dos > "$dir/\$OEM\$/admin.vbs"
@@ -2299,4 +2282,171 @@ prepareXP() {
return 0
}
prepare2k3() {
local iso="$1"
local dir="$2"
local desc="$3"
local driver="2k3"
local arch key
[ -d "$dir/AMD64" ] && arch="amd64" || arch="x86"
if [[ "${arch,,}" == "x86" ]]; then
# Windows Server 2003 Standard x86 generic key (no activation, trial-only)
# This is not a pirated key, it comes from the official MS documentation.
key="QKDCQ-TP2JM-G4MDG-VR6F2-P9C48"
else
# Windows Server 2003 Standard x64 generic key (no activation, trial-only)
# This is not a pirated key, it comes from the official MS documentation.
key="P4WJG-WK3W7-3HM8W-RWHCK-8JTRY"
fi
! prepareInstall "$iso" "$dir" "$desc" "$arch" "$key" "$driver" && return 1
return 0
}
prepareXP() {
local iso="$1"
local dir="$2"
local desc="$3"
local driver="xp"
local arch key
[ -d "$dir/AMD64" ] && arch="amd64" || arch="x86"
if [[ "${arch,,}" == "x86" ]]; then
# Windows XP Professional x86 generic key (no activation, trial-only)
# This is not a pirated key, it comes from the official MS documentation.
key="DR8GV-C8V6J-BYXHG-7PYJR-DB66Y"
else
# Windows XP Professional x64 generic key (no activation, trial-only)
# This is not a pirated key, it comes from the official MS documentation.
key="B2RBK-7KPT9-4JP6X-QQFWM-PJD6G"
fi
! prepareInstall "$iso" "$dir" "$desc" "$arch" "$key" "$driver" && return 1
return 0
}
prepareLegacy() {
local iso="$1"
local dir="$2"
local desc="$3"
ETFS="boot.img"
[ -f "$dir/$ETFS" ] && [ -s "$dir/$ETFS" ] && return 0
rm -f "$dir/$ETFS"
local len offset
len=$(isoinfo -d -i "$iso" | grep "Nsect " | grep -o "[^ ]*$")
offset=$(isoinfo -d -i "$iso" | grep "Bootoff " | grep -o "[^ ]*$")
if ! dd "if=$iso" "of=$dir/$ETFS" bs=2048 "count=$len" "skip=$offset" status=none; then
error "Failed to extract boot image from $desc ISO!" && return 1
fi
[ -f "$dir/$ETFS" ] && [ -s "$dir/$ETFS" ] && return 0
error "Failed to locate file \"$ETFS\" in $desc ISO image!"
return 1
}
detectLegacy() {
local dir="$1"
local find find2
find=$(find "$dir" -maxdepth 1 -type d -iname win95 | head -n 1)
[ -n "$find" ] && DETECTED="win95" && return 0
find=$(find "$dir" -maxdepth 1 -type d -iname win98 | head -n 1)
[ -n "$find" ] && DETECTED="win98" && return 0
find=$(find "$dir" -maxdepth 1 -type d -iname win9x | head -n 1)
[ -n "$find" ] && DETECTED="win9x" && return 0
find=$(find "$dir" -maxdepth 1 -type f -iname cdrom_nt.5 | head -n 1)
[ -n "$find" ] && DETECTED="win2k" && return 0
find=$(find "$dir" -maxdepth 1 -type d -iname win51 | head -n 1)
find2=$(find "$dir" -maxdepth 1 -type f -iname setupxp.htm | head -n 1)
if [ -n "$find" ] || [ -n "$find2" ] || [ -f "$dir/WIN51AP" ] || [ -f "$dir/WIN51IC" ]; then
[ -d "$dir/AMD64" ] && DETECTED="winxpx64" && return 0
DETECTED="winxpx86" && return 0
fi
if [ -f "$dir/WIN51IA" ] || [ -f "$dir/WIN51IB" ] || [ -f "$dir/WIN51ID" ] || [ -f "$dir/WIN51IL" ] || [ -f "$dir/WIN51IS" ]; then
DETECTED="win2003r2" && return 0
fi
if [ -f "$dir/WIN51AA" ] || [ -f "$dir/WIN51AD" ] || [ -f "$dir/WIN51AS" ] || [ -f "$dir/WIN51MA" ] || [ -f "$dir/WIN51MD" ]; then
DETECTED="win2003r2" && return 0
fi
return 1
}
skipVersion() {
local id="$1"
case "${id,,}" in
"win9"* | "winxp"* | "win2k"* | "win2003"* )
return 0 ;;
esac
return 1
}
setMachine() {
local id="$1"
local iso="$2"
local dir="$3"
local desc="$4"
case "${id,,}" in
"win9"* | "win2k"* )
MACHINE="pc-i440fx-2.4" ;;
"winxp"* | "win2003"* | "winvistax86"* | "win7x86"* )
MACHINE="pc-q35-2.10" ;;
esac
case "${id,,}" in
"win9"* | "win2k"* | "winxp"* | "win2003"* )
HV="N"
BOOT_MODE="windows_legacy" ;;
"winvista"* | "win7"* | "win2008"* )
BOOT_MODE="windows_legacy" ;;
esac
case "${id,,}" in
"win9"* )
DISK_TYPE="auto"
ETFS="[BOOT]/Boot-1.44M.img" ;;
"win2k"* )
DISK_TYPE="auto"
ETFS="[BOOT]/Boot-NoEmul.img" ;;
"winxp"* )
DISK_TYPE="blk"
if ! prepareXP "$iso" "$dir" "$desc"; then
error "Failed to prepare $desc ISO!" && return 1
fi ;;
"win2003"* )
DISK_TYPE="blk"
if ! prepare2k3 "$iso" "$dir" "$desc"; then
error "Failed to prepare $desc ISO!" && return 1
fi ;;
esac
return 0
}
return 0

View File

@@ -23,7 +23,8 @@ cd /run
trap - ERR
info "Booting ${APP}${BOOT_DESC}..."
version=$(qemu-system-x86_64 --version | head -n 1 | cut -d '(' -f 1 | awk '{ print $NF }')
info "Booting ${APP}${BOOT_DESC} using QEMU v$version..."
{ qemu-system-x86_64 ${ARGS:+ $ARGS} >"$QEMU_OUT" 2>"$QEMU_LOG"; rc=$?; } || :
(( rc != 0 )) && error "$(<"$QEMU_LOG")" && exit 15

View File

@@ -119,10 +119,11 @@ finishInstall() {
fi
rm -f "$STORAGE/windows.old"
rm -f "$STORAGE/windows.type"
rm -f "$STORAGE/windows.vga"
rm -f "$STORAGE/windows.base"
rm -f "$STORAGE/windows.boot"
rm -f "$STORAGE/windows.mode"
rm -f "$STORAGE/windows.type"
cp -f /run/version "$STORAGE/windows.ver"
@@ -155,6 +156,10 @@ finishInstall() {
fi
fi
if [ -n "${VGA:-}" ] && [[ "${VGA:-}" != "virtio" ]] && [[ "${VGA:-}" != "ramfb" ]]; then
echo "$VGA" > "$STORAGE/windows.vga"
fi
if [ -n "${DISK_TYPE:-}" ] && [[ "${DISK_TYPE:-}" != "scsi" ]]; then
echo "$DISK_TYPE" > "$STORAGE/windows.type"
fi
@@ -167,10 +172,13 @@ abortInstall() {
local dir="$1"
local iso="$2"
local efi
[[ "${iso,,}" == *".esd" ]] && exit 60
if [ ! -d "$dir/EFI" ]; then
efi=$(find "$dir" -maxdepth 1 -type d -iname efi | head -n 1)
if [ -z "$efi" ]; then
[[ "${PLATFORM,,}" == "x64" ]] && BOOT_MODE="windows_legacy"
fi
@@ -489,19 +497,6 @@ setXML() {
return 0
}
skipVersion() {
local version="$1"
case "${version,,}" in
"win2k"* | "winxp"* | "win9"* )
return 0
;;
esac
return 1
}
detectImage() {
local dir="$1"
@@ -528,7 +523,12 @@ detectImage() {
fi
info "Detecting version from ISO image..."
detectLegacy "$dir" && return 0
if detectLegacy "$dir"; then
desc=$(printEdition "$DETECTED" "$DETECTED")
info "Detected: $desc"
return 0
fi
local src wim info
src=$(find "$dir" -maxdepth 1 -type d -iname sources | head -n 1)
@@ -565,7 +565,7 @@ detectImage() {
if [[ "${LANGUAGE,,}" != "en" ]] && [[ "${LANGUAGE,,}" != "en-"* ]]; then
language=$(getLanguage "$LANGUAGE" "desc")
desc="$desc ($language)"
desc=+" ($language)"
fi
info "Detected: $desc"
@@ -588,37 +588,12 @@ prepareImage() {
local iso="$1"
local dir="$2"
local missing
local desc missing
case "${DETECTED,,}" in
"win9"* | "win2k"* )
MACHINE="pc-i440fx-2.4" ;;
"winxp"* | "winvistax86"* | "win7x86"* )
MACHINE="pc-q35-2.10" ;;
esac
desc=$(printVersion "$DETECTED" "$DETECTED")
case "${DETECTED,,}" in
"win9"* | "winxp"* | "win2k"* )
HV="N"
BOOT_MODE="windows_legacy" ;;
"winvista"* | "win7"* | "win2008"* )
BOOT_MODE="windows_legacy" ;;
esac
case "${DETECTED,,}" in
"winxp"* )
DISK_TYPE="blk"
prepareXP "$iso" "$dir" && return 0
error "Failed to prepare Windows XP ISO!" && return 1 ;;
"win9"* )
DISK_TYPE="auto"
prepare9x "$iso" "$dir" && return 0
error "Failed to prepare Windows 9x ISO!" && return 1 ;;
"win2k"* )
DISK_TYPE="auto"
prepare2k "$iso" "$dir" && return 0
error "Failed to prepare Windows 2000 ISO!" && return 1 ;;
esac
! setMachine "$DETECTED" "$iso" "$dir" "$desc" && return 1
skipVersion "$DETECTED" && return 0
if [[ "${BOOT_MODE,,}" != "windows_legacy" ]]; then
@@ -627,13 +602,13 @@ prepareImage() {
missing=$(basename "$dir/$EFISYS")
[ ! -f "$dir/$ETFS" ] && missing=$(basename "$dir/$ETFS")
error "failed to locate file '${missing,,}' in ISO image!"
error "Failed to locate file \"${missing,,}\" in ISO image!"
return 1
fi
prepareLegacy "$iso" "$dir" && return 0
prepareLegacy "$iso" "$dir" "$desc" && return 0
error "Failed to extract boot image from ISO!"
error "Failed to extract boot image from ISO image!"
return 1
}
@@ -643,6 +618,12 @@ updateXML() {
local language="$2"
local culture region user admin pass keyboard
[ -z "$YRES" ] && YRES="720"
[ -z "$XRES" ] && XRES="1280"
sed -i "s/<VerticalResolution>1080<\/VerticalResolution>/<VerticalResolution>$YRES<\/VerticalResolution>/g" "$asset"
sed -i "s/<HorizontalResolution>1920<\/HorizontalResolution>/<HorizontalResolution>$XRES<\/HorizontalResolution>/g" "$asset"
culture=$(getLanguage "$language" "culture")
if [ -n "$culture" ] && [[ "${culture,,}" != "en-us" ]]; then
@@ -699,14 +680,14 @@ addDriver() {
case "${id,,}" in
"win7x86"* ) folder="w7/x86" ;;
"win7x64"* ) folder="w7/amd64" ;;
"win81x64"* ) folder="w10/amd64" ;;
"win81x64"* ) folder="w8.1/amd64" ;;
"win10x64"* ) folder="w10/amd64" ;;
"win11x64"* ) folder="w11/amd64" ;;
"win2025"* ) folder="2k22/amd64" ;;
"win2025"* ) folder="w11/amd64" ;;
"win2022"* ) folder="2k22/amd64" ;;
"win2019"* ) folder="2k19/amd64" ;;
"win2016"* ) folder="2k16/amd64" ;;
"win2012"* ) folder="2k16/amd64" ;;
"win2012"* ) folder="2k12R2/amd64" ;;
"win2008"* ) folder="2k8R2/amd64" ;;
"win10arm64"* ) folder="w10/ARM64" ;;
"win11arm64"* ) folder="w11/ARM64" ;;
@@ -943,6 +924,12 @@ buildImage() {
local msg="Building $desc image..."
info "$msg" && html "$msg"
[ -z "$LABEL" ] && LABEL="Windows"
if [ ! -f "$dir/$ETFS" ]; then
error "Failed to locate file \"$ETFS\" in ISO image!" && return 1
fi
size=$(du -h -b --max-depth=0 "$dir" | cut -f1)
size_gb=$(( (size + 1073741823)/1073741824 ))
space=$(df --output=avail -B 1 "$TMP" | tail -n 1)
@@ -952,8 +939,6 @@ buildImage() {
error "Not enough free space in $STORAGE, have $space_gb GB available but need at least $size_gb GB." && return 1
fi
[ -z "$LABEL" ] && LABEL="Windows"
if [[ "${BOOT_MODE,,}" != "windows_legacy" ]]; then
! genisoimage -o "$out" -b "$ETFS" -no-emul-boot -c "$cat" -iso-level 4 -J -l -D -N -joliet-long -relaxed-filenames -V "${LABEL::30}" \
@@ -962,7 +947,7 @@ buildImage() {
else
case "${DETECTED,,}" in
"win2k"* | "winxp"* )
"win2k"* | "winxp"* | "win2003"* )
! genisoimage -o "$out" -b "$ETFS" -no-emul-boot -boot-load-seg 1984 -boot-load-size 4 -c "$cat" -iso-level 2 -J -l -D -N -joliet-long \
-relaxed-filenames -V "${LABEL::30}" -quiet "$dir" 2> "$log" && failed="y" ;;
"win9"* )
@@ -993,10 +978,14 @@ bootWindows() {
rm -rf "$TMP"
[[ "${PLATFORM,,}" == "arm64" ]] && VGA="virtio-gpu"
if [ -s "$STORAGE/windows.vga" ] && [ -f "$STORAGE/windows.vga" ]; then
[ -z "${VGA:-}" ] && VGA=$(<"$STORAGE/windows.vga")
else
[ -z "${VGA:-}" ] && [[ "${PLATFORM,,}" == "arm64" ]] && VGA="virtio-gpu"
fi
if [ -s "$STORAGE/windows.type" ] && [ -f "$STORAGE/windows.type" ]; then
DISK_TYPE=$(<"$STORAGE/windows.type")
[ -z "${DISK_TYPE:-}" ] && DISK_TYPE=$(<"$STORAGE/windows.type")
fi
if [ -s "$STORAGE/windows.mode" ] && [ -f "$STORAGE/windows.mode" ]; then

View File

@@ -85,7 +85,7 @@ download_windows() {
local url="https://www.microsoft.com/en-us/software-download/windows$windows_version"
case "$windows_version" in
8 | 10) url="${url}ISO";;
8 | 10) url+="ISO";;
esac
# uuidgen: For MacOS (installed by default) and other systems (e.g. with no /proc) that don't have a kernel interface for generating random UUIDs
@@ -416,8 +416,12 @@ getESD() {
local fFile="products_filter.xml"
{ wget "$winCatalog" -O "$dir/$wFile" -q --timeout=30; rc=$?; } || :
(( rc == 4 )) && error "Failed to download $winCatalog , network failure!" && return 1
(( rc != 0 )) && error "Failed to download $winCatalog , reason: $rc" && return 1
msg="Failed to download $winCatalog"
(( rc == 3 )) && error "$msg , cannot write file (disk full?)" && return 1
(( rc == 4 )) && error "$msg , network failure!" && return 1
(( rc == 8 )) && error "$msg , server issued an error response!" && return 1
(( rc != 0 )) && error "$msg , reason: $rc" && return 1
cd "$dir"
@@ -495,8 +499,6 @@ verifyFile() {
fi
error "The downloaded file has an invalid $algo checksum: $hash , while expected value was: $check. Please report this at $SUPPORT/issues"
rm -f "$iso"
return 1
}
@@ -508,10 +510,16 @@ downloadFile() {
local size="$4"
local lang="$5"
local desc="$6"
local rc total progress domain dots
local rc total progress domain dots space folder
rm -f "$iso"
if [ -n "$size" ] && [[ "$size" != "0" ]]; then
folder=$(dirname -- "$iso")
space=$(df --output=avail -B 1 "$folder" | tail -n 1)
(( size > space )) && error "Not enough free space left to download file!" && return 1
fi
# Check if running with interactive TTY or redirected to docker log
if [ -t 1 ]; then
progress="--progress=bar:noscroll"
@@ -519,19 +527,19 @@ downloadFile() {
progress="--progress=dot:giga"
fi
local msg="Downloading $desc..."
html "$msg"
local msg="Downloading $desc"
html "$msg..."
domain=$(echo "$url" | awk -F/ '{print $3}')
dots=$(echo "$domain" | tr -cd '.' | wc -c)
(( dots > 1 )) && domain=$(expr "$domain" : '.*\.\(.*\..*\)')
if [ -n "$domain" ] && [[ "${domain,,}" != *"microsoft.com" ]]; then
msg="Downloading $desc from $domain..."
msg="Downloading $desc from $domain"
fi
info "$msg"
/run/progress.sh "$iso" "$size" "Downloading $desc ([P])..." &
info "$msg..."
/run/progress.sh "$iso" "$size" "$msg ([P])..." &
{ wget "$url" -O "$iso" -q --timeout=30 --show-progress "$progress"; rc=$?; } || :
@@ -539,19 +547,19 @@ downloadFile() {
if (( rc == 0 )) && [ -f "$iso" ]; then
total=$(stat -c%s "$iso")
if [ "$total" -gt 100000000 ]; then
! verifyFile "$iso" "$size" "$total" "$sum" && return 1
html "Download finished successfully..." && return 0
if [ "$total" -lt 100000000 ]; then
error "Downloaded ISO is only $total bytes?" && return 1
fi
! verifyFile "$iso" "$size" "$total" "$sum" && return 1
html "Download finished successfully..." && return 0
fi
if (( rc != 4 )); then
error "Failed to download $url , reason: $rc"
else
error "Failed to download $url , network failure!"
fi
msg="Failed to download $url"
(( rc == 3 )) && error "$msg , cannot write file (disk full?)" && return 1
(( rc == 4 )) && error "$msg , network failure!" && return 1
(( rc == 8 )) && error "$msg , server issued an error response!" && return 1
rm -f "$iso"
error "$msg , reason: $rc"
return 1
}
@@ -567,6 +575,7 @@ downloadImage() {
base=$(basename "$iso")
desc=$(fromFile "$base")
downloadFile "$iso" "$version" "" "" "" "$desc" && return 0
rm -f "$iso"
return 1
fi
@@ -582,7 +591,7 @@ downloadImage() {
desc=$(printEdition "$version" "$desc")
error "The $language language version of $desc is not available, please switch to English." && return 1
fi
desc="$desc in $language"
desc+=" in $language"
fi
if isMido "$version" "$lang"; then
@@ -591,6 +600,7 @@ downloadImage() {
size=$(getMido "$version" "$lang" "size" )
sum=$(getMido "$version" "$lang" "sum")
downloadFile "$iso" "$MIDO_URL" "$sum" "$size" "$lang" "$desc" && return 0
rm -f "$iso"
fi
fi
@@ -607,6 +617,7 @@ downloadImage() {
if getESD "$TMP/esd" "$version" "$lang" "$desc"; then
ISO="${ISO%.*}.esd"
downloadFile "$ISO" "$ESD" "$ESD_SUM" "$ESD_SIZE" "$lang" "$desc" && return 0
rm -f "$ISO"
ISO="$iso"
fi
@@ -624,6 +635,7 @@ downloadImage() {
size=$(getSize "$i" "$version" "$lang")
sum=$(getHash "$i" "$version" "$lang")
downloadFile "$iso" "$url" "$sum" "$size" "$lang" "$desc" && return 0
rm -f "$iso"
fi
done

View File

@@ -216,7 +216,7 @@ _graceful_shutdown() {
SERIAL="pty"
MONITOR="telnet:localhost:$QEMU_PORT,server,nowait,nodelay"
MONITOR="$MONITOR -daemonize -D $QEMU_LOG -pidfile $QEMU_PID"
MONITOR+=" -daemonize -D $QEMU_LOG -pidfile $QEMU_PID"
_trap _graceful_shutdown SIGTERM SIGHUP SIGINT SIGABRT SIGQUIT

View File

@@ -3,8 +3,8 @@ set -Eeuo pipefail
: "${SAMBA:="Y"}"
[[ "$SAMBA" != [Yy1]* ]] && return 0
[[ "$NETWORK" != [Yy1]* ]] && return 0
[[ "$SAMBA" == [Nn]* ]] && return 0
[[ "$NETWORK" == [Nn]* ]] && return 0
hostname="host.lan"
interface="dockerbridge"
@@ -21,7 +21,32 @@ if [ ! -d "$share" ] && [ -d "$STORAGE/shared" ]; then
fi
mkdir -p "$share"
[ -z "$(ls -A "$share")" ] && chmod 777 "$share"
if [ -z "$(ls -A "$share")" ]; then
chmod 777 "$share"
{ echo "--------------------------------------------------------"
echo " $APP for Docker v$(</run/version)..."
echo " For support visit $SUPPORT"
echo "--------------------------------------------------------"
echo ""
echo "Using this folder you can share files with the host machine."
echo ""
echo "To change its location, include the following bind mount in your compose file:"
echo ""
echo " volumes:"
echo " - \"/home/user/example:/shared\""
echo ""
echo "Or in your run command:"
echo ""
echo " -v \"/home/user/example:/shared\""
echo ""
echo "Replace the example path /home/user/example with the desired shared folder."
echo ""
} | unix2dos > "$share/readme.txt"
fi
{ echo "[global]"
echo " server string = Dockur"
@@ -50,41 +75,27 @@ mkdir -p "$share"
echo " force group = root"
} > "/etc/samba/smb.conf"
{ echo "--------------------------------------------------------"
echo " $APP for Docker v$(</run/version)..."
echo " For support visit $SUPPORT"
echo "--------------------------------------------------------"
echo ""
echo "Using this folder you can share files with the host machine."
echo ""
echo "To change its location, include the following bind mount in your compose file:"
echo ""
echo " volumes:"
echo " - \"/home/user/example:/shared\""
echo ""
echo "Or in your run command:"
echo ""
echo " -v \"/home/user/example:/shared\""
echo ""
echo "Replace the example path /home/user/example with the desired shared folder."
echo ""
} | unix2dos > "$share/readme.txt"
if ! smbd; then
error "Samba daemon failed to start!"
smbd -i --debug-stdout || true
fi
! smbd && smbd --debug-stdout
legacy="N"
legacy=""
if [ -f "$STORAGE/windows.old" ]; then
MT=$(<"$STORAGE/windows.old")
[[ "${MT,,}" == "pc-q35-2"* ]] && legacy="Y"
[[ "${MT,,}" == "pc-q35-2"* ]] && legacy="y"
[[ "${MT,,}" == "pc-i440fx-2"* ]] && legacy="y"
fi
if [[ "$legacy" == [Yy1]* ]]; then
[[ "$DHCP" == [Yy1]* ]] && return 0
# Enable NetBIOS on Windows XP
! nmbd && nmbd --debug-stdout
if [ -n "$legacy" ]; then
# Enable NetBIOS on Windows XP and lower
if ! nmbd; then
error "NetBIOS daemon failed to start!"
nmbd -i --debug-stdout || true
fi
else
# Enable Web Service Discovery
# Enable Web Service Discovery on Vista and up
wsdd -i "$interface" -p -n "$hostname" &
echo "$!" > /var/run/wsdd.pid
fi