mirror of
https://github.com/dockur/windows.git
synced 2025-10-27 03:15:49 +00:00
feat: Allow product key configuration (#1110)
This commit is contained in:
parent
b465f78646
commit
5ab42e9409
3 changed files with 42 additions and 59 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
set -Eeuo pipefail
|
||||
|
||||
: "${KEY:=""}"
|
||||
: "${WIDTH:=""}"
|
||||
: "${HEIGHT:=""}"
|
||||
: "${VERIFY:=""}"
|
||||
|
|
@ -1175,9 +1176,7 @@ prepareInstall() {
|
|||
|
||||
local dir="$2"
|
||||
local desc="$3"
|
||||
local arch="$4"
|
||||
local key="$5"
|
||||
local driver="$6"
|
||||
local driver="$4"
|
||||
local drivers="/tmp/drivers"
|
||||
|
||||
rm -rf "$drivers"
|
||||
|
|
@ -1196,7 +1195,8 @@ prepareInstall() {
|
|||
error "Failed to extract drivers!" && return 1
|
||||
fi
|
||||
|
||||
local target
|
||||
local arch target
|
||||
[ -d "$dir/AMD64" ] && arch="amd64" || arch="x86"
|
||||
[[ "${arch,,}" == "x86" ]] && target="$dir/I386" || target="$dir/AMD64"
|
||||
|
||||
if [ ! -f "$drivers/viostor/$driver/$arch/viostor.sys" ]; then
|
||||
|
|
@ -1282,6 +1282,24 @@ prepareInstall() {
|
|||
[ -n "$PASSWORD" ] && password="$PASSWORD"
|
||||
[ -n "$USERNAME" ] && username=$(echo "$USERNAME" | sed 's/[^[:alnum:]@!._-]//g')
|
||||
|
||||
if [[ "${driver,,}" == "xp" ]]; then
|
||||
if [[ "${arch,,}" == "x86" ]]; then
|
||||
# Windows XP Professional x86 generic key (no activation, trial-only)
|
||||
[ -z "$KEY" ] && KEY="DR8GV-C8V6J-BYXHG-7PYJR-DB66Y"
|
||||
else
|
||||
# Windows XP Professional x64 generic key (no activation, trial-only)
|
||||
[ -z "$KEY" ] && KEY="B2RBK-7KPT9-4JP6X-QQFWM-PJD6G"
|
||||
fi
|
||||
else
|
||||
if [[ "${arch,,}" == "x86" ]]; then
|
||||
# Windows Server 2003 Standard x86 generic key (no activation, trial-only)
|
||||
[ -z "$KEY" ] && KEY="QKDCQ-TP2JM-G4MDG-VR6F2-P9C48"
|
||||
else
|
||||
# Windows Server 2003 Standard x64 generic key (no activation, trial-only)
|
||||
[ -z "$KEY" ] && KEY="P4WJG-WK3W7-3HM8W-RWHCK-8JTRY"
|
||||
fi
|
||||
fi
|
||||
|
||||
find "$target" -maxdepth 1 -type f -iname winnt.sif -exec rm {} \;
|
||||
|
||||
{ echo "[Data]"
|
||||
|
|
@ -1319,7 +1337,7 @@ prepareInstall() {
|
|||
echo " FullName=\"$username\""
|
||||
echo " ComputerName=\"*\""
|
||||
echo " OrgName=\"Windows for Docker\""
|
||||
echo " ProductKey=$key"
|
||||
echo " ProductKey=$KEY"
|
||||
echo ""
|
||||
echo "[Identification]"
|
||||
echo " JoinWorkgroup = WORKGROUP"
|
||||
|
|
@ -1465,56 +1483,6 @@ prepareInstall() {
|
|||
return 0
|
||||
}
|
||||
|
||||
prepare2k3() {
|
||||
|
||||
local iso="$1"
|
||||
local dir="$2"
|
||||
local desc="$3"
|
||||
local driver="2k3"
|
||||
local arch key
|
||||
|
||||
[ -d "$dir/AMD64" ] && arch="amd64" || arch="x86"
|
||||
|
||||
if [[ "${arch,,}" == "x86" ]]; then
|
||||
# Windows Server 2003 Standard x86 generic key (no activation, trial-only)
|
||||
# This is not a pirated key, it comes from the official MS documentation.
|
||||
key="QKDCQ-TP2JM-G4MDG-VR6F2-P9C48"
|
||||
else
|
||||
# Windows Server 2003 Standard x64 generic key (no activation, trial-only)
|
||||
# This is not a pirated key, it comes from the official MS documentation.
|
||||
key="P4WJG-WK3W7-3HM8W-RWHCK-8JTRY"
|
||||
fi
|
||||
|
||||
prepareInstall "$iso" "$dir" "$desc" "$arch" "$key" "$driver" || return 1
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
prepareXP() {
|
||||
|
||||
local iso="$1"
|
||||
local dir="$2"
|
||||
local desc="$3"
|
||||
local driver="xp"
|
||||
local arch key
|
||||
|
||||
[ -d "$dir/AMD64" ] && arch="amd64" || arch="x86"
|
||||
|
||||
if [[ "${arch,,}" == "x86" ]]; then
|
||||
# Windows XP Professional x86 generic key (no activation, trial-only)
|
||||
# This is not a pirated key, it comes from the official MS documentation.
|
||||
key="DR8GV-C8V6J-BYXHG-7PYJR-DB66Y"
|
||||
else
|
||||
# Windows XP Professional x64 generic key (no activation, trial-only)
|
||||
# This is not a pirated key, it comes from the official MS documentation.
|
||||
key="B2RBK-7KPT9-4JP6X-QQFWM-PJD6G"
|
||||
fi
|
||||
|
||||
prepareInstall "$iso" "$dir" "$desc" "$arch" "$key" "$driver" || return 1
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
prepareLegacy() {
|
||||
|
||||
local iso="$1"
|
||||
|
|
@ -1601,11 +1569,11 @@ setMachine() {
|
|||
"win2k"* )
|
||||
ETFS="[BOOT]/Boot-NoEmul.img" ;;
|
||||
"winxp"* )
|
||||
if ! prepareXP "$iso" "$dir" "$desc"; then
|
||||
if ! prepareInstall "$iso" "$dir" "$desc" "xp"; then
|
||||
error "Failed to prepare $desc ISO!" && return 1
|
||||
fi ;;
|
||||
"win2003"* )
|
||||
if ! prepare2k3 "$iso" "$dir" "$desc"; then
|
||||
if ! prepareInstall "$iso" "$dir" "$desc" "2k3"; then
|
||||
error "Failed to prepare $desc ISO!" && return 1
|
||||
fi ;;
|
||||
esac
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue