mirror of
https://github.com/dockur/windows.git
synced 2025-10-29 04:05:50 +00:00
Update install.sh
This commit is contained in:
parent
48d2019fe9
commit
4a5b91f111
1 changed files with 22 additions and 18 deletions
|
|
@ -166,24 +166,28 @@ abortInstall() {
|
||||||
|
|
||||||
detectCustom() {
|
detectCustom() {
|
||||||
|
|
||||||
CUSTOM=$(find "$STORAGE" -maxdepth 1 -type f -iname windows.iso -printf "%f\n" | head -n 1)
|
CUSTOM=""
|
||||||
|
local file size
|
||||||
|
|
||||||
|
if [[ "${VERSION,,}" != "http"* ]]; then
|
||||||
|
file="${VERSION/\/storage\//}"
|
||||||
|
[[ "$file" == "."* ]] && file="${file:1}"
|
||||||
|
CUSTOM=$(find "$STORAGE" -maxdepth 1 -type f -iname "$file" -printf "%f\n" | head -n 1)
|
||||||
|
fi
|
||||||
|
|
||||||
[ -z "$CUSTOM" ] && CUSTOM=$(find "$STORAGE" -maxdepth 1 -type f -iname custom.iso -printf "%f\n" | head -n 1)
|
[ -z "$CUSTOM" ] && CUSTOM=$(find "$STORAGE" -maxdepth 1 -type f -iname custom.iso -printf "%f\n" | head -n 1)
|
||||||
[ -z "$CUSTOM" ] && CUSTOM=$(find "$STORAGE" -maxdepth 1 -type f -iname boot.iso -printf "%f\n" | head -n 1)
|
|
||||||
[ -z "$CUSTOM" ] && CUSTOM=$(find "$STORAGE" -maxdepth 1 -type f -iname custom.img -printf "%f\n" | head -n 1)
|
[ -z "$CUSTOM" ] && CUSTOM=$(find "$STORAGE" -maxdepth 1 -type f -iname custom.img -printf "%f\n" | head -n 1)
|
||||||
|
[ -z "$CUSTOM" ] && return 0
|
||||||
|
|
||||||
if [ -z "$CUSTOM" ] && [[ "${VERSION,,}" != "http"* ]]; then
|
size="$(stat -c%s "$STORAGE/$CUSTOM")"
|
||||||
FN="${VERSION/\/storage\//}"
|
|
||||||
[[ "$FN" == "."* ]] && FN="${FN:1}"
|
if [ -z "$size" ] || [[ "$size" == "0" ]]; then
|
||||||
CUSTOM=$(find "$STORAGE" -maxdepth 1 -type f -iname "$FN" -printf "%f\n" | head -n 1)
|
CUSTOM=""
|
||||||
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$CUSTOM" ]; then
|
file="windows.$size.iso"
|
||||||
local size
|
[ -s "$STORAGE/$file" ] && CUSTOM="$file"
|
||||||
size="$(stat -c%s "$STORAGE/$CUSTOM")"
|
|
||||||
local file="windows.$size.iso"
|
|
||||||
[ -f "$STORAGE/$file" ] && CUSTOM="$file"
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
@ -556,11 +560,11 @@ setXML() {
|
||||||
[[ "$MANUAL" == [Yy1]* ]] && return 0
|
[[ "$MANUAL" == [Yy1]* ]] && return 0
|
||||||
|
|
||||||
local file="$STORAGE/custom.xml"
|
local file="$STORAGE/custom.xml"
|
||||||
[ -f "$file" ] && XML="$file" && return 0
|
[ -f "$file" ] && [ -s "$file" ] && XML="$file" && return 0
|
||||||
|
|
||||||
file="$1"
|
file="$1"
|
||||||
[ -z "$file" ] && file="/run/assets/$DETECTED.xml"
|
[ -z "$file" ] && file="/run/assets/$DETECTED.xml"
|
||||||
[ -f "$file" ] && XML="$file" && return 0
|
[ -f "$file" ] && [ -s "$file" ] && XML="$file" && return 0
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
@ -618,7 +622,7 @@ detectImage() {
|
||||||
setXML "" && return 0
|
setXML "" && return 0
|
||||||
|
|
||||||
desc=$(printEdition "$DETECTED" "this version")
|
desc=$(printEdition "$DETECTED" "this version")
|
||||||
warn "no answer file found for $desc ($DETECTED.xml), $FB."
|
warn "the answer file for $desc was not found ($DETECTED.xml), $FB."
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -650,7 +654,7 @@ detectImage() {
|
||||||
result=$(wimlib-imagex info -xml "$loc" | tr -d '\000')
|
result=$(wimlib-imagex info -xml "$loc" | tr -d '\000')
|
||||||
|
|
||||||
if ! detectVersion "$result"; then
|
if ! detectVersion "$result"; then
|
||||||
msg="failed to determine Windows version from image"
|
msg="Failed to determine Windows version from image"
|
||||||
setXML "" && info "${msg}!" || warn "${msg}, $FB"
|
setXML "" && info "${msg}!" || warn "${msg}, $FB"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
@ -660,10 +664,10 @@ detectImage() {
|
||||||
info "Detected: $desc"
|
info "Detected: $desc"
|
||||||
setXML "" && return 0
|
setXML "" && return 0
|
||||||
|
|
||||||
msg="no answer file found for $desc ($DETECTED.xml)"
|
msg="the answer file for $desc was not found ($DETECTED.xml)"
|
||||||
local fallback="/run/assets/${DETECTED%%-*}.xml"
|
local fallback="/run/assets/${DETECTED%%-*}.xml"
|
||||||
|
|
||||||
setXML "$fallback" && warn "${msg/version/edition}." || warn "${msg}, $FB."
|
setXML "$fallback" && warn "${msg}." || warn "${msg}, $FB."
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue