mirror of
https://github.com/dockur/windows.git
synced 2025-10-28 03:45:48 +00:00
fix: File detection
This commit is contained in:
parent
2a30410cf5
commit
4cd3b48d3a
1 changed files with 14 additions and 14 deletions
|
|
@ -127,9 +127,9 @@ printVersion() {
|
||||||
[[ "$id" == "win2008"* ]] && desc="Windows Server 2008"
|
[[ "$id" == "win2008"* ]] && desc="Windows Server 2008"
|
||||||
[[ "$id" == "win10x64-iot" ]] && desc="Windows 10 IoT"
|
[[ "$id" == "win10x64-iot" ]] && desc="Windows 10 IoT"
|
||||||
[[ "$id" == "win11x64-iot" ]] && desc="Windows 11 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"
|
[[ "$id" == "win11x64-ltsc" ]] && desc="Windows 11 LTSC"
|
||||||
|
|
||||||
echo "$desc"
|
echo "$desc"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
@ -456,7 +456,7 @@ downloadImage() {
|
||||||
|
|
||||||
if (( rc == 0 )); then
|
if (( rc == 0 )); then
|
||||||
|
|
||||||
[ ! -s "$iso" ] && return 1
|
[ ! -s "$iso" ] || [ ! -f "$iso" ] && return 1
|
||||||
|
|
||||||
html "Download finished successfully..."
|
html "Download finished successfully..."
|
||||||
return 0
|
return 0
|
||||||
|
|
@ -499,7 +499,7 @@ downloadImage() {
|
||||||
fKill "progress.sh"
|
fKill "progress.sh"
|
||||||
(( rc != 0 )) && error "Failed to download $url , reason: $rc" && exit 60
|
(( 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..."
|
html "Download finished successfully..."
|
||||||
return 0
|
return 0
|
||||||
|
|
@ -654,7 +654,7 @@ detectImage() {
|
||||||
|
|
||||||
if [ -n "$DETECTED" ]; then
|
if [ -n "$DETECTED" ]; then
|
||||||
|
|
||||||
if [ -s "/run/assets/$DETECTED.xml" ]; then
|
if [ -f "/run/assets/$DETECTED.xml" ]; then
|
||||||
[[ "$MANUAL" != [Yy1]* ]] && XML="$DETECTED.xml"
|
[[ "$MANUAL" != [Yy1]* ]] && XML="$DETECTED.xml"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
@ -673,7 +673,7 @@ detectImage() {
|
||||||
|
|
||||||
info "Detecting Windows version from ISO image..."
|
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"
|
DETECTED="winxpx86"
|
||||||
info "Detected: Windows XP"
|
info "Detected: Windows XP"
|
||||||
return 0
|
return 0
|
||||||
|
|
@ -689,9 +689,9 @@ detectImage() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
loc=$(find "$src" -maxdepth 1 -type f -iname install.wim | head -n 1)
|
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"
|
warn "failed to locate 'install.wim' or 'install.esd' in ISO image, $FB"
|
||||||
BOOT_MODE="windows_legacy"
|
BOOT_MODE="windows_legacy"
|
||||||
return 1
|
return 1
|
||||||
|
|
@ -719,7 +719,7 @@ detectImage() {
|
||||||
desc=$(printVersion "$DETECTED")
|
desc=$(printVersion "$DETECTED")
|
||||||
[ -z "$desc" ] && desc="$DETECTED"
|
[ -z "$desc" ] && desc="$DETECTED"
|
||||||
|
|
||||||
if [ -s "/run/assets/$DETECTED.xml" ]; then
|
if [ -f "/run/assets/$DETECTED.xml" ]; then
|
||||||
[[ "$MANUAL" != [Yy1]* ]] && XML="$DETECTED.xml"
|
[[ "$MANUAL" != [Yy1]* ]] && XML="$DETECTED.xml"
|
||||||
info "Detected: $desc"
|
info "Detected: $desc"
|
||||||
else
|
else
|
||||||
|
|
@ -939,7 +939,7 @@ prepareImage() {
|
||||||
if [[ "${DETECTED,,}" != "winxp"* ]] && [[ "${DETECTED,,}" != "win2008"* ]]; then
|
if [[ "${DETECTED,,}" != "winxp"* ]] && [[ "${DETECTED,,}" != "win2008"* ]]; then
|
||||||
if [[ "${DETECTED,,}" != "winvista"* ]] && [[ "${DETECTED,,}" != "win7"* ]]; 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
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -975,7 +975,7 @@ updateImage() {
|
||||||
local asset="/run/assets/$3"
|
local asset="/run/assets/$3"
|
||||||
local path src loc index result
|
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)
|
path=$(find "$dir" -maxdepth 1 -type f -iname autounattend.xml | head -n 1)
|
||||||
[ -n "$path" ] && cp "$asset" "$path"
|
[ -n "$path" ] && cp "$asset" "$path"
|
||||||
|
|
@ -989,9 +989,9 @@ updateImage() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
loc=$(find "$src" -maxdepth 1 -type f -iname boot.wim | head -n 1)
|
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"
|
warn "failed to locate 'boot.wim' or 'boot.esd' in ISO image, $FB"
|
||||||
BOOT_MODE="windows_legacy"
|
BOOT_MODE="windows_legacy"
|
||||||
return 1
|
return 1
|
||||||
|
|
@ -1100,7 +1100,7 @@ if ! startInstall; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -s "$ISO" ]; then
|
if [ ! -s "$ISO" ] || [ ! -f "$ISO" ]; then
|
||||||
rm -f "$ISO"
|
rm -f "$ISO"
|
||||||
if ! downloadImage "$ISO" "$VERSION"; then
|
if ! downloadImage "$ISO" "$VERSION"; then
|
||||||
error "Failed to download $VERSION"
|
error "Failed to download $VERSION"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue