mirror of
https://github.com/dockur/windows.git
synced 2026-01-22 10:53:06 +00:00
Compare commits
60 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e16af78828 | ||
|
|
5ae6ecbe85 | ||
|
|
c9482fe3f0 | ||
|
|
63a9d10a27 | ||
|
|
009c2c7deb | ||
|
|
06434c02f4 | ||
|
|
32b92cc03a | ||
|
|
d799079040 | ||
|
|
b57d34e11e | ||
|
|
61d7e0d3be | ||
|
|
e6d7495bac | ||
|
|
faa7c58366 | ||
|
|
c0f5cca574 | ||
|
|
d86731dc24 | ||
|
|
bca8cb6817 | ||
|
|
d9c7983bb5 | ||
|
|
28f6e9c76b | ||
|
|
1081855571 | ||
|
|
57193b0f59 | ||
|
|
6825b6a45a | ||
|
|
c82725ec61 | ||
|
|
1f0cdc9bd1 | ||
|
|
9654a945fb | ||
|
|
a4fdfbdf91 | ||
|
|
b84a2b60a9 | ||
|
|
a5b4d7760d | ||
|
|
2c4094b0f7 | ||
|
|
66f595d84a | ||
|
|
6919e36aee | ||
|
|
658c84c55f | ||
|
|
3aa2f6e128 | ||
|
|
da8bbdcb47 | ||
|
|
d7fcf9a5da | ||
|
|
bb0a0b47b8 | ||
|
|
7120584548 | ||
|
|
e292d18d32 | ||
|
|
d92ac18210 | ||
|
|
243b3bb5d6 | ||
|
|
2cdb57a679 | ||
|
|
f1f6c640b9 | ||
|
|
86a766381e | ||
|
|
b39507c5a4 | ||
|
|
80dead1446 | ||
|
|
bc614fd233 | ||
|
|
80c5ba2231 | ||
|
|
760fe9a31f | ||
|
|
01c61dd32d | ||
|
|
815a3f3c66 | ||
|
|
69b450299c | ||
|
|
b347232ac8 | ||
|
|
955f8a08a0 | ||
|
|
a659c1c9da | ||
|
|
16c3a047c2 | ||
|
|
3cab3d1c7b | ||
|
|
ff55f843bd | ||
|
|
edb300dfec | ||
|
|
9db3651654 | ||
|
|
0dabce04a6 | ||
|
|
5f4c0938ac | ||
|
|
94a84b0c2d |
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@@ -50,7 +50,7 @@ jobs:
|
|||||||
labels: |
|
labels: |
|
||||||
org.opencontainers.image.title=${{ vars.NAME }}
|
org.opencontainers.image.title=${{ vars.NAME }}
|
||||||
env:
|
env:
|
||||||
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
|
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|||||||
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: DL3006,DL3008
|
||||||
failure-threshold: warning
|
failure-threshold: warning
|
||||||
|
|||||||
25
Dockerfile
25
Dockerfile
@@ -1,7 +1,8 @@
|
|||||||
FROM scratch
|
ARG VERSION_ARG="latest"
|
||||||
COPY --from=qemux/qemu-docker:6.05 / /
|
FROM scratch AS build-amd64
|
||||||
|
|
||||||
|
COPY --from=qemux/qemu:6.18 / /
|
||||||
|
|
||||||
ARG VERSION_ARG="0.0"
|
|
||||||
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"
|
||||||
@@ -10,6 +11,7 @@ RUN set -eu && \
|
|||||||
apt-get update && \
|
apt-get update && \
|
||||||
apt-get --no-install-recommends -y install \
|
apt-get --no-install-recommends -y install \
|
||||||
bc \
|
bc \
|
||||||
|
jq \
|
||||||
curl \
|
curl \
|
||||||
7zip \
|
7zip \
|
||||||
wsdd \
|
wsdd \
|
||||||
@@ -19,23 +21,28 @@ RUN set -eu && \
|
|||||||
dos2unix \
|
dos2unix \
|
||||||
cabextract \
|
cabextract \
|
||||||
genisoimage \
|
genisoimage \
|
||||||
libxml2-utils && \
|
libxml2-utils \
|
||||||
|
libarchive-tools && \
|
||||||
apt-get clean && \
|
apt-get clean && \
|
||||||
echo "$VERSION_ARG" > /run/version && \
|
|
||||||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||||
|
|
||||||
COPY --chmod=755 ./src /run/
|
COPY --chmod=755 ./src /run/
|
||||||
COPY --chmod=755 ./assets /run/assets
|
COPY --chmod=755 ./assets /run/assets
|
||||||
|
|
||||||
ADD --chmod=755 https://raw.githubusercontent.com/christgau/wsdd/v0.8/src/wsdd.py /usr/sbin/wsdd
|
ADD --chmod=664 https://github.com/qemus/virtiso-whql/releases/download/v1.9.44-0/virtio-win-1.9.44.tar.xz /drivers.txz
|
||||||
ADD --chmod=664 https://github.com/qemus/virtiso-whql/releases/download/v1.9.43-0/virtio-win-1.9.43.tar.xz /drivers.txz
|
|
||||||
|
FROM dockurr/windows-arm:${VERSION_ARG} AS build-arm64
|
||||||
|
FROM build-${TARGETARCH}
|
||||||
|
|
||||||
|
ARG VERSION_ARG="0.00"
|
||||||
|
RUN echo "$VERSION_ARG" > /run/version
|
||||||
|
|
||||||
EXPOSE 8006 3389
|
|
||||||
VOLUME /storage
|
VOLUME /storage
|
||||||
|
EXPOSE 8006 3389
|
||||||
|
|
||||||
|
ENV VERSION="11"
|
||||||
ENV RAM_SIZE="4G"
|
ENV RAM_SIZE="4G"
|
||||||
ENV CPU_CORES="2"
|
ENV CPU_CORES="2"
|
||||||
ENV DISK_SIZE="64G"
|
ENV DISK_SIZE="64G"
|
||||||
ENV VERSION="win11"
|
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/bin/tini", "-s", "/run/entry.sh"]
|
ENTRYPOINT ["/usr/bin/tini", "-s", "/run/entry.sh"]
|
||||||
|
|||||||
@@ -448,7 +448,7 @@
|
|||||||
</SynchronousCommand>
|
</SynchronousCommand>
|
||||||
<SynchronousCommand wcm:action="add">
|
<SynchronousCommand wcm:action="add">
|
||||||
<Order>23</Order>
|
<Order>23</Order>
|
||||||
<CommandLine>rd /q c:\Windows.old 2>nul</CommandLine>
|
<CommandLine>cmd /C rd /q C:\Windows.old</CommandLine>
|
||||||
<Description>Remove empty Windows.old folder</Description>
|
<Description>Remove empty Windows.old folder</Description>
|
||||||
</SynchronousCommand>
|
</SynchronousCommand>
|
||||||
<SynchronousCommand wcm:action="add">
|
<SynchronousCommand wcm:action="add">
|
||||||
|
|||||||
@@ -451,7 +451,7 @@
|
|||||||
</SynchronousCommand>
|
</SynchronousCommand>
|
||||||
<SynchronousCommand wcm:action="add">
|
<SynchronousCommand wcm:action="add">
|
||||||
<Order>23</Order>
|
<Order>23</Order>
|
||||||
<CommandLine>rd /q c:\Windows.old 2>nul</CommandLine>
|
<CommandLine>cmd /C rd /q C:\Windows.old</CommandLine>
|
||||||
<Description>Remove empty Windows.old folder</Description>
|
<Description>Remove empty Windows.old folder</Description>
|
||||||
</SynchronousCommand>
|
</SynchronousCommand>
|
||||||
<SynchronousCommand wcm:action="add">
|
<SynchronousCommand wcm:action="add">
|
||||||
|
|||||||
@@ -61,12 +61,6 @@
|
|||||||
</DiskConfiguration>
|
</DiskConfiguration>
|
||||||
<ImageInstall>
|
<ImageInstall>
|
||||||
<OSImage>
|
<OSImage>
|
||||||
<InstallFrom>
|
|
||||||
<MetaData wcm:action="add">
|
|
||||||
<Key>/image/index</Key>
|
|
||||||
<Value>2</Value>
|
|
||||||
</MetaData>
|
|
||||||
</InstallFrom>
|
|
||||||
<InstallTo>
|
<InstallTo>
|
||||||
<DiskID>0</DiskID>
|
<DiskID>0</DiskID>
|
||||||
<PartitionID>3</PartitionID>
|
<PartitionID>3</PartitionID>
|
||||||
@@ -87,7 +81,7 @@
|
|||||||
<FullName>Docker</FullName>
|
<FullName>Docker</FullName>
|
||||||
<Organization>Windows for Docker</Organization>
|
<Organization>Windows for Docker</Organization>
|
||||||
<ProductKey>
|
<ProductKey>
|
||||||
<Key />
|
<Key>CGK42-GYN6Y-VD22B-BX98W-J8JXD</Key>
|
||||||
</ProductKey>
|
</ProductKey>
|
||||||
</UserData>
|
</UserData>
|
||||||
<EnableFirewall>false</EnableFirewall>
|
<EnableFirewall>false</EnableFirewall>
|
||||||
@@ -457,7 +451,7 @@
|
|||||||
</SynchronousCommand>
|
</SynchronousCommand>
|
||||||
<SynchronousCommand wcm:action="add">
|
<SynchronousCommand wcm:action="add">
|
||||||
<Order>23</Order>
|
<Order>23</Order>
|
||||||
<CommandLine>rd /q c:\Windows.old 2>nul</CommandLine>
|
<CommandLine>cmd /C rd /q C:\Windows.old</CommandLine>
|
||||||
<Description>Remove empty Windows.old folder</Description>
|
<Description>Remove empty Windows.old folder</Description>
|
||||||
</SynchronousCommand>
|
</SynchronousCommand>
|
||||||
<SynchronousCommand wcm:action="add">
|
<SynchronousCommand wcm:action="add">
|
||||||
|
|||||||
@@ -61,12 +61,6 @@
|
|||||||
</DiskConfiguration>
|
</DiskConfiguration>
|
||||||
<ImageInstall>
|
<ImageInstall>
|
||||||
<OSImage>
|
<OSImage>
|
||||||
<InstallFrom>
|
|
||||||
<MetaData wcm:action="add">
|
|
||||||
<Key>/image/index</Key>
|
|
||||||
<Value>1</Value>
|
|
||||||
</MetaData>
|
|
||||||
</InstallFrom>
|
|
||||||
<InstallTo>
|
<InstallTo>
|
||||||
<DiskID>0</DiskID>
|
<DiskID>0</DiskID>
|
||||||
<PartitionID>3</PartitionID>
|
<PartitionID>3</PartitionID>
|
||||||
@@ -87,7 +81,7 @@
|
|||||||
<FullName>Docker</FullName>
|
<FullName>Docker</FullName>
|
||||||
<Organization>Windows for Docker</Organization>
|
<Organization>Windows for Docker</Organization>
|
||||||
<ProductKey>
|
<ProductKey>
|
||||||
<Key />
|
<Key>M7XTQ-FN8P6-TTKYV-9D4CC-J462D</Key>
|
||||||
</ProductKey>
|
</ProductKey>
|
||||||
</UserData>
|
</UserData>
|
||||||
<EnableFirewall>false</EnableFirewall>
|
<EnableFirewall>false</EnableFirewall>
|
||||||
@@ -457,7 +451,7 @@
|
|||||||
</SynchronousCommand>
|
</SynchronousCommand>
|
||||||
<SynchronousCommand wcm:action="add">
|
<SynchronousCommand wcm:action="add">
|
||||||
<Order>23</Order>
|
<Order>23</Order>
|
||||||
<CommandLine>rd /q c:\Windows.old 2>nul</CommandLine>
|
<CommandLine>cmd /C rd /q C:\Windows.old</CommandLine>
|
||||||
<Description>Remove empty Windows.old folder</Description>
|
<Description>Remove empty Windows.old folder</Description>
|
||||||
</SynchronousCommand>
|
</SynchronousCommand>
|
||||||
<SynchronousCommand wcm:action="add">
|
<SynchronousCommand wcm:action="add">
|
||||||
|
|||||||
@@ -451,7 +451,7 @@
|
|||||||
</SynchronousCommand>
|
</SynchronousCommand>
|
||||||
<SynchronousCommand wcm:action="add">
|
<SynchronousCommand wcm:action="add">
|
||||||
<Order>23</Order>
|
<Order>23</Order>
|
||||||
<CommandLine>rd /q c:\Windows.old 2>nul</CommandLine>
|
<CommandLine>cmd /C rd /q C:\Windows.old</CommandLine>
|
||||||
<Description>Remove empty Windows.old folder</Description>
|
<Description>Remove empty Windows.old folder</Description>
|
||||||
</SynchronousCommand>
|
</SynchronousCommand>
|
||||||
<SynchronousCommand wcm:action="add">
|
<SynchronousCommand wcm:action="add">
|
||||||
|
|||||||
@@ -342,7 +342,7 @@
|
|||||||
</SynchronousCommand>
|
</SynchronousCommand>
|
||||||
<SynchronousCommand wcm:action="add">
|
<SynchronousCommand wcm:action="add">
|
||||||
<Order>22</Order>
|
<Order>22</Order>
|
||||||
<CommandLine>rd /q c:\Windows.old 2>nul</CommandLine>
|
<CommandLine>cmd /C rd /q C:\Windows.old</CommandLine>
|
||||||
<Description>Remove empty Windows.old folder</Description>
|
<Description>Remove empty Windows.old folder</Description>
|
||||||
</SynchronousCommand>
|
</SynchronousCommand>
|
||||||
<SynchronousCommand wcm:action="add">
|
<SynchronousCommand wcm:action="add">
|
||||||
|
|||||||
@@ -345,7 +345,7 @@
|
|||||||
</SynchronousCommand>
|
</SynchronousCommand>
|
||||||
<SynchronousCommand wcm:action="add">
|
<SynchronousCommand wcm:action="add">
|
||||||
<Order>22</Order>
|
<Order>22</Order>
|
||||||
<CommandLine>rd /q c:\Windows.old 2>nul</CommandLine>
|
<CommandLine>cmd /C rd /q C:\Windows.old</CommandLine>
|
||||||
<Description>Remove empty Windows.old folder</Description>
|
<Description>Remove empty Windows.old folder</Description>
|
||||||
</SynchronousCommand>
|
</SynchronousCommand>
|
||||||
<SynchronousCommand wcm:action="add">
|
<SynchronousCommand wcm:action="add">
|
||||||
|
|||||||
@@ -3,13 +3,15 @@ services:
|
|||||||
image: dockurr/windows
|
image: dockurr/windows
|
||||||
container_name: windows
|
container_name: windows
|
||||||
environment:
|
environment:
|
||||||
VERSION: "win11"
|
VERSION: "11"
|
||||||
devices:
|
devices:
|
||||||
- /dev/kvm
|
- /dev/kvm
|
||||||
|
- /dev/net/tun
|
||||||
cap_add:
|
cap_add:
|
||||||
- NET_ADMIN
|
- NET_ADMIN
|
||||||
ports:
|
ports:
|
||||||
- 8006:8006
|
- 8006:8006
|
||||||
- 3389:3389/tcp
|
- 3389:3389/tcp
|
||||||
- 3389:3389/udp
|
- 3389:3389/udp
|
||||||
|
restart: always
|
||||||
stop_grace_period: 2m
|
stop_grace_period: 2m
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: PersistentVolumeClaim
|
kind: PersistentVolumeClaim
|
||||||
metadata:
|
metadata:
|
||||||
name: windows-pvc
|
name: windows-pvc
|
||||||
spec:
|
spec:
|
||||||
accessModes:
|
accessModes:
|
||||||
- ReadWriteOnce
|
- ReadWriteOnce
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
storage: 64Gi
|
storage: 64Gi
|
||||||
@@ -16,57 +17,61 @@ metadata:
|
|||||||
labels:
|
labels:
|
||||||
name: windows
|
name: windows
|
||||||
spec:
|
spec:
|
||||||
terminationGracePeriodSeconds: 120 # the Kubernetes default is 30 seconds and it may be not enough
|
|
||||||
containers:
|
containers:
|
||||||
- name: windows
|
- name: windows
|
||||||
image: dockurr/windows
|
image: dockurr/windows
|
||||||
ports:
|
env:
|
||||||
- containerPort: 8006
|
- name: VERSION
|
||||||
protocol: TCP
|
value: "11"
|
||||||
- containerPort: 3389
|
- name: RAM_SIZE
|
||||||
protocol: TCP
|
value: "4G"
|
||||||
- containerPort: 3389
|
- name: CPU_CORES
|
||||||
protocol: UDP
|
value: "2"
|
||||||
securityContext:
|
- name: DISK_SIZE
|
||||||
privileged: true
|
value: "64G"
|
||||||
env:
|
ports:
|
||||||
- name: RAM_SIZE
|
- containerPort: 8006
|
||||||
value: 4G
|
- containerPort: 3389
|
||||||
- name: CPU_CORES
|
- containerPort: 3389
|
||||||
value: "2"
|
protocol: UDP
|
||||||
- name: DISK_SIZE
|
securityContext:
|
||||||
value: "64G"
|
capabilities:
|
||||||
volumeMounts:
|
add:
|
||||||
- mountPath: /storage
|
- NET_ADMIN
|
||||||
name: storage
|
privileged: true
|
||||||
- mountPath: /dev/kvm
|
volumeMounts:
|
||||||
name: dev-kvm
|
- mountPath: /storage
|
||||||
|
name: storage
|
||||||
|
- mountPath: /dev/kvm
|
||||||
|
name: dev-kvm
|
||||||
|
- mountPath: /dev/net/tun
|
||||||
|
name: dev-tun
|
||||||
|
terminationGracePeriodSeconds: 120
|
||||||
volumes:
|
volumes:
|
||||||
- name: storage
|
- name: storage
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
claimName: windows-pvc
|
claimName: windows-pvc
|
||||||
- name: dev-kvm
|
- hostPath:
|
||||||
hostPath:
|
path: /dev/kvm
|
||||||
path: /dev/kvm
|
name: dev-kvm
|
||||||
|
- hostPath:
|
||||||
|
path: /dev/net/tun
|
||||||
|
type: CharDevice
|
||||||
|
name: dev-tun
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: windows
|
name: windows
|
||||||
spec:
|
spec:
|
||||||
type: NodePort
|
ports:
|
||||||
|
- name: tcp-8006
|
||||||
|
port: 8006
|
||||||
|
- name: tcp-3389
|
||||||
|
port: 3389
|
||||||
|
- name: udp-3389
|
||||||
|
port: 3389
|
||||||
|
protocol: UDP
|
||||||
selector:
|
selector:
|
||||||
name: windows
|
name: windows
|
||||||
ports:
|
type: NodePort
|
||||||
- name: tcp-8006
|
|
||||||
protocol: TCP
|
|
||||||
port: 8006
|
|
||||||
targetPort: 8006
|
|
||||||
- name: tcp-3389
|
|
||||||
protocol: TCP
|
|
||||||
port: 3389
|
|
||||||
targetPort: 3389
|
|
||||||
- name: udp-3389
|
|
||||||
protocol: UDP
|
|
||||||
port: 3389
|
|
||||||
targetPort: 3389
|
|
||||||
|
|||||||
84
readme.md
84
readme.md
@@ -16,7 +16,6 @@ Windows inside a Docker container.
|
|||||||
|
|
||||||
## Features ✨
|
## Features ✨
|
||||||
|
|
||||||
- Multi-language
|
|
||||||
- ISO downloader
|
- ISO downloader
|
||||||
- KVM acceleration
|
- KVM acceleration
|
||||||
- Web-based viewer
|
- Web-based viewer
|
||||||
@@ -35,30 +34,42 @@ services:
|
|||||||
image: dockurr/windows
|
image: dockurr/windows
|
||||||
container_name: windows
|
container_name: windows
|
||||||
environment:
|
environment:
|
||||||
VERSION: "win11"
|
VERSION: "11"
|
||||||
devices:
|
devices:
|
||||||
- /dev/kvm
|
- /dev/kvm
|
||||||
|
- /dev/net/tun
|
||||||
cap_add:
|
cap_add:
|
||||||
- NET_ADMIN
|
- NET_ADMIN
|
||||||
ports:
|
ports:
|
||||||
- 8006:8006
|
- 8006:8006
|
||||||
- 3389:3389/tcp
|
- 3389:3389/tcp
|
||||||
- 3389:3389/udp
|
- 3389:3389/udp
|
||||||
|
restart: always
|
||||||
stop_grace_period: 2m
|
stop_grace_period: 2m
|
||||||
```
|
```
|
||||||
|
|
||||||
Via Docker CLI:
|
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 -p 8006:8006 --device=/dev/kvm --device=/dev/net/tun --cap-add NET_ADMIN --stop-timeout 120 dockurr/windows
|
||||||
```
|
```
|
||||||
|
|
||||||
Via Kubernetes:
|
Via Kubernetes:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl apply -f kubernetes.yml
|
kubectl apply -f https://raw.githubusercontent.com/dockur/windows/refs/heads/master/kubernetes.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Compatibility ⚙️
|
||||||
|
|
||||||
|
| **Product** | **Platform** | |
|
||||||
|
|---|---|---|
|
||||||
|
| Docker Engine | Linux| ✅ |
|
||||||
|
| Docker Desktop | Linux | ❌ |
|
||||||
|
| Docker Desktop | macOS | ❌ |
|
||||||
|
| Docker Desktop | Windows 11 | ✅ |
|
||||||
|
| Docker Desktop | Windows 10 | ❌ |
|
||||||
|
|
||||||
## FAQ 💬
|
## FAQ 💬
|
||||||
|
|
||||||
### How do I use it?
|
### How do I use it?
|
||||||
@@ -75,38 +86,37 @@ kubectl apply -f kubernetes.yml
|
|||||||
|
|
||||||
### 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:
|
By default, Windows 11 Pro 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:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
environment:
|
environment:
|
||||||
VERSION: "win11"
|
VERSION: "11"
|
||||||
```
|
```
|
||||||
|
|
||||||
Select from the values below:
|
Select from the values below:
|
||||||
|
|
||||||
| **Value** | **Version** | **Size** |
|
| **Value** | **Version** | **Size** |
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
| `win11` | Windows 11 Pro | 5.4 GB |
|
| `11` | Windows 11 Pro | 5.4 GB |
|
||||||
| `ltsc11` | Windows 11 LTSC | 4.2 GB |
|
| `11l` | Windows 11 LTSC | 4.7 GB |
|
||||||
| `win11e` | Windows 11 Enterprise | 5.8 GB |
|
| `11e` | Windows 11 Enterprise | 4.0 GB |
|
||||||
||||
|
||||
|
||||||
| `win10` | Windows 10 Pro | 5.7 GB |
|
| `10` | Windows 10 Pro | 5.7 GB |
|
||||||
| `ltsc10` | Windows 10 LTSC | 4.6 GB |
|
| `10l` | Windows 10 LTSC | 4.6 GB |
|
||||||
| `win10e` | Windows 10 Enterprise | 5.2 GB |
|
| `10e` | Windows 10 Enterprise | 5.2 GB |
|
||||||
||||
|
||||
|
||||||
| `win8` | Windows 8.1 Pro | 4.0 GB |
|
| `8e` | Windows 8.1 Enterprise | 3.7 GB |
|
||||||
| `win8e` | Windows 8.1 Enterprise | 3.7 GB |
|
| `7e` | Windows 7 Enterprise | 3.0 GB |
|
||||||
| `win7` | Windows 7 Enterprise | 3.0 GB |
|
| `ve` | Windows Vista Enterprise | 3.0 GB |
|
||||||
| `vista` | Windows Vista Enterprise | 3.0 GB |
|
| `xp` | Windows XP Professional | 0.6 GB |
|
||||||
| `winxp` | Windows XP Professional | 0.6 GB |
|
|
||||||
||||
|
||||
|
||||||
| `2025` | Windows Server 2025 | 5.0 GB |
|
| `2025` | Windows Server 2025 | 5.0 GB |
|
||||||
| `2022` | Windows Server 2022 | 4.7 GB |
|
| `2022` | Windows Server 2022 | 4.7 GB |
|
||||||
| `2019` | Windows Server 2019 | 5.3 GB |
|
| `2019` | Windows Server 2019 | 5.3 GB |
|
||||||
| `2016` | Windows Server 2016 | 6.5 GB |
|
| `2016` | Windows Server 2016 | 6.5 GB |
|
||||||
| `2012` | Windows Server 2012 | 4.3 GB |
|
| `2012` | Windows Server 2012 | 4.3 GB |
|
||||||
| `2008` | Windows Server 2008 | 3.0 GB |
|
| `2008` | Windows Server 2008 | 3.0 GB |
|
||||||
| `2003` | Windows Server 2003 | 0.6 GB |
|
| `2003` | Windows Server 2003 | 0.6 GB |
|
||||||
|
|
||||||
> [!TIP]
|
> [!TIP]
|
||||||
> 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/).
|
||||||
@@ -136,11 +146,11 @@ kubectl apply -f kubernetes.yml
|
|||||||
|
|
||||||
### 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:
|
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 bound to any folder on your host via the compose file:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
volumes:
|
volumes:
|
||||||
- /home/user/example:/shared
|
- /home/user/example:/data
|
||||||
```
|
```
|
||||||
|
|
||||||
The example folder `/home/user/example` will be available as ` \\host.lan\Data`.
|
The example folder `/home/user/example` will be available as ` \\host.lan\Data`.
|
||||||
@@ -168,7 +178,9 @@ kubectl apply -f kubernetes.yml
|
|||||||
|
|
||||||
### 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:
|
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:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
volumes:
|
volumes:
|
||||||
@@ -221,7 +233,7 @@ kubectl apply -f kubernetes.yml
|
|||||||
LANGUAGE: "French"
|
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, 🇬🇧 English, 🇪🇪 Estonian, 🇫🇮 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.
|
||||||
|
|
||||||
### How do I select the keyboard layout?
|
### How do I select the keyboard layout?
|
||||||
|
|
||||||
@@ -341,24 +353,28 @@ kubectl apply -f kubernetes.yml
|
|||||||
|
|
||||||
### How do I verify if my system supports KVM?
|
### How do I verify if my system supports KVM?
|
||||||
|
|
||||||
To verify that your system supports KVM, run the following commands:
|
Only Linux and Windows 11 support KVM virtualization, macOS and Windows 10 do not unfortunately.
|
||||||
|
|
||||||
|
You can run the following commands in Linux to check your system:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo apt install cpu-checker
|
sudo apt install cpu-checker
|
||||||
sudo kvm-ok
|
sudo kvm-ok
|
||||||
```
|
```
|
||||||
|
|
||||||
If you receive an error from `kvm-ok` indicating that KVM acceleration can't be used, please check whether:
|
If you receive an error from `kvm-ok` indicating that KVM cannot be used, please check whether:
|
||||||
|
|
||||||
- the virtualization extensions (`Intel VT-x` or `AMD SVM`) are enabled in your BIOS.
|
- 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 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.
|
- 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.
|
If you do not receive any error from `kvm-ok` but the container still complains about KVM, please check whether:
|
||||||
|
|
||||||
|
- you are not using "Docker Desktop for Linux" as it does not support KVM, instead make use of Docker Engine directly.
|
||||||
|
|
||||||
|
- it could help to add `privileged: true` to your compose file (or `sudo` to your `docker run` command), to rule out any permission issue.
|
||||||
|
|
||||||
### How do I run macOS in a container?
|
### How do I run macOS in a container?
|
||||||
|
|
||||||
|
|||||||
896
src/define.sh
896
src/define.sh
File diff suppressed because it is too large
Load Diff
@@ -1,10 +1,9 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -Eeuo pipefail
|
set -Eeuo pipefail
|
||||||
|
|
||||||
|
: "${APP:="Windows"}"
|
||||||
: "${BOOT_MODE:="windows"}"
|
: "${BOOT_MODE:="windows"}"
|
||||||
|
: "${SUPPORT:="https://github.com/dockur/windows"}"
|
||||||
APP="Windows"
|
|
||||||
SUPPORT="https://github.com/dockur/windows"
|
|
||||||
|
|
||||||
cd /run
|
cd /run
|
||||||
|
|
||||||
|
|||||||
190
src/install.sh
190
src/install.sh
@@ -76,8 +76,6 @@ startInstall() {
|
|||||||
|
|
||||||
BOOT="$STORAGE/$file"
|
BOOT="$STORAGE/$file"
|
||||||
|
|
||||||
! migrateFiles "$BOOT" "$VERSION" && error "Migration failed!" && exit 57
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
skipInstall "$BOOT" && return 1
|
skipInstall "$BOOT" && return 1
|
||||||
@@ -120,6 +118,7 @@ finishInstall() {
|
|||||||
|
|
||||||
rm -f "$STORAGE/windows.old"
|
rm -f "$STORAGE/windows.old"
|
||||||
rm -f "$STORAGE/windows.vga"
|
rm -f "$STORAGE/windows.vga"
|
||||||
|
rm -f "$STORAGE/windows.args"
|
||||||
rm -f "$STORAGE/windows.base"
|
rm -f "$STORAGE/windows.base"
|
||||||
rm -f "$STORAGE/windows.boot"
|
rm -f "$STORAGE/windows.boot"
|
||||||
rm -f "$STORAGE/windows.mode"
|
rm -f "$STORAGE/windows.mode"
|
||||||
@@ -156,6 +155,11 @@ finishInstall() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -n "${ARGS:-}" ]; then
|
||||||
|
ARGUMENTS="$ARGS ${ARGUMENTS:-}"
|
||||||
|
echo "$ARGS" > "$STORAGE/windows.args"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "${DISK_TYPE:-}" ] && [[ "${DISK_TYPE:-}" != "scsi" ]]; then
|
if [ -n "${DISK_TYPE:-}" ] && [[ "${DISK_TYPE:-}" != "scsi" ]]; then
|
||||||
echo "$DISK_TYPE" > "$STORAGE/windows.type"
|
echo "$DISK_TYPE" > "$STORAGE/windows.type"
|
||||||
fi
|
fi
|
||||||
@@ -196,10 +200,16 @@ abortInstall() {
|
|||||||
detectCustom() {
|
detectCustom() {
|
||||||
|
|
||||||
local file base
|
local file base
|
||||||
|
local fname="custom.iso"
|
||||||
|
|
||||||
CUSTOM=""
|
CUSTOM=""
|
||||||
|
|
||||||
file=$(find / -maxdepth 1 -type f -iname custom.iso | head -n 1)
|
if [ -d "/$fname" ]; then
|
||||||
[ ! -s "$file" ] && file=$(find "$STORAGE" -maxdepth 1 -type f -iname custom.iso | head -n 1)
|
error "The file /$fname has an invalid path!" && return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
file=$(find / -maxdepth 1 -type f -iname "$fname" | head -n 1)
|
||||||
|
[ ! -s "$file" ] && file=$(find "$STORAGE" -maxdepth 1 -type f -iname "$fname" | head -n 1)
|
||||||
|
|
||||||
if [ ! -s "$file" ] && [[ "${VERSION,,}" != "http"* ]]; then
|
if [ ! -s "$file" ] && [[ "${VERSION,,}" != "http"* ]]; then
|
||||||
base=$(basename "$VERSION")
|
base=$(basename "$VERSION")
|
||||||
@@ -483,6 +493,10 @@ setXML() {
|
|||||||
|
|
||||||
local file="/custom.xml"
|
local file="/custom.xml"
|
||||||
|
|
||||||
|
if [ -d "$file" ]; then
|
||||||
|
warn "The file $file has an invalid path!"
|
||||||
|
fi
|
||||||
|
|
||||||
[ ! -f "$file" ] || [ ! -s "$file" ] && file="$STORAGE/custom.xml"
|
[ ! -f "$file" ] || [ ! -s "$file" ] && file="$STORAGE/custom.xml"
|
||||||
[ ! -f "$file" ] || [ ! -s "$file" ] && file="/run/assets/custom.xml"
|
[ ! -f "$file" ] || [ ! -s "$file" ] && file="/run/assets/custom.xml"
|
||||||
[ ! -f "$file" ] || [ ! -s "$file" ] && file="$1"
|
[ ! -f "$file" ] || [ ! -s "$file" ] && file="$1"
|
||||||
@@ -541,7 +555,7 @@ detectImage() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
info=$(wimlib-imagex info -xml "$wim" | tr -d '\000')
|
info=$(wimlib-imagex info -xml "$wim" | tr -d '\000')
|
||||||
! checkPlatform "$info" && exit 67
|
checkPlatform "$info" || exit 67
|
||||||
|
|
||||||
DETECTED=$(detectVersion "$info")
|
DETECTED=$(detectVersion "$info")
|
||||||
|
|
||||||
@@ -561,7 +575,7 @@ detectImage() {
|
|||||||
|
|
||||||
if [[ "${LANGUAGE,,}" != "en" ]] && [[ "${LANGUAGE,,}" != "en-"* ]]; then
|
if [[ "${LANGUAGE,,}" != "en" ]] && [[ "${LANGUAGE,,}" != "en-"* ]]; then
|
||||||
language=$(getLanguage "$LANGUAGE" "desc")
|
language=$(getLanguage "$LANGUAGE" "desc")
|
||||||
desc=+" ($language)"
|
desc+=" ($language)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
info "Detected: $desc"
|
info "Detected: $desc"
|
||||||
@@ -588,7 +602,7 @@ prepareImage() {
|
|||||||
|
|
||||||
desc=$(printVersion "$DETECTED" "$DETECTED")
|
desc=$(printVersion "$DETECTED" "$DETECTED")
|
||||||
|
|
||||||
! setMachine "$DETECTED" "$iso" "$dir" "$desc" && return 1
|
setMachine "$DETECTED" "$iso" "$dir" "$desc" || return 1
|
||||||
skipVersion "$DETECTED" && return 0
|
skipVersion "$DETECTED" && return 0
|
||||||
|
|
||||||
if [[ "${BOOT_MODE,,}" != "windows_legacy" ]]; then
|
if [[ "${BOOT_MODE,,}" != "windows_legacy" ]]; then
|
||||||
@@ -614,11 +628,11 @@ updateXML() {
|
|||||||
local language="$2"
|
local language="$2"
|
||||||
local culture region user admin pass keyboard
|
local culture region user admin pass keyboard
|
||||||
|
|
||||||
[ -z "$YRES" ] && YRES="720"
|
[ -z "$HEIGHT" ] && HEIGHT="720"
|
||||||
[ -z "$XRES" ] && XRES="1280"
|
[ -z "$WIDTH" ] && WIDTH="1280"
|
||||||
|
|
||||||
sed -i "s/<VerticalResolution>1080<\/VerticalResolution>/<VerticalResolution>$YRES<\/VerticalResolution>/g" "$asset"
|
sed -i "s/<VerticalResolution>1080<\/VerticalResolution>/<VerticalResolution>$HEIGHT<\/VerticalResolution>/g" "$asset"
|
||||||
sed -i "s/<HorizontalResolution>1920<\/HorizontalResolution>/<HorizontalResolution>$XRES<\/HorizontalResolution>/g" "$asset"
|
sed -i "s/<HorizontalResolution>1920<\/HorizontalResolution>/<HorizontalResolution>$WIDTH<\/HorizontalResolution>/g" "$asset"
|
||||||
|
|
||||||
culture=$(getLanguage "$language" "culture")
|
culture=$(getLanguage "$language" "culture")
|
||||||
|
|
||||||
@@ -662,6 +676,11 @@ updateXML() {
|
|||||||
sed -z "s/<AdministratorPassword>...............<Value \/>/<AdministratorPassword>\n <Value>$admin<\/Value>/g" -i "$asset"
|
sed -z "s/<AdministratorPassword>...............<Value \/>/<AdministratorPassword>\n <Value>$admin<\/Value>/g" -i "$asset"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -n "$EDITION" ]; then
|
||||||
|
[[ "${EDITION^^}" == "CORE" ]] && EDITION="STANDARDCORE"
|
||||||
|
sed -i "s/SERVERSTANDARD<\/Value>/SERVER${EDITION^^}<\/Value>/g" "$asset"
|
||||||
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -671,8 +690,13 @@ addDriver() {
|
|||||||
local path="$2"
|
local path="$2"
|
||||||
local target="$3"
|
local target="$3"
|
||||||
local driver="$4"
|
local driver="$4"
|
||||||
|
local desc=""
|
||||||
local folder=""
|
local folder=""
|
||||||
|
|
||||||
|
if [ -z "$id" ]; then
|
||||||
|
warn "no Windows version specified for \"$driver\" driver!" && return 0
|
||||||
|
fi
|
||||||
|
|
||||||
case "${id,,}" in
|
case "${id,,}" in
|
||||||
"win7x86"* ) folder="w7/x86" ;;
|
"win7x86"* ) folder="w7/x86" ;;
|
||||||
"win7x64"* ) folder="w7/amd64" ;;
|
"win7x64"* ) folder="w7/amd64" ;;
|
||||||
@@ -692,7 +716,8 @@ addDriver() {
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
if [ -z "$folder" ]; then
|
if [ -z "$folder" ]; then
|
||||||
warn "no \"$driver\" driver found for \"$DETECTED\" !" && return 0
|
desc=$(printVersion "$id" "$id")
|
||||||
|
warn "no \"$driver\" driver available for \"$desc\" !" && return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ ! -d "$path/$driver/$folder" ] && return 0
|
[ ! -d "$path/$driver/$folder" ] && return 0
|
||||||
@@ -704,7 +729,8 @@ addDriver() {
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
local dest="$path/$target/$driver"
|
local dest="$path/$target/$driver"
|
||||||
mv "$path/$driver/$folder" "$dest"
|
mkdir -p "$dest" || return 1
|
||||||
|
cp -Lr "$path/$driver/$folder/." "$dest" || return 1
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@@ -712,49 +738,56 @@ addDriver() {
|
|||||||
addDrivers() {
|
addDrivers() {
|
||||||
|
|
||||||
local src="$1"
|
local src="$1"
|
||||||
local file="$2"
|
local tmp="$2"
|
||||||
local index="$3"
|
local file="$3"
|
||||||
local version="$4"
|
local index="$4"
|
||||||
|
local version="$5"
|
||||||
|
local drivers="$tmp/drivers"
|
||||||
|
|
||||||
|
rm -rf "$drivers"
|
||||||
|
mkdir -p "$drivers"
|
||||||
|
|
||||||
local msg="Adding drivers to image..."
|
local msg="Adding drivers to image..."
|
||||||
info "$msg" && html "$msg"
|
info "$msg" && html "$msg"
|
||||||
|
|
||||||
local drivers="$TMP/drivers"
|
if [ -z "$version" ]; then
|
||||||
mkdir -p "$drivers"
|
version="win11x64"
|
||||||
|
warn "Windows version unknown, falling back to Windows 11 drivers..."
|
||||||
|
fi
|
||||||
|
|
||||||
if ! tar -xf /drivers.txz -C "$drivers" --warning=no-timestamp; then
|
if ! bsdtar -xf /drivers.txz -C "$drivers"; then
|
||||||
error "Failed to extract driver!" && return 1
|
error "Failed to extract drivers from archive!" && return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local target="\$WinPEDriver\$"
|
local target="\$WinPEDriver\$"
|
||||||
local dest="$drivers/$target"
|
local dest="$drivers/$target"
|
||||||
mkdir -p "$dest"
|
mkdir -p "$dest" || return 1
|
||||||
|
|
||||||
wimlib-imagex update "$file" "$index" --command "delete --force --recursive /$target" >/dev/null || true
|
wimlib-imagex update "$file" "$index" --command "delete --force --recursive /$target" >/dev/null || true
|
||||||
|
|
||||||
addDriver "$version" "$drivers" "$target" "qxl"
|
addDriver "$version" "$drivers" "$target" "qxl" || return 1
|
||||||
addDriver "$version" "$drivers" "$target" "viofs"
|
addDriver "$version" "$drivers" "$target" "viofs" || return 1
|
||||||
addDriver "$version" "$drivers" "$target" "sriov"
|
addDriver "$version" "$drivers" "$target" "sriov" || return 1
|
||||||
addDriver "$version" "$drivers" "$target" "smbus"
|
addDriver "$version" "$drivers" "$target" "smbus" || return 1
|
||||||
addDriver "$version" "$drivers" "$target" "qxldod"
|
addDriver "$version" "$drivers" "$target" "qxldod" || return 1
|
||||||
addDriver "$version" "$drivers" "$target" "viorng"
|
addDriver "$version" "$drivers" "$target" "viorng" || return 1
|
||||||
addDriver "$version" "$drivers" "$target" "viomem"
|
addDriver "$version" "$drivers" "$target" "viostor" || return 1
|
||||||
addDriver "$version" "$drivers" "$target" "viostor"
|
addDriver "$version" "$drivers" "$target" "viomem" || return 1
|
||||||
addDriver "$version" "$drivers" "$target" "NetKVM"
|
addDriver "$version" "$drivers" "$target" "NetKVM" || return 1
|
||||||
addDriver "$version" "$drivers" "$target" "Balloon"
|
addDriver "$version" "$drivers" "$target" "Balloon" || return 1
|
||||||
addDriver "$version" "$drivers" "$target" "vioscsi"
|
addDriver "$version" "$drivers" "$target" "vioscsi" || return 1
|
||||||
addDriver "$version" "$drivers" "$target" "pvpanic"
|
addDriver "$version" "$drivers" "$target" "pvpanic" || return 1
|
||||||
addDriver "$version" "$drivers" "$target" "vioinput"
|
addDriver "$version" "$drivers" "$target" "vioinput" || return 1
|
||||||
addDriver "$version" "$drivers" "$target" "viogpudo"
|
addDriver "$version" "$drivers" "$target" "viogpudo" || return 1
|
||||||
addDriver "$version" "$drivers" "$target" "vioserial"
|
addDriver "$version" "$drivers" "$target" "vioserial" || return 1
|
||||||
addDriver "$version" "$drivers" "$target" "qemupciserial"
|
addDriver "$version" "$drivers" "$target" "qemupciserial" || return 1
|
||||||
|
|
||||||
case "${version,,}" in
|
case "${version,,}" in
|
||||||
"win11x64"* | "win2025"* )
|
"win11x64"* | "win2025"* )
|
||||||
# Workaround Virtio GPU driver bug
|
# Workaround Virtio GPU driver bug
|
||||||
local dst="$src/\$OEM\$/\$\$/Drivers"
|
local dst="$src/\$OEM\$/\$\$/Drivers"
|
||||||
mkdir -p "$dst"
|
mkdir -p "$dst" || return 1
|
||||||
! cp -a "$dest/." "$dst" && return 1
|
cp -Lr "$dest/." "$dst" || return 1
|
||||||
rm -rf "$dest/viogpudo"
|
rm -rf "$dest/viogpudo"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -767,36 +800,12 @@ addDrivers() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
addFolder() {
|
|
||||||
|
|
||||||
local src="$1"
|
|
||||||
local folder="/oem"
|
|
||||||
|
|
||||||
[ ! -d "$folder" ] && folder="/OEM"
|
|
||||||
[ ! -d "$folder" ] && folder="$STORAGE/oem"
|
|
||||||
[ ! -d "$folder" ] && folder="$STORAGE/OEM"
|
|
||||||
[ ! -d "$folder" ] && return 0
|
|
||||||
|
|
||||||
local msg="Adding OEM folder to image..."
|
|
||||||
info "$msg" && html "$msg"
|
|
||||||
|
|
||||||
local dest="$src/\$OEM\$/\$1/OEM"
|
|
||||||
mkdir -p "$dest"
|
|
||||||
|
|
||||||
! cp -a "$folder/." "$dest" && return 1
|
|
||||||
|
|
||||||
local file
|
|
||||||
file=$(find "$dest" -maxdepth 1 -type f -iname install.bat | head -n 1)
|
|
||||||
[ -f "$file" ] && unix2dos -q "$file"
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
updateImage() {
|
updateImage() {
|
||||||
|
|
||||||
local dir="$1"
|
local dir="$1"
|
||||||
local asset="$2"
|
local asset="$2"
|
||||||
local language="$3"
|
local language="$3"
|
||||||
|
local tmp="/tmp/install"
|
||||||
local file="autounattend.xml"
|
local file="autounattend.xml"
|
||||||
local org="${file//.xml/.org}"
|
local org="${file//.xml/.org}"
|
||||||
local dat="${file//.xml/.dat}"
|
local dat="${file//.xml/.dat}"
|
||||||
@@ -812,6 +821,9 @@ updateImage() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
rm -rf "$tmp"
|
||||||
|
mkdir -p "$tmp"
|
||||||
|
|
||||||
src=$(find "$dir" -maxdepth 1 -type d -iname sources | head -n 1)
|
src=$(find "$dir" -maxdepth 1 -type d -iname sources | head -n 1)
|
||||||
|
|
||||||
if [ ! -d "$src" ]; then
|
if [ ! -d "$src" ]; then
|
||||||
@@ -832,25 +844,22 @@ updateImage() {
|
|||||||
index="2"
|
index="2"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! addDrivers "$src" "$wim" "$index" "$DETECTED"; then
|
if ! addDrivers "$src" "$tmp" "$wim" "$index" "$DETECTED"; then
|
||||||
error "Failed to add drivers to image!" && return 1
|
error "Failed to add drivers to image!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! addFolder "$src"; then
|
if ! addFolder "$src"; then
|
||||||
error "Failed to add OEM folder to image!" && return 1
|
error "Failed to add OEM folder to image!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if wimlib-imagex extract "$wim" "$index" "/$file" "--dest-dir=$TMP" >/dev/null 2>&1; then
|
if wimlib-imagex extract "$wim" "$index" "/$file" "--dest-dir=$tmp" >/dev/null 2>&1; then
|
||||||
if ! wimlib-imagex extract "$wim" "$index" "/$dat" "--dest-dir=$TMP" >/dev/null 2>&1; then
|
if ! wimlib-imagex extract "$wim" "$index" "/$dat" "--dest-dir=$tmp" >/dev/null 2>&1; then
|
||||||
if ! wimlib-imagex extract "$wim" "$index" "/$org" "--dest-dir=$TMP" >/dev/null 2>&1; then
|
if ! wimlib-imagex extract "$wim" "$index" "/$org" "--dest-dir=$tmp" >/dev/null 2>&1; then
|
||||||
if ! wimlib-imagex update "$wim" "$index" --command "rename /$file /$org" > /dev/null; then
|
if ! wimlib-imagex update "$wim" "$index" --command "rename /$file /$org" > /dev/null; then
|
||||||
warn "failed to backup original answer file ($file)."
|
warn "failed to backup original answer file ($file)."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
rm -f "$TMP/$dat"
|
|
||||||
rm -f "$TMP/$org"
|
|
||||||
rm -f "$TMP/$file"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$MANUAL" != [Yy1]* ]]; then
|
if [[ "$MANUAL" != [Yy1]* ]]; then
|
||||||
@@ -858,7 +867,7 @@ updateImage() {
|
|||||||
xml=$(basename "$asset")
|
xml=$(basename "$asset")
|
||||||
info "Adding $xml for automatic installation..."
|
info "Adding $xml for automatic installation..."
|
||||||
|
|
||||||
local answer="$TMP/$xml"
|
local answer="$tmp/$xml"
|
||||||
cp "$asset" "$answer"
|
cp "$asset" "$answer"
|
||||||
updateXML "$answer" "$language"
|
updateXML "$answer" "$language"
|
||||||
|
|
||||||
@@ -869,22 +878,18 @@ updateImage() {
|
|||||||
wimlib-imagex update "$wim" "$index" --command "add $answer /$dat" > /dev/null || true
|
wimlib-imagex update "$wim" "$index" --command "add $answer /$dat" > /dev/null || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f "$answer"
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$MANUAL" == [Yy1]* ]]; then
|
if [[ "$MANUAL" == [Yy1]* ]]; then
|
||||||
|
|
||||||
wimlib-imagex update "$wim" "$index" --command "delete --force /$file" > /dev/null || true
|
wimlib-imagex update "$wim" "$index" --command "delete --force /$file" > /dev/null || true
|
||||||
|
|
||||||
if wimlib-imagex extract "$wim" "$index" "/$org" "--dest-dir=$TMP" >/dev/null 2>&1; then
|
if wimlib-imagex extract "$wim" "$index" "/$org" "--dest-dir=$tmp" >/dev/null 2>&1; then
|
||||||
if ! wimlib-imagex update "$wim" "$index" --command "add $TMP/$org /$file" > /dev/null; then
|
if ! wimlib-imagex update "$wim" "$index" --command "add $tmp/$org /$file" > /dev/null; then
|
||||||
warn "failed to restore original answer file ($org)."
|
warn "failed to restore original answer file ($org)."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f "$TMP/$org"
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local find="$file"
|
local find="$file"
|
||||||
@@ -899,6 +904,7 @@ updateImage() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
rm -rf "$tmp"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -908,7 +914,8 @@ removeImage() {
|
|||||||
|
|
||||||
[ ! -f "$iso" ] && return 0
|
[ ! -f "$iso" ] && return 0
|
||||||
[ -n "$CUSTOM" ] && return 0
|
[ -n "$CUSTOM" ] && return 0
|
||||||
! rm -f "$iso" 2> /dev/null && warn "failed to remove $iso !"
|
|
||||||
|
rm -f "$iso" 2> /dev/null || warn "failed to remove $iso !"
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@@ -951,20 +958,20 @@ buildImage() {
|
|||||||
|
|
||||||
if [[ "${BOOT_MODE,,}" != "windows_legacy" ]]; then
|
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}" \
|
genisoimage -o "$out" -b "$ETFS" -no-emul-boot -c "$cat" -iso-level 4 -J -l -D -N -joliet-long -relaxed-filenames -V "${LABEL::30}" \
|
||||||
-udf -boot-info-table -eltorito-alt-boot -eltorito-boot "$EFISYS" -no-emul-boot -allow-limited-size -quiet "$dir" 2> "$log" && failed="y"
|
-udf -boot-info-table -eltorito-alt-boot -eltorito-boot "$EFISYS" -no-emul-boot -allow-limited-size -quiet "$dir" 2> "$log" || failed="y"
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
case "${DETECTED,,}" in
|
case "${DETECTED,,}" in
|
||||||
"win2k"* | "winxp"* | "win2003"* )
|
"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 \
|
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" ;;
|
-relaxed-filenames -V "${LABEL::30}" -quiet "$dir" 2> "$log" || failed="y" ;;
|
||||||
"win9"* )
|
"win9"* )
|
||||||
! genisoimage -o "$out" -b "$ETFS" -J -r -V "${LABEL::30}" -quiet "$dir" 2> "$log" && failed="y" ;;
|
genisoimage -o "$out" -b "$ETFS" -J -r -V "${LABEL::30}" -quiet "$dir" 2> "$log" || failed="y" ;;
|
||||||
* )
|
* )
|
||||||
! genisoimage -o "$out" -b "$ETFS" -no-emul-boot -c "$cat" -iso-level 2 -J -l -D -N -joliet-long -relaxed-filenames -V "${LABEL::30}" \
|
genisoimage -o "$out" -b "$ETFS" -no-emul-boot -c "$cat" -iso-level 2 -J -l -D -N -joliet-long -relaxed-filenames -V "${LABEL::30}" \
|
||||||
-udf -allow-limited-size -quiet "$dir" 2> "$log" && failed="y" ;;
|
-udf -allow-limited-size -quiet "$dir" 2> "$log" || failed="y" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
fi
|
fi
|
||||||
@@ -980,7 +987,7 @@ buildImage() {
|
|||||||
[ -s "$log" ] && error="$(<"$log")"
|
[ -s "$log" ] && error="$(<"$log")"
|
||||||
[[ "$error" != "$hide" ]] && echo "$error"
|
[[ "$error" != "$hide" ]] && echo "$error"
|
||||||
|
|
||||||
! mv -f "$out" "$BOOT" && return 1
|
mv -f "$out" "$BOOT" || return 1
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -988,6 +995,11 @@ bootWindows() {
|
|||||||
|
|
||||||
rm -rf "$TMP"
|
rm -rf "$TMP"
|
||||||
|
|
||||||
|
if [ -f "$STORAGE/windows.args" ]; then
|
||||||
|
ARGS=$(<"$STORAGE/windows.args")
|
||||||
|
ARGUMENTS="$ARGS ${ARGUMENTS:-}"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -s "$STORAGE/windows.type" ] && [ -f "$STORAGE/windows.type" ]; then
|
if [ -s "$STORAGE/windows.type" ] && [ -f "$STORAGE/windows.type" ]; then
|
||||||
[ -z "${DISK_TYPE:-}" ] && DISK_TYPE=$(<"$STORAGE/windows.type")
|
[ -z "${DISK_TYPE:-}" ] && DISK_TYPE=$(<"$STORAGE/windows.type")
|
||||||
fi
|
fi
|
||||||
|
|||||||
216
src/mido.sh
216
src/mido.sh
@@ -4,25 +4,26 @@ set -Eeuo pipefail
|
|||||||
handle_curl_error() {
|
handle_curl_error() {
|
||||||
|
|
||||||
local error_code="$1"
|
local error_code="$1"
|
||||||
|
local server_name="$2"
|
||||||
|
|
||||||
case "$error_code" in
|
case "$error_code" in
|
||||||
1) error "Unsupported protocol!" ;;
|
1) error "Unsupported protocol!" ;;
|
||||||
2) error "Failed to initialize curl!" ;;
|
2) error "Failed to initialize curl!" ;;
|
||||||
3) error "The URL format is malformed!" ;;
|
3) error "The URL format is malformed!" ;;
|
||||||
5) error "Failed to resolve address of proxy host!" ;;
|
5) error "Failed to resolve address of proxy host!" ;;
|
||||||
6) error "Failed to resolve Microsoft servers! Is there an Internet connection?" ;;
|
6) error "Failed to resolve $server_name servers! Is there an Internet connection?" ;;
|
||||||
7) error "Failed to contact Microsoft servers! Is there an Internet connection or is the server down?" ;;
|
7) error "Failed to contact $server_name servers! Is there an Internet connection or is the server down?" ;;
|
||||||
8) error "Microsoft servers returned a malformed HTTP response!" ;;
|
8) error "$server_name servers returned a malformed HTTP response!" ;;
|
||||||
16) error "A problem was detected in the HTTP2 framing layer!" ;;
|
16) error "A problem was detected in the HTTP2 framing layer!" ;;
|
||||||
22) error "Microsoft servers returned a failing HTTP status code!" ;;
|
22) error "$server_name servers returned a failing HTTP status code!" ;;
|
||||||
23) error "Failed at writing Windows media to disk! Out of disk space or permission error?" ;;
|
23) error "Failed at writing Windows media to disk! Out of disk space or permission error?" ;;
|
||||||
26) error "Failed to read Windows media from disk!" ;;
|
26) error "Failed to read Windows media from disk!" ;;
|
||||||
27) error "Ran out of memory during download!" ;;
|
27) error "Ran out of memory during download!" ;;
|
||||||
28) error "Connection timed out to Microsoft server!" ;;
|
28) error "Connection timed out to $server_name server!" ;;
|
||||||
35) error "SSL connection error from Microsoft server!" ;;
|
35) error "SSL connection error from $server_name server!" ;;
|
||||||
36) error "Failed to continue earlier download!" ;;
|
36) error "Failed to continue earlier download!" ;;
|
||||||
52) error "Received no data from the Microsoft server!" ;;
|
52) error "Received no data from the $server_name server!" ;;
|
||||||
63) error "Microsoft servers returned an unexpectedly large response!" ;;
|
63) error "$server_name servers returned an unexpectedly large response!" ;;
|
||||||
# POSIX defines exit statuses 1-125 as usable by us
|
# POSIX defines exit statuses 1-125 as usable by us
|
||||||
# https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_08_02
|
# https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_08_02
|
||||||
$((error_code <= 125)))
|
$((error_code <= 125)))
|
||||||
@@ -63,31 +64,33 @@ download_windows() {
|
|||||||
local lang="$2"
|
local lang="$2"
|
||||||
local desc="$3"
|
local desc="$3"
|
||||||
local sku_id=""
|
local sku_id=""
|
||||||
|
local sku_url=""
|
||||||
|
local iso_url=""
|
||||||
|
local iso_json=""
|
||||||
local language=""
|
local language=""
|
||||||
local session_id=""
|
local session_id=""
|
||||||
local user_agent=""
|
local user_agent=""
|
||||||
|
local download_type=""
|
||||||
local windows_version=""
|
local windows_version=""
|
||||||
local iso_download_link=""
|
local iso_download_link=""
|
||||||
|
local download_page_html=""
|
||||||
local product_edition_id=""
|
local product_edition_id=""
|
||||||
local iso_download_link_html=""
|
local language_skuid_json=""
|
||||||
local iso_download_page_html=""
|
local profile="606624d44113"
|
||||||
local language_skuid_table_html=""
|
|
||||||
|
|
||||||
case "${id,,}" in
|
|
||||||
"win11x64" ) windows_version="11" ;;
|
|
||||||
"win10x64" ) windows_version="10" ;;
|
|
||||||
"win81x64" ) windows_version="8" ;;
|
|
||||||
* ) error "Invalid VERSION specified, value \"$id\" is not recognized!" && return 1 ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
user_agent=$(get_agent)
|
user_agent=$(get_agent)
|
||||||
language=$(getLanguage "$lang" "name")
|
language=$(getLanguage "$lang" "name")
|
||||||
|
|
||||||
local url="https://www.microsoft.com/en-us/software-download/windows$windows_version"
|
case "${id,,}" in
|
||||||
case "$windows_version" in
|
"win11x64" ) windows_version="11" && download_type="1" ;;
|
||||||
8 | 10) url+="ISO";;
|
"win10x64" ) windows_version="10" && download_type="1" ;;
|
||||||
|
"win11arm64" ) windows_version="11arm64" && download_type="2" ;;
|
||||||
|
* ) error "Invalid VERSION specified, value \"$id\" is not recognized!" && return 1 ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
local url="https://www.microsoft.com/en-us/software-download/windows$windows_version"
|
||||||
|
[[ "${id,,}" == "win10"* ]] && url+="ISO"
|
||||||
|
|
||||||
# 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
|
# 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
|
||||||
session_id=$(cat /proc/sys/kernel/random/uuid 2> /dev/null || uuidgen --random)
|
session_id=$(cat /proc/sys/kernel/random/uuid 2> /dev/null || uuidgen --random)
|
||||||
|
|
||||||
@@ -96,44 +99,39 @@ download_windows() {
|
|||||||
# This is the *only* request we make that Fido doesn't. Fido manually maintains a list of all the Windows release/edition product edition IDs in its script (see: $WindowsVersions array). This is helpful for downloading older releases (e.g. Windows 10 1909, 21H1, etc.) but we always want to get the newest release which is why we get this value dynamically
|
# This is the *only* request we make that Fido doesn't. Fido manually maintains a list of all the Windows release/edition product edition IDs in its script (see: $WindowsVersions array). This is helpful for downloading older releases (e.g. Windows 10 1909, 21H1, etc.) but we always want to get the newest release which is why we get this value dynamically
|
||||||
# Also, keeping a "$WindowsVersions" array like Fido does would be way too much of a maintenance burden
|
# Also, keeping a "$WindowsVersions" array like Fido does would be way too much of a maintenance burden
|
||||||
# Remove "Accept" header that curl sends by default
|
# Remove "Accept" header that curl sends by default
|
||||||
[[ "$DEBUG" == [Yy1]* ]] && echo " - Parsing download page: ${url}"
|
[[ "$DEBUG" == [Yy1]* ]] && echo "Parsing download page: ${url}"
|
||||||
iso_download_page_html=$(curl --silent --max-time 30 --user-agent "$user_agent" --header "Accept:" --max-filesize 1M --fail --proto =https --tlsv1.2 --http1.1 -- "$url") || {
|
download_page_html=$(curl --silent --max-time 30 --user-agent "$user_agent" --header "Accept:" --max-filesize 1M --fail --proto =https --tlsv1.2 --http1.1 -- "$url") || {
|
||||||
handle_curl_error $?
|
handle_curl_error "$?" "Microsoft"
|
||||||
return $?
|
return $?
|
||||||
}
|
}
|
||||||
|
|
||||||
[[ "$DEBUG" == [Yy1]* ]] && echo -n "Getting Product edition ID: "
|
[[ "$DEBUG" == [Yy1]* ]] && echo -n "Getting Product edition ID: "
|
||||||
# tr: Filter for only numerics to prevent HTTP parameter injection
|
product_edition_id=$(echo "$download_page_html" | grep -Eo '<option value="[0-9]+">Windows' | cut -d '"' -f 2 | head -n 1 | tr -cd '0-9' | head -c 16)
|
||||||
# head -c was recently added to POSIX: https://austingroupbugs.net/view.php?id=407
|
|
||||||
product_edition_id=$(echo "$iso_download_page_html" | grep -Eo '<option value="[0-9]+">Windows' | cut -d '"' -f 2 | head -n 1 | tr -cd '0-9' | head -c 16)
|
|
||||||
[[ "$DEBUG" == [Yy1]* ]] && echo "$product_edition_id"
|
[[ "$DEBUG" == [Yy1]* ]] && echo "$product_edition_id"
|
||||||
|
|
||||||
|
if [ -z "$product_edition_id" ]; then
|
||||||
|
error "Product edition ID not found!"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
[[ "$DEBUG" == [Yy1]* ]] && echo "Permit Session ID: $session_id"
|
[[ "$DEBUG" == [Yy1]* ]] && echo "Permit Session ID: $session_id"
|
||||||
# Permit Session ID
|
# Permit Session ID
|
||||||
# "org_id" is always the same value
|
|
||||||
curl --silent --max-time 30 --output /dev/null --user-agent "$user_agent" --header "Accept:" --max-filesize 100K --fail --proto =https --tlsv1.2 --http1.1 -- "https://vlscppe.microsoft.com/tags?org_id=y6jn8c31&session_id=$session_id" || {
|
curl --silent --max-time 30 --output /dev/null --user-agent "$user_agent" --header "Accept:" --max-filesize 100K --fail --proto =https --tlsv1.2 --http1.1 -- "https://vlscppe.microsoft.com/tags?org_id=y6jn8c31&session_id=$session_id" || {
|
||||||
# This should only happen if there's been some change to how this API works
|
# This should only happen if there's been some change to how this API works
|
||||||
handle_curl_error $?
|
handle_curl_error "$?" "Microsoft"
|
||||||
return $?
|
return $?
|
||||||
}
|
}
|
||||||
|
|
||||||
# Extract everything after the last slash
|
|
||||||
local url_segment_parameter="${url##*/}"
|
|
||||||
|
|
||||||
[[ "$DEBUG" == [Yy1]* ]] && echo -n "Getting language SKU ID: "
|
[[ "$DEBUG" == [Yy1]* ]] && echo -n "Getting language SKU ID: "
|
||||||
# Get language -> skuID association table
|
sku_url="https://www.microsoft.com/software-download-connector/api/getskuinformationbyproductedition?profile=$profile&ProductEditionId=$product_edition_id&SKU=undefined&friendlyFileName=undefined&Locale=en-US&sessionID=$session_id"
|
||||||
# SKU ID: This specifies the language of the ISO. We always use "English (United States)", however, the SKU for this changes with each Windows release
|
language_skuid_json=$(curl --silent --max-time 30 --request GET --user-agent "$user_agent" --referer "$url" --header "Accept:" --max-filesize 100K --fail --proto =https --tlsv1.2 --http1.1 -- "$sku_url") || {
|
||||||
# We must make this request so our next one will be allowed
|
handle_curl_error "$?" "Microsoft"
|
||||||
# --data "" is required otherwise no "Content-Length" header will be sent causing HTTP response "411 Length Required"
|
|
||||||
language_skuid_table_html=$(curl --silent --max-time 30 --request POST --user-agent "$user_agent" --data "" --header "Accept:" --max-filesize 10K --fail --proto =https --tlsv1.2 --http1.1 -- "https://www.microsoft.com/en-US/api/controls/contentinclude/html?pageId=a8f8f489-4c7f-463a-9ca6-5cff94d8d041&host=www.microsoft.com&segments=software-download,$url_segment_parameter&query=&action=getskuinformationbyproductedition&sessionId=$session_id&productEditionId=$product_edition_id&sdVersion=2") || {
|
|
||||||
handle_curl_error $?
|
|
||||||
return $?
|
return $?
|
||||||
}
|
}
|
||||||
|
|
||||||
# tr: Filter for only alphanumerics or "-" to prevent HTTP parameter injection
|
{ sku_id=$(echo "$language_skuid_json" | jq --arg LANG "$language" -r '.Skus[] | select(.Language==$LANG).Id') 2>/dev/null; rc=$?; } || :
|
||||||
sku_id=$(echo "$language_skuid_table_html" | grep -m 1 ">${language}<" | sed 's/"//g' | cut -d ',' -f 1 | cut -d ':' -f 2 | tr -cd '[:alnum:]-' | head -c 16)
|
|
||||||
|
|
||||||
if [ -z "$sku_id" ]; then
|
if [ -z "$sku_id" ] || [[ "${sku_id,,}" == "null" ]] || (( rc != 0 )); then
|
||||||
language=$(getLanguage "$lang" "desc")
|
language=$(getLanguage "$lang" "desc")
|
||||||
error "No download in the $language language available for $desc!"
|
error "No download in the $language language available for $desc!"
|
||||||
return 1
|
return 1
|
||||||
@@ -144,28 +142,31 @@ download_windows() {
|
|||||||
|
|
||||||
# Get ISO download link
|
# Get ISO download link
|
||||||
# If any request is going to be blocked by Microsoft it's always this last one (the previous requests always seem to succeed)
|
# If any request is going to be blocked by Microsoft it's always this last one (the previous requests always seem to succeed)
|
||||||
# --referer: Required by Microsoft servers to allow request
|
|
||||||
iso_download_link_html=$(curl --silent --max-time 30 --request POST --user-agent "$user_agent" --data "" --referer "$url" --header "Accept:" --max-filesize 100K --fail --proto =https --tlsv1.2 --http1.1 -- "https://www.microsoft.com/en-US/api/controls/contentinclude/html?pageId=6e2a1789-ef16-4f27-a296-74ef7ef5d96b&host=www.microsoft.com&segments=software-download,$url_segment_parameter&query=&action=GetProductDownloadLinksBySku&sessionId=$session_id&skuId=$sku_id&language=English&sdVersion=2")
|
|
||||||
|
|
||||||
if ! [ "$iso_download_link_html" ]; then
|
iso_url="https://www.microsoft.com/software-download-connector/api/GetProductDownloadLinksBySku?profile=$profile&ProductEditionId=undefined&SKU=$sku_id&friendlyFileName=undefined&Locale=en-US&sessionID=$session_id"
|
||||||
|
iso_json=$(curl --silent --max-time 30 --request GET --user-agent "$user_agent" --referer "$url" --header "Accept:" --max-filesize 100K --fail --proto =https --tlsv1.2 --http1.1 -- "$iso_url")
|
||||||
|
|
||||||
|
if ! [ "$iso_json" ]; then
|
||||||
# This should only happen if there's been some change to how this API works
|
# This should only happen if there's been some change to how this API works
|
||||||
error "Microsoft servers gave us an empty response to our request for an automated download."
|
error "Microsoft servers gave us an empty response to our request for an automated download."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if echo "$iso_download_link_html" | grep -q "We are unable to complete your request at this time."; then
|
if echo "$iso_json" | grep -q "Sentinel marked this request as rejected."; then
|
||||||
error "Microsoft blocked the automated download request based on your IP address."
|
error "Microsoft blocked the automated download request based on your IP address."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Filter for 64-bit ISO download URL
|
if echo "$iso_json" | grep -q "We are unable to complete your request at this time."; then
|
||||||
# sed: HTML decode "&" character
|
error "Microsoft blocked the automated download request based on your IP address."
|
||||||
# tr: Filter for only alphanumerics or punctuation
|
return 1
|
||||||
iso_download_link=$(echo "$iso_download_link_html" | grep -o "https://software.download.prss.microsoft.com.*IsoX64" | cut -d '"' -f 1 | sed 's/&/\&/g' | tr -cd '[:alnum:][:punct:]')
|
fi
|
||||||
|
|
||||||
if ! [ "$iso_download_link" ]; then
|
{ iso_download_link=$(echo "$iso_json" | jq --argjson TYPE "$download_type" -r '.ProductDownloadOptions[] | select(.DownloadType==$TYPE).Uri') 2>/dev/null; rc=$?; } || :
|
||||||
# This should only happen if there's been some change to the download endpoint web address
|
|
||||||
|
if [ -z "$iso_download_link" ] || [[ "${iso_download_link,,}" == "null" ]] || (( rc != 0 )); then
|
||||||
error "Microsoft servers gave us no download link to our request for an automated download!"
|
error "Microsoft servers gave us no download link to our request for an automated download!"
|
||||||
|
info "Response: $iso_json"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -229,7 +230,7 @@ download_windows_eval() {
|
|||||||
|
|
||||||
[[ "$DEBUG" == [Yy1]* ]] && echo "Parsing download page: ${url}"
|
[[ "$DEBUG" == [Yy1]* ]] && echo "Parsing download page: ${url}"
|
||||||
iso_download_page_html=$(curl --silent --max-time 30 --user-agent "$user_agent" --location --max-filesize 1M --fail --proto =https --tlsv1.2 --http1.1 -- "$url") || {
|
iso_download_page_html=$(curl --silent --max-time 30 --user-agent "$user_agent" --location --max-filesize 1M --fail --proto =https --tlsv1.2 --http1.1 -- "$url") || {
|
||||||
handle_curl_error $?
|
handle_curl_error "$?" "Microsoft"
|
||||||
return $?
|
return $?
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,10 +242,10 @@ download_windows_eval() {
|
|||||||
|
|
||||||
[[ "$DEBUG" == [Yy1]* ]] && echo "Getting download link.."
|
[[ "$DEBUG" == [Yy1]* ]] && echo "Getting download link.."
|
||||||
|
|
||||||
if [[ "$enterprise_type" == "iot" ]]; then
|
filter="https://go.microsoft.com/fwlink/?linkid=[0-9]\+&clcid=0x[0-9a-z]\+&culture=${culture,,}&country=${country,,}"
|
||||||
filter="https://go.microsoft.com/fwlink/?linkid=[0-9]\+&clcid=0x[0-9a-z]\+&culture=${culture,,}&country=${country^^}"
|
|
||||||
else
|
if ! echo "$iso_download_page_html" | grep -io "$filter" > /dev/null; then
|
||||||
filter="https://go.microsoft.com/fwlink/p/?LinkID=[0-9]\+&clcid=0x[0-9a-z]\+&culture=${culture,,}&country=${country^^}"
|
filter="https://go.microsoft.com/fwlink/p/?linkid=[0-9]\+&clcid=0x[0-9a-z]\+&culture=${culture,,}&country=${country,,}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
iso_download_links=$(echo "$iso_download_page_html" | grep -io "$filter") || {
|
iso_download_links=$(echo "$iso_download_page_html" | grep -io "$filter") || {
|
||||||
@@ -283,11 +284,11 @@ download_windows_eval() {
|
|||||||
[[ "$DEBUG" == [Yy1]* ]] && echo "Found download link: $iso_download_link"
|
[[ "$DEBUG" == [Yy1]* ]] && echo "Found download link: $iso_download_link"
|
||||||
|
|
||||||
# Follow redirect so proceeding log message is useful
|
# Follow redirect so proceeding log message is useful
|
||||||
# This is a request we make this Fido doesn't
|
# This is a request we make that Fido doesn't
|
||||||
# We don't need to set "--max-filesize" here because this is a HEAD request and the output is to /dev/null anyway
|
|
||||||
iso_download_link=$(curl --silent --max-time 30 --user-agent "$user_agent" --location --output /dev/null --silent --write-out "%{url_effective}" --head --fail --proto =https --tlsv1.2 --http1.1 -- "$iso_download_link") || {
|
iso_download_link=$(curl --silent --max-time 30 --user-agent "$user_agent" --location --output /dev/null --silent --write-out "%{url_effective}" --head --fail --proto =https --tlsv1.2 --http1.1 -- "$iso_download_link") || {
|
||||||
# This should only happen if the Microsoft servers are down
|
# This should only happen if the Microsoft servers are down
|
||||||
handle_curl_error $?
|
handle_curl_error "$?" "Microsoft"
|
||||||
return $?
|
return $?
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -305,11 +306,11 @@ getWindows() {
|
|||||||
language=$(getLanguage "$lang" "desc")
|
language=$(getLanguage "$lang" "desc")
|
||||||
edition=$(printEdition "$version" "$desc")
|
edition=$(printEdition "$version" "$desc")
|
||||||
|
|
||||||
local msg="Requesting $desc from Microsoft server..."
|
local msg="Requesting $desc from the Microsoft servers..."
|
||||||
info "$msg" && html "$msg"
|
info "$msg" && html "$msg"
|
||||||
|
|
||||||
case "${version,,}" in
|
case "${version,,}" in
|
||||||
"win2008r2" | "win81${PLATFORM,,}-enterprise-eval" | "win11${PLATFORM,,}-enterprise-iot-eval" )
|
"win2008r2" | "win81${PLATFORM,,}-enterprise"* | "win11${PLATFORM,,}-enterprise-iot"* | "win11${PLATFORM,,}-enterprise-ltsc"* )
|
||||||
if [[ "${lang,,}" != "en" ]] && [[ "${lang,,}" != "en-"* ]]; then
|
if [[ "${lang,,}" != "en" ]] && [[ "${lang,,}" != "en-"* ]]; then
|
||||||
error "No download in the $language language available for $edition!"
|
error "No download in the $language language available for $edition!"
|
||||||
MIDO_URL="" && return 1
|
MIDO_URL="" && return 1
|
||||||
@@ -317,8 +318,9 @@ getWindows() {
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
case "${version,,}" in
|
case "${version,,}" in
|
||||||
"win11${PLATFORM,,}-enterprise-iot-eval" ) ;;
|
"win11${PLATFORM,,}" ) ;;
|
||||||
"win11${PLATFORM,,}-enterprise-ltsc-eval" ) ;;
|
"win11${PLATFORM,,}-enterprise-iot"* ) ;;
|
||||||
|
"win11${PLATFORM,,}-enterprise-ltsc"* ) ;;
|
||||||
* )
|
* )
|
||||||
if [[ "${PLATFORM,,}" != "x64" ]]; then
|
if [[ "${PLATFORM,,}" != "x64" ]]; then
|
||||||
error "No download for the ${PLATFORM^^} platform available for $edition!"
|
error "No download for the ${PLATFORM^^} platform available for $edition!"
|
||||||
@@ -327,7 +329,7 @@ getWindows() {
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
case "${version,,}" in
|
case "${version,,}" in
|
||||||
"win81${PLATFORM,,}" | "win10${PLATFORM,,}" | "win11${PLATFORM,,}" )
|
"win10${PLATFORM,,}" | "win11${PLATFORM,,}" )
|
||||||
download_windows "$version" "$lang" "$edition" && return 0
|
download_windows "$version" "$lang" "$edition" && return 0
|
||||||
;;
|
;;
|
||||||
"win11${PLATFORM,,}-enterprise"* | "win10${PLATFORM,,}-enterprise"* )
|
"win11${PLATFORM,,}-enterprise"* | "win10${PLATFORM,,}-enterprise"* )
|
||||||
@@ -336,15 +338,56 @@ getWindows() {
|
|||||||
"win2025-eval" | "win2022-eval" | "win2019-eval" | "win2016-eval" | "win2012r2-eval" )
|
"win2025-eval" | "win2022-eval" | "win2019-eval" | "win2016-eval" | "win2012r2-eval" )
|
||||||
download_windows_eval "$version" "$lang" "$edition" && return 0
|
download_windows_eval "$version" "$lang" "$edition" && return 0
|
||||||
;;
|
;;
|
||||||
"win81${PLATFORM,,}-enterprise-eval" )
|
"win81${PLATFORM,,}-enterprise"* | "win2008r2" )
|
||||||
MIDO_URL="https://download.microsoft.com/download/B/9/9/B999286E-0A47-406D-8B3D-5B5AD7373A4A/9600.17050.WINBLUE_REFRESH.140317-1640_X64FRE_ENTERPRISE_EVAL_EN-US-IR3_CENA_X64FREE_EN-US_DV9.ISO" && return 0
|
|
||||||
;;
|
|
||||||
"win2008r2" )
|
|
||||||
MIDO_URL="https://download.microsoft.com/download/4/1/D/41DEA7E0-B30D-4012-A1E3-F24DC03BA1BB/7601.17514.101119-1850_x64fre_server_eval_en-us-GRMSXEVAL_EN_DVD.iso" && return 0
|
|
||||||
;;
|
;;
|
||||||
* ) error "Invalid VERSION specified, value \"$version\" is not recognized!" ;;
|
* ) error "Invalid VERSION specified, value \"$version\" is not recognized!" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
if [[ "${PLATFORM,,}" != "x64" ]]; then
|
||||||
|
MIDO_URL=""
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${lang,,}" != "en" ]] && [[ "${lang,,}" != "en-"* ]]; then
|
||||||
|
MIDO_URL=""
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "${version,,}" in
|
||||||
|
"win81${PLATFORM,,}-enterprise"* )
|
||||||
|
MIDO_URL="https://download.microsoft.com/download/B/9/9/B999286E-0A47-406D-8B3D-5B5AD7373A4A/9600.17050.WINBLUE_REFRESH.140317-1640_X64FRE_ENTERPRISE_EVAL_EN-US-IR3_CENA_X64FREE_EN-US_DV9.ISO"
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
"win11${PLATFORM,,}-enterprise-iot"* | "win11${PLATFORM,,}-enterprise-ltsc"* )
|
||||||
|
MIDO_URL="https://software-static.download.prss.microsoft.com/dbazure/888969d5-f34g-4e03-ac9d-1f9786c66749/26100.1.240331-1435.ge_release_CLIENT_IOT_LTSC_EVAL_x64FRE_en-us.iso"
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
"win2025-eval" )
|
||||||
|
MIDO_URL="https://software-static.download.prss.microsoft.com/dbazure/888969d5-f34g-4e03-ac9d-1f9786c66749/26100.1.240331-1435.ge_release_SERVER_EVAL_x64FRE_en-us.iso"
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
"win2022-eval" )
|
||||||
|
MIDO_URL="https://software-static.download.prss.microsoft.com/sg/download/888969d5-f34g-4e03-ac9d-1f9786c66749/SERVER_EVAL_x64FRE_en-us.iso"
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
"win2019-eval" )
|
||||||
|
MIDO_URL="https://software-download.microsoft.com/download/pr/17763.737.190906-2324.rs5_release_svc_refresh_SERVER_EVAL_x64FRE_en-us_1.iso"
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
"win2016-eval" )
|
||||||
|
MIDO_URL="https://software-download.microsoft.com/download/pr/Windows_Server_2016_Datacenter_EVAL_en-us_14393_refresh.ISO"
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
"win2012r2-eval" )
|
||||||
|
MIDO_URL="https://download.microsoft.com/download/6/2/A/62A76ABB-9990-4EFC-A4FE-C7D698DAEB96/9600.17050.WINBLUE_REFRESH.140317-1640_X64FRE_SERVER_EVAL_EN-US-IR3_SSS_X64FREE_EN-US_DV9.ISO"
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
"win2008r2" )
|
||||||
|
MIDO_URL="https://download.microsoft.com/download/4/1/D/41DEA7E0-B30D-4012-A1E3-F24DC03BA1BB/7601.17514.101119-1850_x64fre_server_eval_en-us-GRMSXEVAL_EN_DVD.iso"
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
MIDO_URL=""
|
MIDO_URL=""
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
@@ -416,7 +459,7 @@ getESD() {
|
|||||||
local eFile="esd_edition.xml"
|
local eFile="esd_edition.xml"
|
||||||
local fFile="products_filter.xml"
|
local fFile="products_filter.xml"
|
||||||
|
|
||||||
{ wget "$winCatalog" -O "$dir/$wFile" -q --timeout=30; rc=$?; } || :
|
{ wget "$winCatalog" -O "$dir/$wFile" -q --timeout=30 --no-http-keep-alive; rc=$?; } || :
|
||||||
|
|
||||||
msg="Failed to download $winCatalog"
|
msg="Failed to download $winCatalog"
|
||||||
(( rc == 3 )) && error "$msg , cannot write file (disk full?)" && return 1
|
(( rc == 3 )) && error "$msg , cannot write file (disk full?)" && return 1
|
||||||
@@ -542,7 +585,7 @@ downloadFile() {
|
|||||||
info "$msg..."
|
info "$msg..."
|
||||||
/run/progress.sh "$iso" "$size" "$msg ([P])..." &
|
/run/progress.sh "$iso" "$size" "$msg ([P])..." &
|
||||||
|
|
||||||
{ wget "$url" -O "$iso" -q --timeout=30 --show-progress "$progress"; rc=$?; } || :
|
{ wget "$url" -O "$iso" -q --timeout=30 --no-http-keep-alive --show-progress "$progress"; rc=$?; } || :
|
||||||
|
|
||||||
fKill "progress.sh"
|
fKill "progress.sh"
|
||||||
|
|
||||||
@@ -551,7 +594,7 @@ downloadFile() {
|
|||||||
if [ "$total" -lt 100000000 ]; then
|
if [ "$total" -lt 100000000 ]; then
|
||||||
error "Invalid download link: $url (is only $total bytes?). Please report this at $SUPPORT/issues." && return 1
|
error "Invalid download link: $url (is only $total bytes?). Please report this at $SUPPORT/issues." && return 1
|
||||||
fi
|
fi
|
||||||
! verifyFile "$iso" "$size" "$total" "$sum" && return 1
|
verifyFile "$iso" "$size" "$total" "$sum" || return 1
|
||||||
html "Download finished successfully..." && return 0
|
html "Download finished successfully..." && return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -569,13 +612,18 @@ downloadImage() {
|
|||||||
local iso="$1"
|
local iso="$1"
|
||||||
local version="$2"
|
local version="$2"
|
||||||
local lang="$3"
|
local lang="$3"
|
||||||
|
local delay=5
|
||||||
local tried="n"
|
local tried="n"
|
||||||
|
local success="n"
|
||||||
local url sum size base desc language
|
local url sum size base desc language
|
||||||
|
local msg="Will retry after $delay seconds..."
|
||||||
|
|
||||||
if [[ "${version,,}" == "http"* ]]; then
|
if [[ "${version,,}" == "http"* ]]; then
|
||||||
base=$(basename "$iso")
|
base=$(basename "$iso")
|
||||||
desc=$(fromFile "$base")
|
desc=$(fromFile "$base")
|
||||||
downloadFile "$iso" "$version" "" "" "" "$desc" && return 0
|
downloadFile "$iso" "$version" "" "" "" "$desc" && return 0
|
||||||
|
info "$msg" && html "$msg" && sleep "$delay"
|
||||||
|
downloadFile "$iso" "$version" "" "" "" "$desc" && return 0
|
||||||
rm -f "$iso"
|
rm -f "$iso"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@@ -596,11 +644,23 @@ downloadImage() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if isMido "$version" "$lang"; then
|
if isMido "$version" "$lang"; then
|
||||||
|
|
||||||
tried="y"
|
tried="y"
|
||||||
|
success="n"
|
||||||
|
|
||||||
if getWindows "$version" "$lang" "$desc"; then
|
if getWindows "$version" "$lang" "$desc"; then
|
||||||
|
success="y"
|
||||||
|
else
|
||||||
|
info "$msg" && html "$msg" && sleep "$delay"
|
||||||
|
getWindows "$version" "$lang" "$desc" && success="y"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$success" == "y" ]]; then
|
||||||
size=$(getMido "$version" "$lang" "size" )
|
size=$(getMido "$version" "$lang" "size" )
|
||||||
sum=$(getMido "$version" "$lang" "sum")
|
sum=$(getMido "$version" "$lang" "sum")
|
||||||
downloadFile "$iso" "$MIDO_URL" "$sum" "$size" "$lang" "$desc" && return 0
|
downloadFile "$iso" "$MIDO_URL" "$sum" "$size" "$lang" "$desc" && return 0
|
||||||
|
info "$msg" && html "$msg" && sleep "$delay"
|
||||||
|
downloadFile "$iso" "$MIDO_URL" "$sum" "$size" "$lang" "$desc" && return 0
|
||||||
rm -f "$iso"
|
rm -f "$iso"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -614,10 +674,20 @@ downloadImage() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
tried="y"
|
tried="y"
|
||||||
|
success="n"
|
||||||
|
|
||||||
if getESD "$TMP/esd" "$version" "$lang" "$desc"; then
|
if getESD "$TMP/esd" "$version" "$lang" "$desc"; then
|
||||||
|
success="y"
|
||||||
|
else
|
||||||
|
info "$msg" && html "$msg" && sleep "$delay"
|
||||||
|
getESD "$TMP/esd" "$version" "$lang" "$desc" && success="y"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$success" == "y" ]]; then
|
||||||
ISO="${ISO%.*}.esd"
|
ISO="${ISO%.*}.esd"
|
||||||
downloadFile "$ISO" "$ESD" "$ESD_SUM" "$ESD_SIZE" "$lang" "$desc" && return 0
|
downloadFile "$ISO" "$ESD" "$ESD_SUM" "$ESD_SIZE" "$lang" "$desc" && return 0
|
||||||
|
info "$msg" && html "$msg" && sleep "$delay"
|
||||||
|
downloadFile "$ISO" "$ESD" "$ESD_SUM" "$ESD_SIZE" "$lang" "$desc" && return 0
|
||||||
rm -f "$ISO"
|
rm -f "$ISO"
|
||||||
ISO="$iso"
|
ISO="$iso"
|
||||||
fi
|
fi
|
||||||
@@ -636,6 +706,8 @@ downloadImage() {
|
|||||||
size=$(getSize "$i" "$version" "$lang")
|
size=$(getSize "$i" "$version" "$lang")
|
||||||
sum=$(getHash "$i" "$version" "$lang")
|
sum=$(getHash "$i" "$version" "$lang")
|
||||||
downloadFile "$iso" "$url" "$sum" "$size" "$lang" "$desc" && return 0
|
downloadFile "$iso" "$url" "$sum" "$size" "$lang" "$desc" && return 0
|
||||||
|
info "$msg" && html "$msg" && sleep "$delay"
|
||||||
|
downloadFile "$iso" "$url" "$sum" "$size" "$lang" "$desc" && return 0
|
||||||
rm -f "$iso"
|
rm -f "$iso"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
108
src/samba.sh
108
src/samba.sh
@@ -14,39 +14,52 @@ if [[ "$DHCP" == [Yy1]* ]]; then
|
|||||||
interface="$VM_NET_DEV"
|
interface="$VM_NET_DEV"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
share="/shared"
|
addShare() {
|
||||||
|
local dir="$1"
|
||||||
|
local name="$2"
|
||||||
|
local comment="$3"
|
||||||
|
|
||||||
if [ ! -d "$share" ] && [ -d "$STORAGE/shared" ]; then
|
mkdir -p "$dir" || return 1
|
||||||
share="$STORAGE/shared"
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir -p "$share"
|
if [ -z "$(ls -A "$dir")" ]; then
|
||||||
|
|
||||||
if [ -z "$(ls -A "$share")" ]; then
|
chmod 777 "$dir"
|
||||||
|
|
||||||
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/example:/${name,,}\""
|
||||||
|
echo ""
|
||||||
|
echo "Or in your run command:"
|
||||||
|
echo ""
|
||||||
|
echo " -v \"/home/example:/${name,,}\""
|
||||||
|
echo ""
|
||||||
|
echo "Replace the example path /home/example with the desired shared folder."
|
||||||
|
echo ""
|
||||||
|
} | unix2dos > "$dir/readme.txt"
|
||||||
|
|
||||||
{ echo "--------------------------------------------------------"
|
fi
|
||||||
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 ""
|
||||||
|
echo "[$name]"
|
||||||
|
echo " path = $dir"
|
||||||
|
echo " comment = $comment"
|
||||||
|
echo " writable = yes"
|
||||||
|
echo " guest ok = yes"
|
||||||
|
echo " guest only = yes"
|
||||||
|
echo " force user = root"
|
||||||
|
echo " force group = root"
|
||||||
|
} >> "/etc/samba/smb.conf"
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
{ echo "[global]"
|
{ echo "[global]"
|
||||||
echo " server string = Dockur"
|
echo " server string = Dockur"
|
||||||
@@ -58,38 +71,41 @@ fi
|
|||||||
echo " guest account = nobody"
|
echo " guest account = nobody"
|
||||||
echo " map to guest = Bad User"
|
echo " map to guest = Bad User"
|
||||||
echo " server min protocol = NT1"
|
echo " server min protocol = NT1"
|
||||||
|
echo " follow symlinks = yes"
|
||||||
|
echo " wide links = yes"
|
||||||
|
echo " unix extensions = no"
|
||||||
echo ""
|
echo ""
|
||||||
echo " # disable printing services"
|
echo " # disable printing services"
|
||||||
echo " load printers = no"
|
echo " load printers = no"
|
||||||
echo " printing = bsd"
|
echo " printing = bsd"
|
||||||
echo " printcap name = /dev/null"
|
echo " printcap name = /dev/null"
|
||||||
echo " disable spoolss = yes"
|
echo " disable spoolss = yes"
|
||||||
echo ""
|
|
||||||
echo "[Data]"
|
|
||||||
echo " path = $share"
|
|
||||||
echo " comment = Shared"
|
|
||||||
echo " writable = yes"
|
|
||||||
echo " guest ok = yes"
|
|
||||||
echo " guest only = yes"
|
|
||||||
echo " force user = root"
|
|
||||||
echo " force group = root"
|
|
||||||
} > "/etc/samba/smb.conf"
|
} > "/etc/samba/smb.conf"
|
||||||
|
|
||||||
|
share="/data"
|
||||||
|
[ ! -d "$share" ] && [ -d "$STORAGE/data" ] && share="$STORAGE/data"
|
||||||
|
[ ! -d "$share" ] && [ -d "/shared" ] && share="/shared"
|
||||||
|
[ ! -d "$share" ] && [ -d "$STORAGE/shared" ] && share="$STORAGE/shared"
|
||||||
|
|
||||||
|
addShare "$share" "Data" "Shared" || error "Failed to create shared folder!"
|
||||||
|
|
||||||
|
[ -d "/data2" ] && addShare "/data2" "Data2" "Shared"
|
||||||
|
[ -d "/data3" ] && addShare "/data3" "Data3" "Shared"
|
||||||
|
|
||||||
|
IFS=',' read -r -a dirs <<< "${SHARES:-}"
|
||||||
|
for dir in "${dirs[@]}"; do
|
||||||
|
[ ! -d "$dir" ] && continue
|
||||||
|
dir_name=$(basename "$dir")
|
||||||
|
addShare "$dir" "$dir_name" "Shared $dir_name" || error "Failed to create shared folder for $dir!"
|
||||||
|
done
|
||||||
|
|
||||||
if ! smbd; then
|
if ! smbd; then
|
||||||
error "Samba daemon failed to start!"
|
error "Samba daemon failed to start!"
|
||||||
smbd -i --debug-stdout || true
|
smbd -i --debug-stdout || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
legacy=""
|
if [[ "${BOOT_MODE:-}" == "windows_legacy" ]]; then
|
||||||
|
# Enable NetBIOS on Windows 7 and lower
|
||||||
if [ -f "$STORAGE/windows.old" ]; then
|
|
||||||
MT=$(<"$STORAGE/windows.old")
|
|
||||||
[[ "${MT,,}" == "pc-q35-2"* ]] && legacy="y"
|
|
||||||
[[ "${MT,,}" == "pc-i440fx-2"* ]] && legacy="y"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$legacy" ]; then
|
|
||||||
# Enable NetBIOS on Windows XP and lower
|
|
||||||
if ! nmbd; then
|
if ! nmbd; then
|
||||||
error "NetBIOS daemon failed to start!"
|
error "NetBIOS daemon failed to start!"
|
||||||
nmbd -i --debug-stdout || true
|
nmbd -i --debug-stdout || true
|
||||||
|
|||||||
Reference in New Issue
Block a user