mirror of
https://github.com/dockur/windows.git
synced 2026-01-13 06:32:23 +00:00
Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
009c2c7deb | ||
|
|
06434c02f4 | ||
|
|
32b92cc03a | ||
|
|
d799079040 | ||
|
|
b57d34e11e | ||
|
|
61d7e0d3be | ||
|
|
e6d7495bac | ||
|
|
faa7c58366 | ||
|
|
c0f5cca574 | ||
|
|
d86731dc24 | ||
|
|
bca8cb6817 | ||
|
|
d9c7983bb5 | ||
|
|
28f6e9c76b | ||
|
|
1081855571 | ||
|
|
57193b0f59 | ||
|
|
6825b6a45a | ||
|
|
c82725ec61 | ||
|
|
1f0cdc9bd1 | ||
|
|
9654a945fb | ||
|
|
a4fdfbdf91 |
@@ -1,7 +1,7 @@
|
||||
ARG VERSION_ARG="latest"
|
||||
FROM scratch AS build-amd64
|
||||
|
||||
COPY --from=qemux/qemu-docker:6.09 / /
|
||||
COPY --from=qemux/qemu-docker:6.17 / /
|
||||
|
||||
ARG DEBCONF_NOWARNINGS="yes"
|
||||
ARG DEBIAN_FRONTEND="noninteractive"
|
||||
@@ -29,8 +29,7 @@ RUN set -eu && \
|
||||
COPY --chmod=755 ./src /run/
|
||||
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.43-0/virtio-win-1.9.43.tar.xz /drivers.txz
|
||||
ADD --chmod=664 https://github.com/qemus/virtiso-whql/releases/download/v1.9.44-0/virtio-win-1.9.44.tar.xz /drivers.txz
|
||||
|
||||
FROM dockurr/windows-arm:${VERSION_ARG} AS build-arm64
|
||||
FROM build-${TARGETARCH}
|
||||
|
||||
@@ -6,10 +6,12 @@ services:
|
||||
VERSION: "11"
|
||||
devices:
|
||||
- /dev/kvm
|
||||
- /dev/net/tun
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
ports:
|
||||
- 8006:8006
|
||||
- 3389:3389/tcp
|
||||
- 3389:3389/udp
|
||||
restart: always
|
||||
stop_grace_period: 2m
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: windows-pvc
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 64Gi
|
||||
@@ -16,59 +17,61 @@ metadata:
|
||||
labels:
|
||||
name: windows
|
||||
spec:
|
||||
terminationGracePeriodSeconds: 120 # the Kubernetes default is 30 seconds and it may be not enough
|
||||
containers:
|
||||
- name: windows
|
||||
image: dockurr/windows
|
||||
ports:
|
||||
- containerPort: 8006
|
||||
protocol: TCP
|
||||
- containerPort: 3389
|
||||
protocol: TCP
|
||||
- containerPort: 3389
|
||||
protocol: UDP
|
||||
securityContext:
|
||||
privileged: true
|
||||
env:
|
||||
- name: VERSION
|
||||
value: "11"
|
||||
- name: RAM_SIZE
|
||||
value: "4G"
|
||||
- name: CPU_CORES
|
||||
value: "2"
|
||||
- name: DISK_SIZE
|
||||
value: "64G"
|
||||
volumeMounts:
|
||||
- mountPath: /storage
|
||||
name: storage
|
||||
- mountPath: /dev/kvm
|
||||
name: dev-kvm
|
||||
- name: windows
|
||||
image: dockurr/windows
|
||||
env:
|
||||
- name: VERSION
|
||||
value: "11"
|
||||
- name: RAM_SIZE
|
||||
value: "4G"
|
||||
- name: CPU_CORES
|
||||
value: "2"
|
||||
- name: DISK_SIZE
|
||||
value: "64G"
|
||||
ports:
|
||||
- containerPort: 8006
|
||||
- containerPort: 3389
|
||||
- containerPort: 3389
|
||||
protocol: UDP
|
||||
securityContext:
|
||||
capabilities:
|
||||
add:
|
||||
- NET_ADMIN
|
||||
privileged: true
|
||||
volumeMounts:
|
||||
- mountPath: /storage
|
||||
name: storage
|
||||
- mountPath: /dev/kvm
|
||||
name: dev-kvm
|
||||
- mountPath: /dev/net/tun
|
||||
name: dev-tun
|
||||
terminationGracePeriodSeconds: 120
|
||||
volumes:
|
||||
- name: storage
|
||||
persistentVolumeClaim:
|
||||
claimName: windows-pvc
|
||||
- name: dev-kvm
|
||||
hostPath:
|
||||
path: /dev/kvm
|
||||
- name: storage
|
||||
persistentVolumeClaim:
|
||||
claimName: windows-pvc
|
||||
- hostPath:
|
||||
path: /dev/kvm
|
||||
name: dev-kvm
|
||||
- hostPath:
|
||||
path: /dev/net/tun
|
||||
type: CharDevice
|
||||
name: dev-tun
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: windows
|
||||
spec:
|
||||
type: NodePort
|
||||
ports:
|
||||
- name: tcp-8006
|
||||
port: 8006
|
||||
- name: tcp-3389
|
||||
port: 3389
|
||||
- name: udp-3389
|
||||
port: 3389
|
||||
protocol: UDP
|
||||
selector:
|
||||
name: windows
|
||||
ports:
|
||||
- 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
|
||||
type: NodePort
|
||||
|
||||
12
readme.md
12
readme.md
@@ -37,19 +37,21 @@ services:
|
||||
VERSION: "11"
|
||||
devices:
|
||||
- /dev/kvm
|
||||
- /dev/net/tun
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
ports:
|
||||
- 8006:8006
|
||||
- 3389:3389/tcp
|
||||
- 3389:3389/udp
|
||||
restart: always
|
||||
stop_grace_period: 2m
|
||||
```
|
||||
|
||||
Via Docker CLI:
|
||||
|
||||
```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:
|
||||
@@ -96,8 +98,8 @@ kubectl apply -f https://raw.githubusercontent.com/dockur/windows/refs/heads/mas
|
||||
| **Value** | **Version** | **Size** |
|
||||
|---|---|---|
|
||||
| `11` | Windows 11 Pro | 5.4 GB |
|
||||
| `11l` | Windows 11 LTSC | 4.2 GB |
|
||||
| `11e` | Windows 11 Enterprise | 5.8 GB |
|
||||
| `11l` | Windows 11 LTSC | 4.7 GB |
|
||||
| `11e` | Windows 11 Enterprise | 4.0 GB |
|
||||
||||
|
||||
| `10` | Windows 10 Pro | 5.7 GB |
|
||||
| `10l` | Windows 10 LTSC | 4.6 GB |
|
||||
@@ -176,7 +178,9 @@ kubectl apply -f https://raw.githubusercontent.com/dockur/windows/refs/heads/mas
|
||||
|
||||
### 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
|
||||
volumes:
|
||||
|
||||
103
src/define.sh
103
src/define.sh
@@ -5,6 +5,7 @@ set -Eeuo pipefail
|
||||
: "${HEIGHT:=""}"
|
||||
: "${VERIFY:=""}"
|
||||
: "${REGION:=""}"
|
||||
: "${EDITION:=""}"
|
||||
: "${MANUAL:=""}"
|
||||
: "${REMOVE:=""}"
|
||||
: "${VERSION:=""}"
|
||||
@@ -502,7 +503,10 @@ fromFile() {
|
||||
local file="${1,,}"
|
||||
local arch="${PLATFORM,,}"
|
||||
|
||||
case "${file// /_}" in
|
||||
file="${file//-/_}"
|
||||
file="${file// /_}"
|
||||
|
||||
case "$file" in
|
||||
*"_x64_"* | *"_x64."*)
|
||||
arch="x64"
|
||||
;;
|
||||
@@ -517,7 +521,7 @@ fromFile() {
|
||||
local add=""
|
||||
[[ "$arch" != "x64" ]] && add="$arch"
|
||||
|
||||
case "${file// /_}" in
|
||||
case "$file" in
|
||||
"win7"* | "win_7"* | *"windows7"* | *"windows_7"* )
|
||||
id="win7${arch}"
|
||||
;;
|
||||
@@ -589,7 +593,9 @@ fromName() {
|
||||
*"windows 7"* ) id="win7${arch}" ;;
|
||||
*"windows 8"* ) id="win81${arch}" ;;
|
||||
*"windows 10"* ) id="win10${arch}" ;;
|
||||
*"optimum 10"* ) id="win10${arch}" ;;
|
||||
*"windows 11"* ) id="win11${arch}" ;;
|
||||
*"optimum 11"* ) id="win11${arch}" ;;
|
||||
*"windows vista"* ) id="winvista${arch}" ;;
|
||||
*"server 2025"* ) id="win2025${add}" ;;
|
||||
*"server 2022"* ) id="win2022${add}" ;;
|
||||
@@ -689,16 +695,16 @@ getMido() {
|
||||
sum="b56b911bf18a2ceaeb3904d87e7c770bdf92d3099599d61ac2497b91bf190b11"
|
||||
;;
|
||||
"win11x64-enterprise-eval" )
|
||||
size=6209064960
|
||||
sum="c8dbc96b61d04c8b01faf6ce0794fdf33965c7b350eaa3eb1e6697019902945c"
|
||||
size=4295096320
|
||||
sum="dad633276073f14f3e0373ef7e787569e216d54942ce522b39451c8f2d38ad43"
|
||||
;;
|
||||
"win11x64-enterprise-ltsc-eval" )
|
||||
size=4428627968
|
||||
sum="8abf91c9cd408368dc73aab3425d5e3c02dae74900742072eb5c750fc637c195"
|
||||
size=5060020224
|
||||
sum="2cee70bd183df42b92a2e0da08cc2bb7a2a9ce3a3841955a012c0f77aeb3cb29"
|
||||
;;
|
||||
"win11x64-enterprise-iot-eval" )
|
||||
size=4428627968
|
||||
sum="8abf91c9cd408368dc73aab3425d5e3c02dae74900742072eb5c750fc637c195"
|
||||
size=5060020224
|
||||
sum="2cee70bd183df42b92a2e0da08cc2bb7a2a9ce3a3841955a012c0f77aeb3cb29"
|
||||
;;
|
||||
"win10x64" )
|
||||
size=6140975104
|
||||
@@ -767,9 +773,9 @@ getLink1() {
|
||||
|
||||
case "${id,,}" in
|
||||
"win11x64" | "win11x64-enterprise" | "win11x64-enterprise-eval" )
|
||||
size=5946128384
|
||||
sum="5bb1459034f50766ee480d895d751af73a4af30814240ae32ebc5633546a5af7"
|
||||
url="11/en-us_windows_11_23h2_x64.iso"
|
||||
size=5332989952
|
||||
sum="aa1ad990f930d907b7a34ea897abbb0dfbe47552ca8acc146f92e40381839e05"
|
||||
url="11/en-us_windows_11_24h2_x64.iso"
|
||||
;;
|
||||
"win11x64-iot" | "win11x64-enterprise-iot-eval" )
|
||||
[[ "${lang,,}" != "en" ]] && [[ "${lang,,}" != "en-us" ]] && return 0
|
||||
@@ -1107,66 +1113,12 @@ isESD() {
|
||||
return 1
|
||||
}
|
||||
|
||||
isMG() {
|
||||
|
||||
local id="$1"
|
||||
local lang="$2"
|
||||
|
||||
case "${id,,}" in
|
||||
"win11${PLATFORM,,}" )
|
||||
return 0
|
||||
;;
|
||||
"win11${PLATFORM,,}-enterprise" | "win11${PLATFORM,,}-enterprise-eval" )
|
||||
return 0
|
||||
;;
|
||||
"win11${PLATFORM,,}-ltsc" | "win11${PLATFORM,,}-enterprise-ltsc-eval" )
|
||||
return 0
|
||||
;;
|
||||
"win11${PLATFORM,,}-iot" | "win11${PLATFORM,,}-enterprise-iot-eval" )
|
||||
return 0
|
||||
;;
|
||||
"win10${PLATFORM,,}" )
|
||||
return 0
|
||||
;;
|
||||
"win10${PLATFORM,,}-enterprise" | "win10${PLATFORM,,}-enterprise-eval" )
|
||||
return 0
|
||||
;;
|
||||
"win10${PLATFORM,,}-ltsc" | "win10${PLATFORM,,}-enterprise-ltsc-eval" )
|
||||
return 0
|
||||
;;
|
||||
"win10${PLATFORM,,}-iot" | "win10${PLATFORM,,}-enterprise-iot-eval" )
|
||||
return 0
|
||||
;;
|
||||
"win81${PLATFORM,,}-enterprise" | "win81${PLATFORM,,}-enterprise-eval" )
|
||||
return 0
|
||||
;;
|
||||
"win2025" | "win2025-eval" | "win2022" | "win2022-eval" | "win2019" | "win2019-eval" )
|
||||
return 0
|
||||
;;
|
||||
"win2016" | "win2016-eval" | "win2012r2" | "win2012r2-eval" | "win2008r2" | "win2008r2-eval" )
|
||||
return 0
|
||||
;;
|
||||
"win7x64" | "win7x64-enterprise" | "win7x64-ultimate" | "win7x86" | "win7x86-enterprise" | "win7x86-ultimate" )
|
||||
return 0
|
||||
;;
|
||||
"winvistax64" | "winvistax64-enterprise" | "winvistax64-ultimate" | "winvistax86" | "winvistax86-enterprise" | "winvistax86-ultimate" )
|
||||
return 0
|
||||
;;
|
||||
"winxpx86" | "winxpx64" )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
validVersion() {
|
||||
|
||||
local id="$1"
|
||||
local lang="$2"
|
||||
local url
|
||||
|
||||
isMG "$id" "$lang" && return 0
|
||||
isESD "$id" "$lang" && return 0
|
||||
isMido "$id" "$lang" && return 0
|
||||
|
||||
@@ -1204,27 +1156,6 @@ addFolder() {
|
||||
return 0
|
||||
}
|
||||
|
||||
migrateFiles() {
|
||||
|
||||
local base="$1"
|
||||
local version="$2"
|
||||
local file=""
|
||||
|
||||
[ -f "$base" ] && return 0
|
||||
|
||||
[[ "${version,,}" == "tiny10" ]] && file="tiny10_x64_23h2.iso"
|
||||
[[ "${version,,}" == "tiny11" ]] && file="tiny11_2311_x64.iso"
|
||||
[[ "${version,,}" == "core11" ]] && file="tiny11_core_x64_beta_1.iso"
|
||||
[[ "${version,,}" == "winxpx86" ]] && file="en_windows_xp_professional_with_service_pack_3_x86_cd_x14-80428.iso"
|
||||
[[ "${version,,}" == "winvistax64" ]] && file="en_windows_vista_sp2_x64_dvd_342267.iso"
|
||||
[[ "${version,,}" == "win7x64" ]] && file="en_windows_7_enterprise_with_sp1_x64_dvd_u_677651.iso"
|
||||
|
||||
[ ! -f "$STORAGE/$file" ] && return 0
|
||||
mv -f "$STORAGE/$file" "$base" || return 1
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
prepareInstall() {
|
||||
|
||||
local dir="$2"
|
||||
|
||||
@@ -76,8 +76,6 @@ startInstall() {
|
||||
|
||||
BOOT="$STORAGE/$file"
|
||||
|
||||
! migrateFiles "$BOOT" "$VERSION" && error "Migration failed!" && exit 57
|
||||
|
||||
fi
|
||||
|
||||
skipInstall "$BOOT" && return 1
|
||||
@@ -668,6 +666,11 @@ updateXML() {
|
||||
sed -z "s/<AdministratorPassword>...............<Value \/>/<AdministratorPassword>\n <Value>$admin<\/Value>/g" -i "$asset"
|
||||
fi
|
||||
|
||||
if [ -n "$EDITION" ]; then
|
||||
[[ "${EDITION^^}" == "CORE" ]] && EDITION="STANDARDCORE"
|
||||
sed -i "s/SERVERSTANDARD<\/Value>/SERVER${EDITION^^}<\/Value>/g" "$asset"
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -677,8 +680,13 @@ addDriver() {
|
||||
local path="$2"
|
||||
local target="$3"
|
||||
local driver="$4"
|
||||
local desc=""
|
||||
local folder=""
|
||||
|
||||
if [ -z "$id" ]; then
|
||||
warn "no Windows version specified for \"$driver\" driver!" && return 0
|
||||
fi
|
||||
|
||||
case "${id,,}" in
|
||||
"win7x86"* ) folder="w7/x86" ;;
|
||||
"win7x64"* ) folder="w7/amd64" ;;
|
||||
@@ -698,7 +706,8 @@ addDriver() {
|
||||
esac
|
||||
|
||||
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
|
||||
|
||||
[ ! -d "$path/$driver/$folder" ] && return 0
|
||||
@@ -731,6 +740,11 @@ addDrivers() {
|
||||
local msg="Adding drivers to image..."
|
||||
info "$msg" && html "$msg"
|
||||
|
||||
if [ -z "$version" ]; then
|
||||
version="win11x64"
|
||||
warn "Windows version unknown, falling back to Windows 11 drivers..."
|
||||
fi
|
||||
|
||||
if ! bsdtar -xf /drivers.txz -C "$drivers"; then
|
||||
error "Failed to extract drivers from archive!" && return 1
|
||||
fi
|
||||
|
||||
242
src/mido.sh
242
src/mido.sh
@@ -242,10 +242,10 @@ download_windows_eval() {
|
||||
|
||||
[[ "$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^^}"
|
||||
else
|
||||
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/?linkid=[0-9]\+&clcid=0x[0-9a-z]\+&culture=${culture,,}&country=${country,,}"
|
||||
|
||||
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,,}"
|
||||
fi
|
||||
|
||||
iso_download_links=$(echo "$iso_download_page_html" | grep -io "$filter") || {
|
||||
@@ -429,215 +429,6 @@ getCatalog() {
|
||||
return 0
|
||||
}
|
||||
|
||||
getMG() {
|
||||
|
||||
local version="$1"
|
||||
local lang="$2"
|
||||
local desc="$3"
|
||||
|
||||
local locale=""
|
||||
local culture=""
|
||||
local language=""
|
||||
local user_agent=""
|
||||
|
||||
user_agent=$(get_agent)
|
||||
language=$(getLanguage "$lang" "desc")
|
||||
culture=$(getLanguage "$lang" "culture")
|
||||
|
||||
local msg="Requesting download link from massgrave.dev..."
|
||||
info "$msg" && html "$msg"
|
||||
|
||||
local pattern=""
|
||||
local locale="${culture,,}"
|
||||
local platform="${PLATFORM,,}"
|
||||
local url="https://massgrave.dev/"
|
||||
|
||||
if [[ "${PLATFORM,,}" != "arm64" ]]; then
|
||||
|
||||
case "${version,,}" in
|
||||
"win11${PLATFORM,,}" )
|
||||
url+="windows_11_links"
|
||||
pattern="consumer"
|
||||
;;
|
||||
"win11${PLATFORM,,}-enterprise" | "win11${PLATFORM,,}-enterprise-eval" )
|
||||
url+="windows_11_links"
|
||||
pattern="business"
|
||||
;;
|
||||
"win11${PLATFORM,,}-ltsc" | "win11${PLATFORM,,}-enterprise-ltsc-eval" )
|
||||
url+="windows_ltsc_links"
|
||||
pattern="11_enterprise_ltsc"
|
||||
;;
|
||||
"win11${PLATFORM,,}-iot" | "win11${PLATFORM,,}-enterprise-iot-eval" )
|
||||
url+="windows_ltsc_links"
|
||||
pattern="11_iot"
|
||||
;;
|
||||
"win10${PLATFORM,,}" )
|
||||
url+="windows_10_links"
|
||||
pattern="consumer"
|
||||
;;
|
||||
"win10${PLATFORM,,}-enterprise" | "win10${PLATFORM,,}-enterprise-eval" )
|
||||
url+="windows_10_links"
|
||||
pattern="business"
|
||||
;;
|
||||
"win10${PLATFORM,,}-ltsc" | "win10${PLATFORM,,}-enterprise-ltsc-eval" )
|
||||
url+="windows_ltsc_links"
|
||||
pattern="10_enterprise_ltsc"
|
||||
;;
|
||||
"win10${PLATFORM,,}-iot" | "win10${PLATFORM,,}-enterprise-iot-eval" )
|
||||
url+="windows_ltsc_links"
|
||||
pattern="10_iot"
|
||||
;;
|
||||
"win81${PLATFORM,,}-enterprise" | "win81${PLATFORM,,}-enterprise-eval" )
|
||||
url+="windows_8.1_links"
|
||||
pattern="8.1_enterprise"
|
||||
locale=$(getLanguage "$lang" "code")
|
||||
[[ "$locale" == "sr" ]] && locale="sr-latn"
|
||||
;;
|
||||
"win2025" | "win2025-eval" )
|
||||
url+="windows_server_links"
|
||||
pattern="server_2025"
|
||||
;;
|
||||
"win2022" | "win2022-eval" )
|
||||
url+="windows_server_links"
|
||||
pattern="server_2022"
|
||||
;;
|
||||
"win2019" | "win2019-eval" )
|
||||
url+="windows_server_links"
|
||||
pattern="server_2019"
|
||||
;;
|
||||
"win2016" | "win2016-eval" )
|
||||
url+="windows_server_links"
|
||||
pattern="server_2016"
|
||||
locale=$(getLanguage "$lang" "code")
|
||||
[[ "$locale" == "hk" ]] && locale="ct"
|
||||
[[ "$locale" == "tw" ]] && locale="ct"
|
||||
;;
|
||||
"win2012r2" | "win2012r2-eval" )
|
||||
url+="windows_server_links"
|
||||
pattern="server_2012_r2"
|
||||
locale=$(getLanguage "$lang" "code")
|
||||
;;
|
||||
"win2008r2" | "win2008r2-eval" )
|
||||
url+="windows_server_links"
|
||||
pattern="server_2008_r2"
|
||||
locale=$(getLanguage "$lang" "code")
|
||||
;;
|
||||
"win7x64" | "win7x64-enterprise" )
|
||||
url+="windows_7_links"
|
||||
pattern="enterprise"
|
||||
locale=$(getLanguage "$lang" "code")
|
||||
;;
|
||||
"win7x64-ultimate" )
|
||||
url+="windows_7_links"
|
||||
pattern="ultimate"
|
||||
locale=$(getLanguage "$lang" "code")
|
||||
;;
|
||||
"win7x86" | "win7x86-enterprise" )
|
||||
platform="x86"
|
||||
url+="windows_7_links"
|
||||
pattern="enterprise"
|
||||
locale=$(getLanguage "$lang" "code")
|
||||
;;
|
||||
"win7x86-ultimate" )
|
||||
platform="x86"
|
||||
url+="windows_7_links"
|
||||
pattern="ultimate"
|
||||
locale=$(getLanguage "$lang" "code")
|
||||
;;
|
||||
"winvistax64" | "winvistax64-enterprise" )
|
||||
url+="windows_vista_links"
|
||||
pattern="enterprise"
|
||||
locale=$(getLanguage "$lang" "code")
|
||||
;;
|
||||
"winvistax64-ultimate" )
|
||||
url+="windows_vista_links"
|
||||
pattern="sp2"
|
||||
locale=$(getLanguage "$lang" "code")
|
||||
;;
|
||||
"winvistax86" | "winvistax86-enterprise" )
|
||||
platform="x86"
|
||||
url+="windows_vista_links"
|
||||
pattern="enterprise"
|
||||
locale=$(getLanguage "$lang" "code")
|
||||
;;
|
||||
"winvistax86-ultimate" )
|
||||
platform="x86"
|
||||
url+="windows_vista_links"
|
||||
pattern="sp2"
|
||||
locale=$(getLanguage "$lang" "code")
|
||||
;;
|
||||
"winxpx86" )
|
||||
platform="x86"
|
||||
url+="windows_xp_links"
|
||||
pattern="xp"
|
||||
locale=$(getLanguage "$lang" "code")
|
||||
[[ "$locale" == "pt" ]] && locale="pt-br"
|
||||
[[ "$locale" == "pp" ]] && locale="pt-pt"
|
||||
[[ "$locale" == "cn" ]] && locale="zh-hans"
|
||||
[[ "$locale" == "hk" ]] && locale="zh-hk"
|
||||
[[ "$locale" == "tw" ]] && locale="zh-tw"
|
||||
;;
|
||||
"winxpx64" )
|
||||
url+="windows_xp_links"
|
||||
pattern="xp"
|
||||
locale=$(getLanguage "$lang" "code")
|
||||
;;
|
||||
esac
|
||||
|
||||
else
|
||||
|
||||
case "${version,,}" in
|
||||
"win11${PLATFORM,,}" | "win11${PLATFORM,,}-enterprise" | "win11${PLATFORM,,}-enterprise-eval" )
|
||||
url+="windows_arm_links"
|
||||
pattern="11_business"
|
||||
;;
|
||||
"win11${PLATFORM,,}-ltsc" | "win11${PLATFORM,,}-enterprise-ltsc-eval" )
|
||||
url+="windows_arm_links"
|
||||
pattern="11_iot_enterprise_ltsc"
|
||||
;;
|
||||
"win10${PLATFORM,,}" | "win10${PLATFORM,,}-enterprise" | "win10${PLATFORM,,}-enterprise-eval" )
|
||||
url+="windows_arm_links"
|
||||
pattern="Pro_10"
|
||||
locale="$language"
|
||||
[[ "$locale" == "Chinese" ]] && locale="ChnSimp"
|
||||
[[ "$locale" == "Chinese HK" ]] && locale="ChnTrad"
|
||||
[[ "$locale" == "Chinese TW" ]] && locale="ChnTrad"
|
||||
;;
|
||||
"win10${PLATFORM,,}-ltsc" | "win10${PLATFORM,,}-enterprise-ltsc-eval" )
|
||||
url+="windows_arm_links"
|
||||
pattern="10_iot_enterprise_ltsc"
|
||||
;;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
local body=""
|
||||
|
||||
[[ "$DEBUG" == [Yy1]* ]] && echo "Parsing download page: ${url}"
|
||||
body=$(curl --silent --max-time 30 --user-agent "$user_agent" --location --max-filesize 1M --fail --proto =https --tlsv1.2 --http1.1 -- "$url") || {
|
||||
handle_curl_error "$?" "Massgrave"
|
||||
return $?
|
||||
}
|
||||
|
||||
local list=""
|
||||
list=$(echo "$body" | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep -i '\.iso$')
|
||||
|
||||
local result=""
|
||||
result=$(echo "$list" | grep -i "${platform}" | grep "${pattern}" | grep -i -m 1 "${locale,,}_")
|
||||
|
||||
if [ -z "$result" ]; then
|
||||
if [[ "${lang,,}" != "en" ]] && [[ "${lang,,}" != "en-"* ]]; then
|
||||
error "No download in the $language language available for $desc!"
|
||||
else
|
||||
error "Failed to parse download link for $desc! Please report this at $SUPPORT/issues."
|
||||
fi
|
||||
return 1
|
||||
fi
|
||||
|
||||
MG_URL="$result"
|
||||
return 0
|
||||
}
|
||||
|
||||
getESD() {
|
||||
|
||||
local dir="$1"
|
||||
@@ -922,31 +713,6 @@ downloadImage() {
|
||||
|
||||
done
|
||||
|
||||
if isMG "$version" "$lang"; then
|
||||
|
||||
if [[ "$tried" != "n" ]]; then
|
||||
info "Failed to download $desc, will try a diferent method now..."
|
||||
fi
|
||||
|
||||
tried="y"
|
||||
success="n"
|
||||
|
||||
if getMG "$version" "$lang" "$desc"; then
|
||||
success="y"
|
||||
else
|
||||
info "$msg" && html "$msg" && sleep "$delay"
|
||||
getMG "$version" "$lang" "$desc" && success="y"
|
||||
fi
|
||||
|
||||
if [[ "$success" == "y" ]]; then
|
||||
downloadFile "$iso" "$MG_URL" "" "" "$lang" "$desc" && return 0
|
||||
info "$msg" && html "$msg" && sleep "$delay"
|
||||
downloadFile "$iso" "$MG_URL" "" "" "$lang" "$desc" && return 0
|
||||
rm -f "$iso"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
10
src/samba.sh
10
src/samba.sh
@@ -71,6 +71,9 @@ addShare() {
|
||||
echo " guest account = nobody"
|
||||
echo " map to guest = Bad User"
|
||||
echo " server min protocol = NT1"
|
||||
echo " follow symlinks = yes"
|
||||
echo " wide links = yes"
|
||||
echo " unix extensions = no"
|
||||
echo ""
|
||||
echo " # disable printing services"
|
||||
echo " load printers = no"
|
||||
@@ -89,6 +92,13 @@ 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
|
||||
error "Samba daemon failed to start!"
|
||||
smbd -i --debug-stdout || true
|
||||
|
||||
Reference in New Issue
Block a user