mirror of
https://github.com/dockur/windows.git
synced 2026-01-22 02:43:06 +00:00
Compare commits
27 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8a5f233e34 | ||
|
|
2a98081549 | ||
|
|
56cb787c55 | ||
|
|
da9ef0e061 | ||
|
|
b02f65a41e | ||
|
|
7921b1eb54 | ||
|
|
463ec9fb49 | ||
|
|
3a871e4ac5 | ||
|
|
ab6ba410b3 | ||
|
|
8f6f73dab7 | ||
|
|
6aee02b4e1 | ||
|
|
59b98fe211 | ||
|
|
787f815527 | ||
|
|
77358f0632 | ||
|
|
68457e56d6 | ||
|
|
f50b5d1564 | ||
|
|
bd3245595f | ||
|
|
7e4afc3c43 | ||
|
|
0fa4217d1b | ||
|
|
05896606cd | ||
|
|
aed184eb54 | ||
|
|
cbe7d6e565 | ||
|
|
8544ce03b2 | ||
|
|
515b6f51a4 | ||
|
|
f49a336efa | ||
|
|
537c8e8247 | ||
|
|
0f2717fec4 |
@@ -6,6 +6,8 @@
|
|||||||
.gitmodules
|
.gitmodules
|
||||||
Dockerfile
|
Dockerfile
|
||||||
Dockerfile.archive
|
Dockerfile.archive
|
||||||
|
compose.yml
|
||||||
|
compose.yaml
|
||||||
docker-compose.yml
|
docker-compose.yml
|
||||||
|
docker-compose.yaml
|
||||||
*.md
|
*.md
|
||||||
|
|||||||
7
.github/workflows/build.yml
vendored
7
.github/workflows/build.yml
vendored
@@ -92,6 +92,13 @@ jobs:
|
|||||||
uses: action-pack/bump@v2
|
uses: action-pack/bump@v2
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.REPO_ACCESS_TOKEN }}
|
token: ${{ secrets.REPO_ACCESS_TOKEN }}
|
||||||
|
-
|
||||||
|
name: Push to Gitlab mirror
|
||||||
|
uses: action-pack/gitlab-sync@v3
|
||||||
|
with:
|
||||||
|
url: ${{ secrets.GITLAB_URL }}
|
||||||
|
token: ${{ secrets.GITLAB_TOKEN }}
|
||||||
|
username: ${{ secrets.GITLAB_USERNAME }}
|
||||||
-
|
-
|
||||||
name: Send mail
|
name: Send mail
|
||||||
uses: action-pack/send-mail@v1
|
uses: action-pack/send-mail@v1
|
||||||
|
|||||||
2
.github/workflows/check.yml
vendored
2
.github/workflows/check.yml
vendored
@@ -21,5 +21,5 @@ jobs:
|
|||||||
uses: hadolint/hadolint-action@v3.1.0
|
uses: hadolint/hadolint-action@v3.1.0
|
||||||
with:
|
with:
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
ignore: DL3008
|
ignore: DL3008,DL4006,SC3037
|
||||||
failure-threshold: warning
|
failure-threshold: warning
|
||||||
|
|||||||
23
Dockerfile
23
Dockerfile
@@ -1,29 +1,32 @@
|
|||||||
FROM scratch
|
FROM scratch
|
||||||
COPY --from=qemux/qemu-docker:4.14 / /
|
COPY --from=qemux/qemu-docker:4.22 / /
|
||||||
|
|
||||||
ARG DEBCONF_NOWARNINGS="yes"
|
ARG DEBCONF_NOWARNINGS "yes"
|
||||||
ARG DEBIAN_FRONTEND "noninteractive"
|
ARG DEBIAN_FRONTEND "noninteractive"
|
||||||
ARG DEBCONF_NONINTERACTIVE_SEEN "true"
|
ARG DEBCONF_NONINTERACTIVE_SEEN "true"
|
||||||
|
|
||||||
RUN apt-get update \
|
RUN apt-get update && \
|
||||||
&& apt-get --no-install-recommends -y install \
|
apt-get --no-install-recommends -y install \
|
||||||
curl \
|
curl \
|
||||||
7zip \
|
7zip \
|
||||||
wsdd \
|
wsdd \
|
||||||
samba \
|
samba \
|
||||||
wimtools \
|
|
||||||
dos2unix \
|
dos2unix \
|
||||||
cabextract \
|
cabextract \
|
||||||
genisoimage \
|
genisoimage \
|
||||||
libxml2-utils \
|
libxml2-utils && \
|
||||||
&& apt-get clean \
|
echo "deb http://deb.debian.org/debian/ sid main" >> /etc/apt/sources.list.d/sid.list && \
|
||||||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
echo -e "Package: *\nPin: release n=trixie\nPin-Priority: 900\nPackage: *\nPin: release n=sid\nPin-Priority: 400" | tee /etc/apt/preferences.d/preferences > /dev/null && \
|
||||||
|
apt-get update && \
|
||||||
|
apt-get -t sid --no-install-recommends -y install wimtools && \
|
||||||
|
apt-get clean && \
|
||||||
|
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||||
|
|
||||||
COPY ./src /run/
|
COPY ./src /run/
|
||||||
COPY ./assets /run/assets
|
COPY ./assets /run/assets
|
||||||
|
|
||||||
ADD https://raw.githubusercontent.com/christgau/wsdd/master/src/wsdd.py /usr/sbin/wsdd
|
ADD https://raw.githubusercontent.com/christgau/wsdd/v0.8/src/wsdd.py /usr/sbin/wsdd
|
||||||
ADD https://github.com/qemus/virtiso/releases/download/v0.1.240/virtio-win-0.1.240.iso /run/drivers.iso
|
ADD https://github.com/qemus/virtiso/releases/download/v0.1.248/virtio-win-0.1.248.iso /run/drivers.iso
|
||||||
|
|
||||||
RUN chmod +x /run/*.sh && chmod +x /usr/sbin/wsdd
|
RUN chmod +x /run/*.sh && chmod +x /usr/sbin/wsdd
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ services:
|
|||||||
windows:
|
windows:
|
||||||
image: dockurr/windows
|
image: dockurr/windows
|
||||||
container_name: windows
|
container_name: windows
|
||||||
|
environment:
|
||||||
|
VERSION: "win11"
|
||||||
devices:
|
devices:
|
||||||
- /dev/kvm
|
- /dev/kvm
|
||||||
cap_add:
|
cap_add:
|
||||||
28
readme.md
28
readme.md
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
</div></h1>
|
</div></h1>
|
||||||
|
|
||||||
Windows in a docker container.
|
Windows in a Docker container.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
@@ -19,9 +19,13 @@ Windows in a docker container.
|
|||||||
- KVM acceleration
|
- KVM acceleration
|
||||||
- Web-based viewer
|
- Web-based viewer
|
||||||
|
|
||||||
|
## Video
|
||||||
|
|
||||||
|
[](https://www.youtube.com/watch?v=xhGYobuG508)
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Via `docker-compose.yml`
|
Via Docker Compose:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: "3"
|
version: "3"
|
||||||
@@ -29,6 +33,8 @@ services:
|
|||||||
windows:
|
windows:
|
||||||
image: dockurr/windows
|
image: dockurr/windows
|
||||||
container_name: windows
|
container_name: windows
|
||||||
|
environment:
|
||||||
|
VERSION: "win11"
|
||||||
devices:
|
devices:
|
||||||
- /dev/kvm
|
- /dev/kvm
|
||||||
cap_add:
|
cap_add:
|
||||||
@@ -41,10 +47,10 @@ services:
|
|||||||
restart: on-failure
|
restart: on-failure
|
||||||
```
|
```
|
||||||
|
|
||||||
Via `docker run`
|
Via Docker CLI:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker run -it --rm -p 8006:8006 --device=/dev/kvm --cap-add NET_ADMIN --stop-timeout 120 dockurr/windows
|
docker run -it --rm --name windows -p 8006:8006 --device=/dev/kvm --cap-add NET_ADMIN --stop-timeout 120 dockurr/windows
|
||||||
```
|
```
|
||||||
|
|
||||||
## FAQ
|
## FAQ
|
||||||
@@ -94,6 +100,14 @@ docker run -it --rm -p 8006:8006 --device=/dev/kvm --cap-add NET_ADMIN --stop-ti
|
|||||||
|
|
||||||
To install ARM64 versions of Windows use [dockur/windows-arm](https://github.com/dockur/windows-arm/).
|
To install ARM64 versions of Windows use [dockur/windows-arm](https://github.com/dockur/windows-arm/).
|
||||||
|
|
||||||
|
* ### 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.
|
||||||
|
|
||||||
|
So for a better experience you can connect using any Microsoft Remote Desktop client to the IP of the container, using the username `docker` and by leaving the password empty.
|
||||||
|
|
||||||
|
There is a good 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 increase the amount of CPU or RAM?
|
* ### How do I increase the amount of CPU or RAM?
|
||||||
|
|
||||||
By default, 2 CPU cores and 4 GB of RAM are allocated to the container, as those are the minimum requirements of Windows 11.
|
By default, 2 CPU cores and 4 GB of RAM are allocated to the container, as those are the minimum requirements of Windows 11.
|
||||||
@@ -136,7 +150,7 @@ docker run -it --rm -p 8006:8006 --device=/dev/kvm --cap-add NET_ADMIN --stop-ti
|
|||||||
|
|
||||||
* ### How do I install a custom image?
|
* ### How do I install a custom image?
|
||||||
|
|
||||||
In order to download a custom ISO image, start a clean container with the URL specified in the `VERSION` environment variable:
|
In order to download a custom ISO image, start a clean container with the URL of the ISO specified in the `VERSION` environment variable:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
environment:
|
environment:
|
||||||
@@ -219,6 +233,8 @@ docker run -it --rm -p 8006:8006 --device=/dev/kvm --cap-add NET_ADMIN --stop-ti
|
|||||||
```yaml
|
```yaml
|
||||||
environment:
|
environment:
|
||||||
DHCP: "Y"
|
DHCP: "Y"
|
||||||
|
devices:
|
||||||
|
- /dev/vhost-net
|
||||||
device_cgroup_rules:
|
device_cgroup_rules:
|
||||||
- 'c *:* rwm'
|
- 'c *:* rwm'
|
||||||
```
|
```
|
||||||
@@ -264,7 +280,7 @@ docker run -it --rm -p 8006:8006 --device=/dev/kvm --cap-add NET_ADMIN --stop-ti
|
|||||||
|
|
||||||
* ### Is this project legal?
|
* ### Is this project legal?
|
||||||
|
|
||||||
Yes, this project contains only open-source code and does not distribute any copyrighted material. Neither does it try to circumvent any copyright protection measures. So under all applicable laws, this project would be considered 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 would be considered legal.
|
||||||
|
|
||||||
## Stars
|
## Stars
|
||||||
[](https://starchart.cc/dockur/windows)
|
[](https://starchart.cc/dockur/windows)
|
||||||
|
|||||||
10
src/entry.sh
10
src/entry.sh
@@ -1,8 +1,9 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -Eeuo pipefail
|
set -Eeuo pipefail
|
||||||
|
|
||||||
|
: "${BOOT_MODE:="windows"}"
|
||||||
|
|
||||||
APP="Windows"
|
APP="Windows"
|
||||||
BOOT_MODE="windows"
|
|
||||||
SUPPORT="https://github.com/dockur/windows"
|
SUPPORT="https://github.com/dockur/windows"
|
||||||
|
|
||||||
cd /run
|
cd /run
|
||||||
@@ -23,6 +24,10 @@ trap - ERR
|
|||||||
info "Booting $APP using $VERS..."
|
info "Booting $APP using $VERS..."
|
||||||
[[ "$DEBUG" == [Yy1]* ]] && echo "Arguments: $ARGS" && echo
|
[[ "$DEBUG" == [Yy1]* ]] && echo "Arguments: $ARGS" && echo
|
||||||
|
|
||||||
|
if [[ "$CONSOLE" == [Yy]* ]]; then
|
||||||
|
exec qemu-system-x86_64 ${ARGS:+ $ARGS}
|
||||||
|
fi
|
||||||
|
|
||||||
{ qemu-system-x86_64 ${ARGS:+ $ARGS} >"$QEMU_OUT" 2>"$QEMU_LOG"; rc=$?; } || :
|
{ qemu-system-x86_64 ${ARGS:+ $ARGS} >"$QEMU_OUT" 2>"$QEMU_LOG"; rc=$?; } || :
|
||||||
(( rc != 0 )) && error "$(<"$QEMU_LOG")" && exit 15
|
(( rc != 0 )) && error "$(<"$QEMU_LOG")" && exit 15
|
||||||
|
|
||||||
@@ -31,4 +36,5 @@ tail -fn +0 "$QEMU_LOG" 2>/dev/null &
|
|||||||
cat "$QEMU_TERM" 2> /dev/null | tee "$QEMU_PTY" &
|
cat "$QEMU_TERM" 2> /dev/null | tee "$QEMU_PTY" &
|
||||||
wait $! || :
|
wait $! || :
|
||||||
|
|
||||||
sleep 1 && finish 0
|
sleep 1 & wait $!
|
||||||
|
finish 0
|
||||||
|
|||||||
114
src/install.sh
114
src/install.sh
@@ -72,7 +72,7 @@ fi
|
|||||||
|
|
||||||
if [[ "${VERSION,,}" == "winxpx86" ]]; then
|
if [[ "${VERSION,,}" == "winxpx86" ]]; then
|
||||||
DETECTED="winxpx86"
|
DETECTED="winxpx86"
|
||||||
VERSION="https://dl.bobpony.com/windows/xp/professional/en_windows_xp_professional_with_service_pack_3_x86_cd_vl_x14-73974.iso"
|
VERSION="https://dl.bobpony.com/windows/xp/professional/en_windows_xp_professional_with_service_pack_3_x86_cd_x14-80428.iso"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${VERSION,,}" == "core11" ]]; then
|
if [[ "${VERSION,,}" == "core11" ]]; then
|
||||||
@@ -93,6 +93,7 @@ fi
|
|||||||
CUSTOM=$(find "$STORAGE" -maxdepth 1 -type f -iname custom.iso -printf "%f\n" | head -n 1)
|
CUSTOM=$(find "$STORAGE" -maxdepth 1 -type f -iname custom.iso -printf "%f\n" | head -n 1)
|
||||||
[ -z "$CUSTOM" ] && CUSTOM=$(find "$STORAGE" -maxdepth 1 -type f -iname boot.iso -printf "%f\n" | head -n 1)
|
[ -z "$CUSTOM" ] && CUSTOM=$(find "$STORAGE" -maxdepth 1 -type f -iname boot.iso -printf "%f\n" | head -n 1)
|
||||||
[ -z "$CUSTOM" ] && CUSTOM=$(find "$STORAGE" -maxdepth 1 -type f -iname custom.img -printf "%f\n" | head -n 1)
|
[ -z "$CUSTOM" ] && CUSTOM=$(find "$STORAGE" -maxdepth 1 -type f -iname custom.img -printf "%f\n" | head -n 1)
|
||||||
|
[ -z "$CUSTOM" ] && CUSTOM=$(find "$STORAGE" -maxdepth 1 -type f -iname "${VERSION/\/storage\//}" -printf "%f\n" | head -n 1)
|
||||||
|
|
||||||
ESD_URL=""
|
ESD_URL=""
|
||||||
MACHINE="q35"
|
MACHINE="q35"
|
||||||
@@ -203,7 +204,7 @@ hasDisk() {
|
|||||||
|
|
||||||
[ -b "${DEVICE:-}" ] && return 0
|
[ -b "${DEVICE:-}" ] && return 0
|
||||||
|
|
||||||
if [ -f "$STORAGE/data.img" ] || [ -f "$STORAGE/data.qcow2" ]; then
|
if [ -s "$STORAGE/data.img" ] || [ -s "$STORAGE/data.qcow2" ]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -309,6 +310,8 @@ startInstall() {
|
|||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
|
rm -f "$STORAGE/$BASE"
|
||||||
|
|
||||||
if skipInstall; then
|
if skipInstall; then
|
||||||
BASE=""
|
BASE=""
|
||||||
return 1
|
return 1
|
||||||
@@ -316,6 +319,7 @@ startInstall() {
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
rm -rf "$TMP"
|
||||||
mkdir -p "$TMP"
|
mkdir -p "$TMP"
|
||||||
|
|
||||||
if [ ! -f "$STORAGE/$CUSTOM" ]; then
|
if [ ! -f "$STORAGE/$CUSTOM" ]; then
|
||||||
@@ -325,7 +329,6 @@ startInstall() {
|
|||||||
ISO="$STORAGE/$CUSTOM"
|
ISO="$STORAGE/$CUSTOM"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f "$TMP/$BASE"
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -369,7 +372,7 @@ getESD() {
|
|||||||
|
|
||||||
cd /run
|
cd /run
|
||||||
|
|
||||||
if [ ! -f "$dir/products.xml" ]; then
|
if [ ! -s "$dir/products.xml" ]; then
|
||||||
error "Failed to find products.xml!" && return 1
|
error "Failed to find products.xml!" && return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -433,7 +436,7 @@ downloadImage() {
|
|||||||
|
|
||||||
if (( rc == 0 )); then
|
if (( rc == 0 )); then
|
||||||
|
|
||||||
[ ! -f "$iso" ] && return 1
|
[ ! -s "$iso" ] && return 1
|
||||||
|
|
||||||
html "Download finished successfully..."
|
html "Download finished successfully..."
|
||||||
return 0
|
return 0
|
||||||
@@ -445,6 +448,9 @@ downloadImage() {
|
|||||||
|
|
||||||
info "Failed to download $desc using Mido, will try a different method now..."
|
info "Failed to download $desc using Mido, will try a different method now..."
|
||||||
|
|
||||||
|
rm -rf "$TMP"
|
||||||
|
mkdir -p "$TMP"
|
||||||
|
|
||||||
ISO="$TMP/$VERSION.esd"
|
ISO="$TMP/$VERSION.esd"
|
||||||
iso="$ISO"
|
iso="$ISO"
|
||||||
file="$ISO"
|
file="$ISO"
|
||||||
@@ -473,7 +479,7 @@ downloadImage() {
|
|||||||
fKill "progress.sh"
|
fKill "progress.sh"
|
||||||
(( rc != 0 )) && error "Failed to download $url , reason: $rc" && exit 60
|
(( rc != 0 )) && error "Failed to download $url , reason: $rc" && exit 60
|
||||||
|
|
||||||
[ ! -f "$iso" ] && return 1
|
[ ! -s "$iso" ] && return 1
|
||||||
|
|
||||||
html "Download finished successfully..."
|
html "Download finished successfully..."
|
||||||
return 0
|
return 0
|
||||||
@@ -573,6 +579,7 @@ extractImage() {
|
|||||||
|
|
||||||
if [[ "${iso,,}" == *".esd" ]]; then
|
if [[ "${iso,,}" == *".esd" ]]; then
|
||||||
if ! extractESD "$iso" "$dir"; then
|
if ! extractESD "$iso" "$dir"; then
|
||||||
|
rm -f "$iso"
|
||||||
error "Failed to extract ESD file!"
|
error "Failed to extract ESD file!"
|
||||||
exit 67
|
exit 67
|
||||||
fi
|
fi
|
||||||
@@ -604,6 +611,7 @@ extractImage() {
|
|||||||
rm -rf "$dir"
|
rm -rf "$dir"
|
||||||
|
|
||||||
if ! 7z x "$iso" -o"$dir" > /dev/null; then
|
if ! 7z x "$iso" -o"$dir" > /dev/null; then
|
||||||
|
rm -f "$iso"
|
||||||
error "Failed to extract ISO file!"
|
error "Failed to extract ISO file!"
|
||||||
exit 66
|
exit 66
|
||||||
fi
|
fi
|
||||||
@@ -626,7 +634,7 @@ detectImage() {
|
|||||||
|
|
||||||
if [ -n "$DETECTED" ]; then
|
if [ -n "$DETECTED" ]; then
|
||||||
|
|
||||||
if [ -f "/run/assets/$DETECTED.xml" ]; then
|
if [ -s "/run/assets/$DETECTED.xml" ]; then
|
||||||
[[ "$MANUAL" != [Yy1]* ]] && XML="$DETECTED.xml"
|
[[ "$MANUAL" != [Yy1]* ]] && XML="$DETECTED.xml"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
@@ -645,7 +653,7 @@ detectImage() {
|
|||||||
|
|
||||||
info "Detecting Windows version from ISO image..."
|
info "Detecting Windows version from ISO image..."
|
||||||
|
|
||||||
if [ -f "$dir/WIN51" ] || [ -f "$dir/SETUPXP.HTM" ]; then
|
if [ -s "$dir/WIN51" ] || [ -s "$dir/SETUPXP.HTM" ]; then
|
||||||
DETECTED="winxpx86"
|
DETECTED="winxpx86"
|
||||||
info "Detected: Windows XP"
|
info "Detected: Windows XP"
|
||||||
return 0
|
return 0
|
||||||
@@ -661,9 +669,9 @@ detectImage() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
loc=$(find "$src" -maxdepth 1 -type f -iname install.wim | head -n 1)
|
loc=$(find "$src" -maxdepth 1 -type f -iname install.wim | head -n 1)
|
||||||
[ ! -f "$loc" ] && loc=$(find "$src" -maxdepth 1 -type f -iname install.esd | head -n 1)
|
[ ! -s "$loc" ] && loc=$(find "$src" -maxdepth 1 -type f -iname install.esd | head -n 1)
|
||||||
|
|
||||||
if [ ! -f "$loc" ]; then
|
if [ ! -s "$loc" ]; then
|
||||||
warn "failed to locate 'install.wim' or 'install.esd' in ISO image, $FB"
|
warn "failed to locate 'install.wim' or 'install.esd' in ISO image, $FB"
|
||||||
BOOT_MODE="windows_legacy"
|
BOOT_MODE="windows_legacy"
|
||||||
return 1
|
return 1
|
||||||
@@ -691,7 +699,7 @@ detectImage() {
|
|||||||
desc=$(printVersion "$DETECTED")
|
desc=$(printVersion "$DETECTED")
|
||||||
[ -z "$desc" ] && desc="$DETECTED"
|
[ -z "$desc" ] && desc="$DETECTED"
|
||||||
|
|
||||||
if [ -f "/run/assets/$DETECTED.xml" ]; then
|
if [ -s "/run/assets/$DETECTED.xml" ]; then
|
||||||
[[ "$MANUAL" != [Yy1]* ]] && XML="$DETECTED.xml"
|
[[ "$MANUAL" != [Yy1]* ]] && XML="$DETECTED.xml"
|
||||||
info "Detected: $desc"
|
info "Detected: $desc"
|
||||||
else
|
else
|
||||||
@@ -763,12 +771,12 @@ prepareXP() {
|
|||||||
sed -i '/^\[SCSI\]/s/$/\niaStor=\"Intel\(R\) SATA RAID\/AHCI Controller\"/' "$target/TXTSETUP.SIF"
|
sed -i '/^\[SCSI\]/s/$/\niaStor=\"Intel\(R\) SATA RAID\/AHCI Controller\"/' "$target/TXTSETUP.SIF"
|
||||||
sed -i '/^\[HardwareIdsDatabase\]/s/$/\nPCI\\VEN_8086\&DEV_2922\&CC_0106=\"iaStor\"/' "$target/TXTSETUP.SIF"
|
sed -i '/^\[HardwareIdsDatabase\]/s/$/\nPCI\\VEN_8086\&DEV_2922\&CC_0106=\"iaStor\"/' "$target/TXTSETUP.SIF"
|
||||||
|
|
||||||
local key="M6TF9-8XQ2M-YQK9F-7TBB2-XGG88"
|
# Windows XP Pro generic key (no activation)
|
||||||
[[ "${arch,,}" == "amd64" ]] && key="B66VY-4D94T-TPPD4-43F72-8X4FY"
|
local key="DR8GV-C8V6J-BYXHG-7PYJR-DB66Y"
|
||||||
|
|
||||||
find "$target" -maxdepth 1 -type f -iname winnt.sif -exec rm {} \;
|
find "$target" -maxdepth 1 -type f -iname winnt.sif -exec rm {} \;
|
||||||
|
|
||||||
{ echo "[Data]"
|
{ echo "[Data]"
|
||||||
echo "AutoPartition=1"
|
echo "AutoPartition=1"
|
||||||
echo "MsDosInitiated=\"0\""
|
echo "MsDosInitiated=\"0\""
|
||||||
echo "UnattendedInstall=\"Yes\""
|
echo "UnattendedInstall=\"Yes\""
|
||||||
@@ -811,10 +819,12 @@ prepareXP() {
|
|||||||
echo "[Networking]"
|
echo "[Networking]"
|
||||||
echo "InstallDefaultComponents=Yes"
|
echo "InstallDefaultComponents=Yes"
|
||||||
echo ""
|
echo ""
|
||||||
|
echo "[Branding]"
|
||||||
|
echo "BrandIEUsingUnattended=Yes"
|
||||||
|
echo ""
|
||||||
echo "[URL]"
|
echo "[URL]"
|
||||||
echo "Home_Page = http://www.google.com"
|
echo "Home_Page = http://www.google.com"
|
||||||
echo "Search_Page = http://www.google.com/ie_rsearch.html"
|
echo "Search_Page = http://www.google.com"
|
||||||
echo "AutoConfig = 0"
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "[RegionalSettings]"
|
echo "[RegionalSettings]"
|
||||||
echo "Language=00000409"
|
echo "Language=00000409"
|
||||||
@@ -823,6 +833,57 @@ prepareXP() {
|
|||||||
echo "AllowConnections=1"
|
echo "AllowConnections=1"
|
||||||
} | unix2dos > "$target/WINNT.SIF"
|
} | unix2dos > "$target/WINNT.SIF"
|
||||||
|
|
||||||
|
{ echo "Windows Registry Editor Version 5.00"
|
||||||
|
echo ""
|
||||||
|
echo "[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Security]"
|
||||||
|
echo "\"FirstRunDisabled\"=dword:00000001"
|
||||||
|
echo "\"AntiVirusOverride\"=dword:00000001"
|
||||||
|
echo "\"FirewallOverride\"=dword:00000001"
|
||||||
|
echo "\"FirewallDisableNotify\"=dword:00000001"
|
||||||
|
echo "\"UpdatesDisableNotify\"=dword:00000001"
|
||||||
|
echo "\"AntiVirusDisableNotify\"=dword:00000001"
|
||||||
|
echo ""
|
||||||
|
echo "[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wscsvc]"
|
||||||
|
echo "\"Start\"=dword:00000004"
|
||||||
|
echo ""
|
||||||
|
echo "[HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\WindowsFirewall\StandardProfile]"
|
||||||
|
echo "\"EnableFirewall\"=dword:00000000"
|
||||||
|
echo ""
|
||||||
|
echo "[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess]"
|
||||||
|
echo "\"Start\"=dword:00000004"
|
||||||
|
echo
|
||||||
|
echo "[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\GloballyOpenPorts\List]"
|
||||||
|
echo "\"3389:TCP\"=\"3389:TCP:*:Enabled:@xpsp2res.dll,-22009\""
|
||||||
|
echo ""
|
||||||
|
echo "[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa]"
|
||||||
|
echo "\"LimitBlankPasswordUse\"=dword:00000000"
|
||||||
|
echo ""
|
||||||
|
echo "[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Tour]"
|
||||||
|
echo "\"RunCount\"=dword:00000000"
|
||||||
|
echo ""
|
||||||
|
echo "[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]"
|
||||||
|
echo "\"HideFileExt\"=dword:00000000"
|
||||||
|
echo ""
|
||||||
|
echo "[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]"
|
||||||
|
echo "\"DefaultUserName\"=\"Docker\""
|
||||||
|
echo "\"DefaultDomainName\"=\"Dockur\""
|
||||||
|
echo "\"AltDefaultUserName\"=\"Docker\""
|
||||||
|
echo "\"AltDefaultDomainName\"=\"Dockur\""
|
||||||
|
echo "\"AutoAdminLogon\"=\"1\""
|
||||||
|
} | unix2dos > "$dir/\$OEM\$/install.reg"
|
||||||
|
|
||||||
|
{ 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,\"Docker\")"
|
||||||
|
} | unix2dos > "$dir/\$OEM\$/admin.vbs"
|
||||||
|
|
||||||
|
{ echo "[COMMANDS]"
|
||||||
|
echo "\"REGEDIT /s install.reg\""
|
||||||
|
echo "\"Wscript admin.vbs\""
|
||||||
|
} | unix2dos > "$dir/\$OEM\$/cmdlines.txt"
|
||||||
|
|
||||||
rm -rf "$drivers"
|
rm -rf "$drivers"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@@ -854,11 +915,11 @@ prepareImage() {
|
|||||||
local iso="$1"
|
local iso="$1"
|
||||||
local dir="$2"
|
local dir="$2"
|
||||||
|
|
||||||
if [[ "${BOOT_MODE,,}" == "windows" ]]; then
|
if [[ "${BOOT_MODE,,}" != "windows_legacy" ]]; then
|
||||||
if [[ "${DETECTED,,}" != "winxp"* ]] && [[ "${DETECTED,,}" != "win2008"* ]]; then
|
if [[ "${DETECTED,,}" != "winxp"* ]] && [[ "${DETECTED,,}" != "win2008"* ]]; then
|
||||||
if [[ "${DETECTED,,}" != "winvista"* ]] && [[ "${DETECTED,,}" != "win7"* ]]; then
|
if [[ "${DETECTED,,}" != "winvista"* ]] && [[ "${DETECTED,,}" != "win7"* ]]; then
|
||||||
|
|
||||||
if [ -f "$dir/$ETFS" ] && [ -f "$dir/$EFISYS" ]; then
|
if [ -s "$dir/$ETFS" ] && [ -s "$dir/$EFISYS" ]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -894,7 +955,7 @@ updateImage() {
|
|||||||
local asset="/run/assets/$3"
|
local asset="/run/assets/$3"
|
||||||
local path src loc index result
|
local path src loc index result
|
||||||
|
|
||||||
[ ! -f "$asset" ] && return 0
|
[ ! -s "$asset" ] && return 0
|
||||||
|
|
||||||
path=$(find "$dir" -maxdepth 1 -type f -iname autounattend.xml | head -n 1)
|
path=$(find "$dir" -maxdepth 1 -type f -iname autounattend.xml | head -n 1)
|
||||||
[ -n "$path" ] && cp "$asset" "$path"
|
[ -n "$path" ] && cp "$asset" "$path"
|
||||||
@@ -908,9 +969,9 @@ updateImage() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
loc=$(find "$src" -maxdepth 1 -type f -iname boot.wim | head -n 1)
|
loc=$(find "$src" -maxdepth 1 -type f -iname boot.wim | head -n 1)
|
||||||
[ ! -f "$loc" ] && loc=$(find "$src" -maxdepth 1 -type f -iname boot.esd | head -n 1)
|
[ ! -s "$loc" ] && loc=$(find "$src" -maxdepth 1 -type f -iname boot.esd | head -n 1)
|
||||||
|
|
||||||
if [ ! -f "$loc" ]; then
|
if [ ! -s "$loc" ]; then
|
||||||
warn "failed to locate 'boot.wim' or 'boot.esd' in ISO image, $FB"
|
warn "failed to locate 'boot.wim' or 'boot.esd' in ISO image, $FB"
|
||||||
BOOT_MODE="windows_legacy"
|
BOOT_MODE="windows_legacy"
|
||||||
return 1
|
return 1
|
||||||
@@ -965,7 +1026,7 @@ buildImage() {
|
|||||||
|
|
||||||
if ! genisoimage -o "$out" -b "$ETFS" -no-emul-boot -c "$cat" -iso-level 4 -J -l -D -N -joliet-long -relaxed-filenames -V "$label" \
|
if ! genisoimage -o "$out" -b "$ETFS" -no-emul-boot -c "$cat" -iso-level 4 -J -l -D -N -joliet-long -relaxed-filenames -V "$label" \
|
||||||
-udf -boot-info-table -eltorito-alt-boot -eltorito-boot "$EFISYS" -no-emul-boot -allow-limited-size -quiet "$dir" 2> "$log"; then
|
-udf -boot-info-table -eltorito-alt-boot -eltorito-boot "$EFISYS" -no-emul-boot -allow-limited-size -quiet "$dir" 2> "$log"; then
|
||||||
[ -f "$log" ] && echo "$(<"$log")"
|
[ -s "$log" ] && echo "$(<"$log")"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -975,7 +1036,7 @@ buildImage() {
|
|||||||
|
|
||||||
if ! genisoimage -o "$out" -b "$ETFS" -no-emul-boot -c "$cat" -iso-level 2 -J -l -D -N -joliet-long -relaxed-filenames -V "$label" \
|
if ! genisoimage -o "$out" -b "$ETFS" -no-emul-boot -c "$cat" -iso-level 2 -J -l -D -N -joliet-long -relaxed-filenames -V "$label" \
|
||||||
-udf -allow-limited-size -quiet "$dir" 2> "$log"; then
|
-udf -allow-limited-size -quiet "$dir" 2> "$log"; then
|
||||||
[ -f "$log" ] && echo "$(<"$log")"
|
[ -s "$log" ] && echo "$(<"$log")"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -983,7 +1044,7 @@ buildImage() {
|
|||||||
|
|
||||||
if ! 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 \
|
if ! 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" -quiet "$dir" 2> "$log"; then
|
-relaxed-filenames -V "$label" -quiet "$dir" 2> "$log"; then
|
||||||
[ -f "$log" ] && echo "$(<"$log")"
|
[ -s "$log" ] && echo "$(<"$log")"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -993,7 +1054,7 @@ buildImage() {
|
|||||||
local error=""
|
local error=""
|
||||||
local hide="Warning: creating filesystem that does not conform to ISO-9660."
|
local hide="Warning: creating filesystem that does not conform to ISO-9660."
|
||||||
|
|
||||||
[ -f "$log" ] && error="$(<"$log")"
|
[ -s "$log" ] && error="$(<"$log")"
|
||||||
[[ "$error" != "$hide" ]] && echo "$error"
|
[[ "$error" != "$hide" ]] && echo "$error"
|
||||||
|
|
||||||
if [ -f "$STORAGE/$BASE" ]; then
|
if [ -f "$STORAGE/$BASE" ]; then
|
||||||
@@ -1019,7 +1080,8 @@ if ! startInstall; then
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "$ISO" ]; then
|
if [ ! -s "$ISO" ]; then
|
||||||
|
rm -f "$ISO"
|
||||||
if ! downloadImage "$ISO" "$VERSION"; then
|
if ! downloadImage "$ISO" "$VERSION"; then
|
||||||
error "Failed to download $VERSION"
|
error "Failed to download $VERSION"
|
||||||
exit 61
|
exit 61
|
||||||
|
|||||||
@@ -571,7 +571,7 @@ verify_media() {
|
|||||||
# IMPORTANT: These checksums are not necessarily subject to being updated
|
# IMPORTANT: These checksums are not necessarily subject to being updated
|
||||||
# Unfortunately, the maintenance burden would be too large and even if I did there would still be some time gap between Microsoft releasing a new ISO and me updating the checksum (also, users would have to update this script)
|
# Unfortunately, the maintenance burden would be too large and even if I did there would still be some time gap between Microsoft releasing a new ISO and me updating the checksum (also, users would have to update this script)
|
||||||
# For these reasons, I've opted for a slightly more manual verification where you have to look up the checksum to see if it's a well-known Windows ISO checksum
|
# For these reasons, I've opted for a slightly more manual verification where you have to look up the checksum to see if it's a well-known Windows ISO checksum
|
||||||
# Ultimately, you have to trust Microsft because they could still include a backdoor in the verified ISO (keeping Windows air gapped could help with this)
|
# Ultimately, you have to trust Microsoft because they could still include a backdoor in the verified ISO (keeping Windows air gapped could help with this)
|
||||||
# Community contributions for these checksums are welcome
|
# Community contributions for these checksums are welcome
|
||||||
#
|
#
|
||||||
# Leading backslash is to avoid prepending a newline while maintaining alignment
|
# Leading backslash is to avoid prepending a newline while maintaining alignment
|
||||||
|
|||||||
16
src/power.sh
16
src/power.sh
@@ -25,7 +25,7 @@ _trap() {
|
|||||||
ready() {
|
ready() {
|
||||||
|
|
||||||
[ -f "$STORAGE/windows.boot" ] && return 0
|
[ -f "$STORAGE/windows.boot" ] && return 0
|
||||||
[ ! -f "$QEMU_PTY" ] && return 1
|
[ ! -s "$QEMU_PTY" ] && return 1
|
||||||
|
|
||||||
if [ -f "$STORAGE/windows.old" ]; then
|
if [ -f "$STORAGE/windows.old" ]; then
|
||||||
local last
|
local last
|
||||||
@@ -50,7 +50,9 @@ finish() {
|
|||||||
local pid
|
local pid
|
||||||
local reason=$1
|
local reason=$1
|
||||||
|
|
||||||
if [ -f "$QEMU_PID" ]; then
|
touch "$QEMU_END"
|
||||||
|
|
||||||
|
if [ -s "$QEMU_PID" ]; then
|
||||||
|
|
||||||
pid=$(<"$QEMU_PID")
|
pid=$(<"$QEMU_PID")
|
||||||
error "Forcefully terminating Windows, reason: $reason..."
|
error "Forcefully terminating Windows, reason: $reason..."
|
||||||
@@ -59,7 +61,7 @@ finish() {
|
|||||||
while isAlive "$pid"; do
|
while isAlive "$pid"; do
|
||||||
sleep 1
|
sleep 1
|
||||||
# Workaround for zombie pid
|
# Workaround for zombie pid
|
||||||
[ ! -f "$QEMU_PID" ] && break
|
[ ! -s "$QEMU_PID" ] && break
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -72,7 +74,7 @@ finish() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
pid="/var/run/tpm.pid"
|
pid="/var/run/tpm.pid"
|
||||||
[ -f "$pid" ] && pKill "$(<"$pid")"
|
[ -s "$pid" ] && pKill "$(<"$pid")"
|
||||||
|
|
||||||
fKill "wsdd"
|
fKill "wsdd"
|
||||||
fKill "smbd"
|
fKill "smbd"
|
||||||
@@ -89,7 +91,7 @@ terminal() {
|
|||||||
|
|
||||||
local dev=""
|
local dev=""
|
||||||
|
|
||||||
if [ -f "$QEMU_OUT" ]; then
|
if [ -s "$QEMU_OUT" ]; then
|
||||||
|
|
||||||
local msg
|
local msg
|
||||||
msg=$(<"$QEMU_OUT")
|
msg=$(<"$QEMU_OUT")
|
||||||
@@ -137,7 +139,7 @@ _graceful_shutdown() {
|
|||||||
touch "$QEMU_END"
|
touch "$QEMU_END"
|
||||||
info "Received $1, sending ACPI shutdown signal..."
|
info "Received $1, sending ACPI shutdown signal..."
|
||||||
|
|
||||||
if [ ! -f "$QEMU_PID" ]; then
|
if [ ! -s "$QEMU_PID" ]; then
|
||||||
error "QEMU PID file does not exist?"
|
error "QEMU PID file does not exist?"
|
||||||
finish "$code" && return "$code"
|
finish "$code" && return "$code"
|
||||||
fi
|
fi
|
||||||
@@ -166,7 +168,7 @@ _graceful_shutdown() {
|
|||||||
|
|
||||||
! isAlive "$pid" && break
|
! isAlive "$pid" && break
|
||||||
# Workaround for zombie pid
|
# Workaround for zombie pid
|
||||||
[ ! -f "$QEMU_PID" ] && break
|
[ ! -s "$QEMU_PID" ] && break
|
||||||
|
|
||||||
info "Waiting for Windows to shutdown... ($cnt/$QEMU_TIMEOUT)"
|
info "Waiting for Windows to shutdown... ($cnt/$QEMU_TIMEOUT)"
|
||||||
|
|
||||||
|
|||||||
28
src/samba.sh
28
src/samba.sh
@@ -1,7 +1,11 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -Eeuo pipefail
|
set -Eeuo pipefail
|
||||||
|
|
||||||
|
: "${SAMBA:="Y"}"
|
||||||
|
|
||||||
[[ "$DHCP" == [Yy1]* ]] && return 0
|
[[ "$DHCP" == [Yy1]* ]] && return 0
|
||||||
|
[[ "$SAMBA" != [Yy1]* ]] && return 0
|
||||||
|
[[ "$NETWORK" != [Yy1]* ]] && return 0
|
||||||
|
|
||||||
SHARE="$STORAGE/shared"
|
SHARE="$STORAGE/shared"
|
||||||
|
|
||||||
@@ -19,7 +23,7 @@ SAMBA="/etc/samba/smb.conf"
|
|||||||
echo " security = user"
|
echo " security = user"
|
||||||
echo " guest account = nobody"
|
echo " guest account = nobody"
|
||||||
echo " map to guest = Bad User"
|
echo " map to guest = Bad User"
|
||||||
echo " server min protocol = SMB2"
|
echo " server min protocol = NT1"
|
||||||
echo ""
|
echo ""
|
||||||
echo " # disable printing services"
|
echo " # disable printing services"
|
||||||
echo " load printers = no"
|
echo " load printers = no"
|
||||||
@@ -37,7 +41,7 @@ SAMBA="/etc/samba/smb.conf"
|
|||||||
echo " force group = root"
|
echo " force group = root"
|
||||||
} > "$SAMBA"
|
} > "$SAMBA"
|
||||||
|
|
||||||
{ echo "--------------------------------------------------------"
|
{ echo "--------------------------------------------------------"
|
||||||
echo " $APP for Docker v$(</run/version)..."
|
echo " $APP for Docker v$(</run/version)..."
|
||||||
echo " For support visit $SUPPORT"
|
echo " For support visit $SUPPORT"
|
||||||
echo "--------------------------------------------------------"
|
echo "--------------------------------------------------------"
|
||||||
@@ -57,7 +61,23 @@ SAMBA="/etc/samba/smb.conf"
|
|||||||
echo ""
|
echo ""
|
||||||
} | unix2dos > "$SHARE/readme.txt"
|
} | unix2dos > "$SHARE/readme.txt"
|
||||||
|
|
||||||
smbd -D
|
! smbd && smbd --debug-stdout
|
||||||
wsdd -i dockerbridge -p -n "host.lan" &
|
|
||||||
|
isXP="N"
|
||||||
|
|
||||||
|
if [ -f "$STORAGE/windows.old" ]; then
|
||||||
|
MT=$(<"$STORAGE/windows.old")
|
||||||
|
if [[ "${MT,,}" == "pc-q35-2"* ]]; then
|
||||||
|
isXP="Y"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$isXP" == [Yy1]* ]]; then
|
||||||
|
# Enable NetBIOS on Windows XP
|
||||||
|
! nmbd && nmbd --debug-stdout
|
||||||
|
else
|
||||||
|
# Enable Web Service Discovery
|
||||||
|
wsdd -i dockerbridge -p -n "host.lan" &
|
||||||
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
Reference in New Issue
Block a user