Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 60107560ba | |||
| 1f07402717 | |||
| 968602f9bc |
+2
-1
@@ -1,5 +1,5 @@
|
||||
FROM scratch
|
||||
COPY --from=qemux/qemu-docker:4.22 / /
|
||||
COPY --from=qemux/qemu-docker:4.24 / /
|
||||
|
||||
ARG DEBCONF_NOWARNINGS "yes"
|
||||
ARG DEBIAN_FRONTEND "noninteractive"
|
||||
@@ -7,6 +7,7 @@ ARG DEBCONF_NONINTERACTIVE_SEEN "true"
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get --no-install-recommends -y install \
|
||||
bc \
|
||||
curl \
|
||||
7zip \
|
||||
wsdd \
|
||||
|
||||
+2
-5
@@ -21,18 +21,15 @@ cd /run
|
||||
|
||||
trap - ERR
|
||||
|
||||
info "Booting $APP using $VERS..."
|
||||
info "Booting ${APP}${BOOT_DESC} on ${CPU} using QEMU v${VERS} with kernel $(uname -r)..."
|
||||
[[ "$DEBUG" == [Yy1]* ]] && echo "Arguments: $ARGS" && echo
|
||||
|
||||
if [[ "$CONSOLE" == [Yy]* ]]; then
|
||||
exec qemu-system-x86_64 ${ARGS:+ $ARGS}
|
||||
fi
|
||||
|
||||
{ qemu-system-x86_64 ${ARGS:+ $ARGS} >"$QEMU_OUT" 2>"$QEMU_LOG"; rc=$?; } || :
|
||||
(( rc != 0 )) && error "$(<"$QEMU_LOG")" && exit 15
|
||||
|
||||
terminal
|
||||
tail -fn +0 "$QEMU_LOG" 2>/dev/null &
|
||||
( sleep 6; [ ! -f "$QEMU_END" ] && info "Windows started succesfully, visit http://localhost:8006/ to view the screen..." ) &
|
||||
cat "$QEMU_TERM" 2> /dev/null | tee "$QEMU_PTY" &
|
||||
wait $! || :
|
||||
|
||||
|
||||
+59
-21
@@ -95,7 +95,9 @@ CUSTOM=$(find "$STORAGE" -maxdepth 1 -type f -iname custom.iso -printf "%f\n" |
|
||||
[ -z "$CUSTOM" ] && CUSTOM=$(find "$STORAGE" -maxdepth 1 -type f -iname custom.img -printf "%f\n" | head -n 1)
|
||||
|
||||
if [ -z "$CUSTOM" ] && [[ "${VERSION,,}" != "http"* ]]; then
|
||||
CUSTOM=$(find "$STORAGE" -maxdepth 1 -type f -iname "${VERSION/\/storage\//}" -printf "%f\n" | head -n 1)
|
||||
FN="${VERSION/\/storage\//}"
|
||||
[[ "$FN" == "."* ]] && FN="${FN:1}"
|
||||
CUSTOM=$(find "$STORAGE" -maxdepth 1 -type f -iname "$FN" -printf "%f\n" | head -n 1)
|
||||
fi
|
||||
|
||||
ESD_URL=""
|
||||
@@ -125,9 +127,9 @@ printVersion() {
|
||||
[[ "$id" == "win2008"* ]] && desc="Windows Server 2008"
|
||||
[[ "$id" == "win10x64-iot" ]] && desc="Windows 10 IoT"
|
||||
[[ "$id" == "win11x64-iot" ]] && desc="Windows 11 IoT"
|
||||
[[ "$id" == "win10x64-ltsc" ]] && desc="Windows 10 LTSC"
|
||||
[[ "$id" == "win10x64-ltsc" ]] && desc="Windows 10 LTSC"
|
||||
[[ "$id" == "win11x64-ltsc" ]] && desc="Windows 11 LTSC"
|
||||
|
||||
|
||||
echo "$desc"
|
||||
return 0
|
||||
}
|
||||
@@ -234,6 +236,7 @@ skipInstall() {
|
||||
finishInstall() {
|
||||
|
||||
local iso="$1"
|
||||
local aborted="$2"
|
||||
|
||||
# Mark ISO as prepared via magic byte
|
||||
printf '\x16' | dd of="$iso" bs=1 seek=0 count=1 conv=notrunc status=none
|
||||
@@ -247,6 +250,11 @@ finishInstall() {
|
||||
rm -f "$STORAGE/windows.old"
|
||||
fi
|
||||
|
||||
# Enable secure boot + TPM on manual installs as Win11 requires
|
||||
if [[ "$MANUAL" == [Yy1]* ]] || [[ "$aborted" == [Yy1]* ]]; then
|
||||
[[ "${DETECTED,,}" == "win11"* ]] && BOOT_MODE="windows_secure"
|
||||
fi
|
||||
|
||||
rm -rf "$TMP"
|
||||
return 0
|
||||
}
|
||||
@@ -259,7 +267,7 @@ abortInstall() {
|
||||
mv -f "$iso" "$STORAGE/$BASE"
|
||||
fi
|
||||
|
||||
finishInstall "$STORAGE/$BASE"
|
||||
finishInstall "$STORAGE/$BASE" "Y"
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -310,7 +318,7 @@ startInstall() {
|
||||
|
||||
if [[ "$magic" == "16" ]]; then
|
||||
|
||||
if hasDisk || [[ "$MANUAL" = [Yy1]* ]]; then
|
||||
if hasDisk || [[ "$MANUAL" == [Yy1]* ]]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -447,7 +455,7 @@ downloadImage() {
|
||||
|
||||
if (( rc == 0 )); then
|
||||
|
||||
[ ! -s "$iso" ] && return 1
|
||||
[ ! -s "$iso" ] || [ ! -f "$iso" ] && return 1
|
||||
|
||||
html "Download finished successfully..."
|
||||
return 0
|
||||
@@ -490,7 +498,7 @@ downloadImage() {
|
||||
fKill "progress.sh"
|
||||
(( rc != 0 )) && error "Failed to download $url , reason: $rc" && exit 60
|
||||
|
||||
[ ! -s "$iso" ] && return 1
|
||||
[ ! -s "$iso" ] || [ ! -f "$iso" ] && return 1
|
||||
|
||||
html "Download finished successfully..."
|
||||
return 0
|
||||
@@ -645,7 +653,7 @@ detectImage() {
|
||||
|
||||
if [ -n "$DETECTED" ]; then
|
||||
|
||||
if [ -s "/run/assets/$DETECTED.xml" ]; then
|
||||
if [ -f "/run/assets/$DETECTED.xml" ]; then
|
||||
[[ "$MANUAL" != [Yy1]* ]] && XML="$DETECTED.xml"
|
||||
return 0
|
||||
fi
|
||||
@@ -664,7 +672,7 @@ detectImage() {
|
||||
|
||||
info "Detecting Windows version from ISO image..."
|
||||
|
||||
if [ -s "$dir/WIN51" ] || [ -s "$dir/SETUPXP.HTM" ]; then
|
||||
if [ -f "$dir/WIN51" ] || [ -f "$dir/SETUPXP.HTM" ]; then
|
||||
DETECTED="winxpx86"
|
||||
info "Detected: Windows XP"
|
||||
return 0
|
||||
@@ -680,9 +688,9 @@ detectImage() {
|
||||
fi
|
||||
|
||||
loc=$(find "$src" -maxdepth 1 -type f -iname install.wim | head -n 1)
|
||||
[ ! -s "$loc" ] && loc=$(find "$src" -maxdepth 1 -type f -iname install.esd | head -n 1)
|
||||
[ ! -f "$loc" ] && loc=$(find "$src" -maxdepth 1 -type f -iname install.esd | head -n 1)
|
||||
|
||||
if [ ! -s "$loc" ]; then
|
||||
if [ ! -f "$loc" ]; then
|
||||
warn "failed to locate 'install.wim' or 'install.esd' in ISO image, $FB"
|
||||
BOOT_MODE="windows_legacy"
|
||||
return 1
|
||||
@@ -710,7 +718,7 @@ detectImage() {
|
||||
desc=$(printVersion "$DETECTED")
|
||||
[ -z "$desc" ] && desc="$DETECTED"
|
||||
|
||||
if [ -s "/run/assets/$DETECTED.xml" ]; then
|
||||
if [ -f "/run/assets/$DETECTED.xml" ]; then
|
||||
[[ "$MANUAL" != [Yy1]* ]] && XML="$DETECTED.xml"
|
||||
info "Detected: $desc"
|
||||
else
|
||||
@@ -930,7 +938,7 @@ prepareImage() {
|
||||
if [[ "${DETECTED,,}" != "winxp"* ]] && [[ "${DETECTED,,}" != "win2008"* ]]; then
|
||||
if [[ "${DETECTED,,}" != "winvista"* ]] && [[ "${DETECTED,,}" != "win7"* ]]; then
|
||||
|
||||
if [ -s "$dir/$ETFS" ] && [ -s "$dir/$EFISYS" ]; then
|
||||
if [ -f "$dir/$ETFS" ] && [ -f "$dir/$EFISYS" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
@@ -966,7 +974,7 @@ updateImage() {
|
||||
local asset="/run/assets/$3"
|
||||
local path src loc index result
|
||||
|
||||
[ ! -s "$asset" ] && return 0
|
||||
[ ! -s "$asset" ] || [ ! -f "$asset" ] && return 0
|
||||
|
||||
path=$(find "$dir" -maxdepth 1 -type f -iname autounattend.xml | head -n 1)
|
||||
[ -n "$path" ] && cp "$asset" "$path"
|
||||
@@ -980,9 +988,9 @@ updateImage() {
|
||||
fi
|
||||
|
||||
loc=$(find "$src" -maxdepth 1 -type f -iname boot.wim | head -n 1)
|
||||
[ ! -s "$loc" ] && loc=$(find "$src" -maxdepth 1 -type f -iname boot.esd | head -n 1)
|
||||
[ ! -f "$loc" ] && loc=$(find "$src" -maxdepth 1 -type f -iname boot.esd | head -n 1)
|
||||
|
||||
if [ ! -s "$loc" ]; then
|
||||
if [ ! -f "$loc" ]; then
|
||||
warn "failed to locate 'boot.wim' or 'boot.esd' in ISO image, $FB"
|
||||
BOOT_MODE="windows_legacy"
|
||||
return 1
|
||||
@@ -1077,9 +1085,7 @@ buildImage() {
|
||||
return 0
|
||||
}
|
||||
|
||||
######################################
|
||||
|
||||
if ! startInstall; then
|
||||
bootWindows() {
|
||||
|
||||
if [ -f "$STORAGE/windows.old" ]; then
|
||||
MACHINE=$(<"$STORAGE/windows.old")
|
||||
@@ -1087,11 +1093,43 @@ if ! startInstall; then
|
||||
BOOT_MODE="windows_legacy"
|
||||
fi
|
||||
|
||||
local creation="1.10"
|
||||
local minimal="2.14"
|
||||
|
||||
if [ -f "$STORAGE/windows.ver" ]; then
|
||||
creation=$(<"$STORAGE/windows.ver")
|
||||
[[ "${creation}" != *"."* ]] && creation="$minimal"
|
||||
fi
|
||||
|
||||
# Force secure boot on installs created prior to v2.14
|
||||
if (( $(echo "$creation < $minimal" | bc -l) )); then
|
||||
if [[ "${BOOT_MODE,,}" == "windows" ]]; then
|
||||
BOOT_MODE="windows_secure"
|
||||
if [ -f "$STORAGE/windows.rom" ] && [ ! -f "$STORAGE/$BOOT_MODE.rom" ]; then
|
||||
mv "$STORAGE/windows.rom" "$STORAGE/$BOOT_MODE.rom"
|
||||
fi
|
||||
if [ -f "$STORAGE/windows.vars" ] && [ ! -f "$STORAGE/$BOOT_MODE.vars" ]; then
|
||||
mv "$STORAGE/windows.vars" "$STORAGE/$BOOT_MODE.vars"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
rm -rf "$TMP"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
######################################
|
||||
|
||||
if ! startInstall; then
|
||||
if ! bootWindows; then
|
||||
error "Failed to boot Windows!"
|
||||
exit 68
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ ! -s "$ISO" ]; then
|
||||
if [ ! -s "$ISO" ] || [ ! -f "$ISO" ]; then
|
||||
rm -f "$ISO"
|
||||
if ! downloadImage "$ISO" "$VERSION"; then
|
||||
error "Failed to download $VERSION"
|
||||
@@ -1126,7 +1164,7 @@ if ! buildImage "$DIR"; then
|
||||
exit 65
|
||||
fi
|
||||
|
||||
finishInstall "$STORAGE/$BASE"
|
||||
finishInstall "$STORAGE/$BASE" "N"
|
||||
|
||||
html "Successfully prepared image for installation..."
|
||||
return 0
|
||||
|
||||
Reference in New Issue
Block a user