Compare commits

..

No commits in common. "ef850e98373945e81fd64e8436d4363dfa1de9fd" and "05330ff64ced60064f1762a7df7a6f9fcdc299cf" have entirely different histories.

4 changed files with 34 additions and 53 deletions

View file

@ -3,7 +3,7 @@
ARG VERSION_ARG="latest"
FROM scratch AS build-amd64
COPY --from=qemux/qemu:7.13 / /
COPY --from=qemux/qemu:7.12 / /
ARG TARGETARCH
ARG DEBCONF_NOWARNINGS="yes"

View file

@ -1,8 +1,10 @@
#!/usr/bin/env bash
set -Eeuo pipefail
ETFS="boot/etfsboot.com"
TMP="$STORAGE/tmp"
DIR="$TMP/unpack"
FB="falling back to manual installation!"
ETFS="boot/etfsboot.com"
EFISYS="efi/microsoft/boot/efisys_noprompt.bin"
skipInstall() {
@ -14,52 +16,28 @@ skipInstall() {
local previous="$STORAGE/windows.base"
if [ -f "$previous" ]; then
previous=$(<"$previous")
previous="${previous//[![:print:]]/}"
if [ -n "$previous" ]; then
if [[ "${STORAGE,,}/${previous,,}" != "${iso,,}" ]]; then
if ! hasDisk; then
rm -f "$STORAGE/$previous"
return 1
fi
if [ -f "$boot" ] && hasDisk; then
if [[ "${iso,,}" == "${STORAGE,,}/windows."* ]]; then
method="your custom .iso file was changed"
method="your custom .iso file"
else
if [[ "${previous,,}" != "windows."* ]]; then
method="the VERSION variable was changed"
else
method="your custom .iso file was removed"
if [ -f "$boot" ]; then
info "Detected that $method, will be ignored."
method="the VERSION variable"
fi
fi
if [ -n "$method" ]; then
info "Detected that $method was changed, but ignoring this because Windows is already installed."
info "Please start with an empty /storage folder, if you want to install a different version of Windows."
fi
return 0
fi
fi
fi
info "Detected that $method, a backup of your previous installation will be saved..."
local dir="$STORAGE/${previous%.*}.old"
rm -rf "$dir"
mkdir -p "$dir"
[ -f "$STORAGE/$previous" ] && mv -f "$STORAGE/$previous" "$dir/"
find "$STORAGE" -maxdepth 1 -type f \( -iname '*.rom' -or -iname '*.vars' \) -exec mv -n {} "$dir/" \;
find "$STORAGE" -maxdepth 1 -type f \( -iname 'data.*' -or -iname 'windows.*' \) -exec mv -n {} "$dir/" \;
rm -f "$STORAGE/$previous"
return 1
fi
fi
fi
[ -f "$boot" ] && hasDisk && return 0
@ -73,10 +51,8 @@ skipInstall() {
byte="16" && [[ "$MANUAL" == [Yy1]* ]] && byte="17"
if [[ "$magic" != "$byte" ]]; then
info "The ISO will be processed again because the configuration was changed..."
return 1
fi
return 0
@ -112,11 +88,9 @@ startInstall() {
fi
TMP="$STORAGE/tmp"
rm -rf "$TMP"
skipInstall "$BOOT" && return 1
rm -rf "$TMP"
mkdir -p "$TMP"
if [ -z "$CUSTOM" ]; then
@ -131,11 +105,6 @@ startInstall() {
fi
rm -f "$BOOT"
find "$STORAGE" -maxdepth 1 -type f -iname 'data.*' -delete
find "$STORAGE" -maxdepth 1 -type f -iname 'windows.*' -not -iname '*.iso' -delete
find "$STORAGE" -maxdepth 1 -type f \( -iname '*.rom' -or -iname '*.vars' \) -delete
return 0
}
@ -157,6 +126,16 @@ finishInstall() {
fi
fi
rm -f "$STORAGE/windows.old"
rm -f "$STORAGE/windows.vga"
rm -f "$STORAGE/windows.net"
rm -f "$STORAGE/windows.usb"
rm -f "$STORAGE/windows.args"
rm -f "$STORAGE/windows.base"
rm -f "$STORAGE/windows.boot"
rm -f "$STORAGE/windows.mode"
rm -f "$STORAGE/windows.type"
cp -f /run/version "$STORAGE/windows.ver"
if [[ "$iso" == "$STORAGE/"* ]]; then
@ -633,7 +612,8 @@ detectImage() {
warn "failed to locate 'sources' folder in ISO image, $FB" && return 1
fi
wim=$(find "$src" -maxdepth 1 -type f \( -iname install.wim -or -iname install.esd \) -print -quit)
wim=$(find "$src" -maxdepth 1 -type f -iname install.wim -print -quit)
[ ! -f "$wim" ] && wim=$(find "$src" -maxdepth 1 -type f -iname install.esd -print -quit)
if [ ! -f "$wim" ]; then
warn "failed to locate 'install.wim' or 'install.esd' in ISO image, $FB" && return 1
@ -933,7 +913,8 @@ updateImage() {
error "failed to locate 'sources' folder in ISO image, $FB" && return 1
fi
wim=$(find "$src" -maxdepth 1 -type f \( -iname boot.wim -or -iname boot.esd \) -print -quit)
wim=$(find "$src" -maxdepth 1 -type f -iname boot.wim -print -quit)
[ ! -f "$wim" ] && wim=$(find "$src" -maxdepth 1 -type f -iname boot.esd -print -quit)
if [ ! -f "$wim" ]; then
error "failed to locate 'boot.wim' or 'boot.esd' in ISO image, $FB" && return 1
@ -1095,6 +1076,8 @@ buildImage() {
bootWindows() {
rm -rf "$TMP"
if [ -f "$STORAGE/windows.args" ]; then
ARGS=$(<"$STORAGE/windows.args")
ARGS="${ARGS//[![:print:]]/}"
@ -1162,8 +1145,6 @@ if [ ! -s "$ISO" ] || [ ! -f "$ISO" ]; then
fi
fi
DIR="$TMP/unpack"
if ! extractImage "$ISO" "$DIR" "$VERSION"; then
rm -f "$ISO" 2> /dev/null || true
exit 62

View file

@ -689,7 +689,7 @@ downloadImage() {
if isESD "$version" "$lang"; then
if [[ "$tried" != "n" ]]; then
info "Failed to download $desc, will try a different method now..."
info "Failed to download $desc, will try a diferent method now..."
fi
tried="y"