mirror of
https://github.com/dockur/windows.git
synced 2025-10-27 11:25:49 +00:00
feat: Support older Windows versions
This commit is contained in:
parent
a85d62bf5a
commit
f95f7fe1a7
1 changed files with 38 additions and 21 deletions
|
|
@ -110,6 +110,18 @@ finishInstall() {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
abortInstall() {
|
||||||
|
|
||||||
|
local iso="$1"
|
||||||
|
|
||||||
|
if [[ "$iso" != "$STORAGE/$BASE" ]]; then
|
||||||
|
mv -f "$iso" "$STORAGE/$BASE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
finishInstall "$STORAGE/$BASE"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
startInstall() {
|
startInstall() {
|
||||||
|
|
||||||
local magic
|
local magic
|
||||||
|
|
@ -210,9 +222,8 @@ downloadImage() {
|
||||||
/run/mido.sh "$url"
|
/run/mido.sh "$url"
|
||||||
cd /run
|
cd /run
|
||||||
|
|
||||||
[ ! -f "$iso" ] && error "Failed to download $url" && exit 61
|
[ ! -f "$iso" ] && return 1
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
info "Downloading $BASE as boot image..."
|
info "Downloading $BASE as boot image..."
|
||||||
|
|
@ -227,8 +238,8 @@ downloadImage() {
|
||||||
{ wget "$url" -O "$iso" -q --no-check-certificate --show-progress "$progress"; rc=$?; } || :
|
{ wget "$url" -O "$iso" -q --no-check-certificate --show-progress "$progress"; rc=$?; } || :
|
||||||
|
|
||||||
(( rc != 0 )) && error "Failed to download $url, reason: $rc" && exit 60
|
(( rc != 0 )) && error "Failed to download $url, reason: $rc" && exit 60
|
||||||
[ ! -f "$iso" ] && error "Failed to download $url" && exit 61
|
|
||||||
|
|
||||||
|
[ ! -f "$iso" ] && return 1
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -270,8 +281,6 @@ extractImage() {
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -z "$CUSTOM" ] && rm -f "$iso"
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -311,7 +320,8 @@ selectXML() {
|
||||||
|
|
||||||
if [ ! -f "$loc" ]; then
|
if [ ! -f "$loc" ]; then
|
||||||
warn "failed to locate 'install.wim' or 'install.esd' in ISO image, $FB"
|
warn "failed to locate 'install.wim' or 'install.esd' in ISO image, $FB"
|
||||||
return 0
|
BOOT_MODE="windows_legacy"
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tag="DISPLAYNAME"
|
tag="DISPLAYNAME"
|
||||||
|
|
@ -345,6 +355,7 @@ selectXML() {
|
||||||
if [[ "${name,,}" == "windows 7" ]]; then
|
if [[ "${name,,}" == "windows 7" ]]; then
|
||||||
BOOT_MODE="windows_legacy"
|
BOOT_MODE="windows_legacy"
|
||||||
warn "detected Windows 7 image, $FB"
|
warn "detected Windows 7 image, $FB"
|
||||||
|
return 1
|
||||||
else
|
else
|
||||||
warn "failed to detect Windows version from string '$name', $FB"
|
warn "failed to detect Windows version from string '$name', $FB"
|
||||||
fi
|
fi
|
||||||
|
|
@ -369,7 +380,7 @@ updateImage() {
|
||||||
|
|
||||||
if [ ! -f "$loc" ]; then
|
if [ ! -f "$loc" ]; then
|
||||||
warn "failed to locate 'boot.wim' or 'boot.esd' in ISO image, $FB"
|
warn "failed to locate 'boot.wim' or 'boot.esd' in ISO image, $FB"
|
||||||
return 0
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
info "Adding XML file for automatic installation..."
|
info "Adding XML file for automatic installation..."
|
||||||
|
|
@ -412,10 +423,8 @@ buildImage() {
|
||||||
genisoimage -b "$ETFS" -no-emul-boot -c "$cat" -iso-level 4 -J -l -D -N -joliet-long -relaxed-filenames -quiet -V "$label" -udf \
|
genisoimage -b "$ETFS" -no-emul-boot -c "$cat" -iso-level 4 -J -l -D -N -joliet-long -relaxed-filenames -quiet -V "$label" -udf \
|
||||||
-boot-info-table -eltorito-alt-boot -eltorito-boot "$EFISYS" -no-emul-boot -o "$out" -allow-limited-size "$dir"
|
-boot-info-table -eltorito-alt-boot -eltorito-boot "$EFISYS" -no-emul-boot -o "$out" -allow-limited-size "$dir"
|
||||||
|
|
||||||
[ -n "$CUSTOM" ] && rm -f "$STORAGE/$CUSTOM"
|
|
||||||
|
|
||||||
if [ -f "$STORAGE/$BASE" ]; then
|
if [ -f "$STORAGE/$BASE" ]; then
|
||||||
error "File $STORAGE/$BASE does already exist ?!" && exit 64
|
error "File $STORAGE/$BASE does already exist?!" && exit 64
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mv "$out" "$STORAGE/$BASE"
|
mv "$out" "$STORAGE/$BASE"
|
||||||
|
|
@ -430,25 +439,33 @@ if ! startInstall; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "$ISO" ]; then
|
if [ ! -f "$ISO" ]; then
|
||||||
downloadImage "$ISO" "$VERSION"
|
if ! downloadImage "$ISO" "$VERSION"; then
|
||||||
|
error "Failed to download $VERSION"
|
||||||
|
exit 61
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! extractImage "$ISO" "$DIR"; then
|
if ! extractImage "$ISO" "$DIR"; then
|
||||||
|
abortInstall "$ISO"
|
||||||
if [[ "$ISO" != "$STORAGE/$BASE" ]]; then
|
|
||||||
mv -f "$ISO" "$STORAGE/$BASE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
finishInstall "$STORAGE/$BASE"
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
selectXML "$DIR"
|
if ! selectXML "$DIR"; then
|
||||||
|
abortInstall "$ISO"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
updateImage "$DIR" "/run/assets/$XML"
|
if ! updateImage "$DIR" "/run/assets/$XML"; then
|
||||||
|
abortInstall "$ISO"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
buildImage "$DIR"
|
rm -f "$ISO"
|
||||||
|
|
||||||
|
if ! buildImage "$DIR"; then
|
||||||
|
error "Failed to build image!"
|
||||||
|
exit 65
|
||||||
|
fi
|
||||||
|
|
||||||
finishInstall "$STORAGE/$BASE"
|
finishInstall "$STORAGE/$BASE"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue