mirror of
https://github.com/dockur/windows.git
synced 2026-07-07 05:07:26 +01:00
feat: Improve installation robustness (#1807)
This commit is contained in:
+22
-8
@@ -598,7 +598,7 @@ extractImage() {
|
|||||||
|
|
||||||
if ! enabled "${UNPACK:-}"; then
|
if ! enabled "${UNPACK:-}"; then
|
||||||
|
|
||||||
LABEL=$(isoinfo -d -i "$iso" | sed -n 's/Volume id: //p')
|
LABEL=$(isoinfo -d -i "$iso" | sed -n 's/Volume id: //p') || LABEL=""
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
@@ -612,8 +612,8 @@ extractImage() {
|
|||||||
error "Failed to extract archive!" && return 1
|
error "Failed to extract archive!" && return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
LABEL=$(isoinfo -d -i "$file" | sed -n 's/Volume id: //p')
|
LABEL=$(isoinfo -d -i "$file" | sed -n 's/Volume id: //p') || LABEL=""
|
||||||
rm -f "$file"
|
rm -f "$file" || warn "Failed to remove temporary ISO file: $file"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -1126,11 +1126,19 @@ updateImage() {
|
|||||||
if ! enabled "$MANUAL"; then
|
if ! enabled "$MANUAL"; then
|
||||||
|
|
||||||
xml=$(basename "$asset")
|
xml=$(basename "$asset")
|
||||||
|
local answer="$tmp/$xml"
|
||||||
|
|
||||||
info "Adding $xml for automatic installation..."
|
info "Adding $xml for automatic installation..."
|
||||||
|
|
||||||
local answer="$tmp/$xml"
|
if ! cp "$asset" "$answer"; then
|
||||||
cp "$asset" "$answer"
|
error "Failed to copy answer file to $answer."
|
||||||
updateXML "$answer" "$language"
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! updateXML "$answer" "$language"; then
|
||||||
|
error "Failed to update answer file: $answer"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
if ! wimlib-imagex update "$wim" "$index" --command "add $answer /$file" > /dev/null; then
|
if ! wimlib-imagex update "$wim" "$index" --command "add $answer /$file" > /dev/null; then
|
||||||
MANUAL="Y"
|
MANUAL="Y"
|
||||||
@@ -1159,9 +1167,15 @@ updateImage() {
|
|||||||
|
|
||||||
if [ -f "$path" ]; then
|
if [ -f "$path" ]; then
|
||||||
if ! enabled "$MANUAL"; then
|
if ! enabled "$MANUAL"; then
|
||||||
mv -f "$path" "${path%.*}.org"
|
if ! mv -f "$path" "${path%.*}.org"; then
|
||||||
|
error "Failed to rename answer file: $path"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
mv -f "$path" "${path%.*}.xml"
|
if ! mv -f "$path" "${path%.*}.xml"; then
|
||||||
|
error "Failed to rename answer file: $path"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
+4
-1
@@ -539,7 +539,10 @@ getESD() {
|
|||||||
|
|
||||||
if [[ "$file" == *".xml" ]]; then
|
if [[ "$file" == *".xml" ]]; then
|
||||||
|
|
||||||
mv -f "$dir/$file" "$dir/$xFile"
|
if ! mv -f "$dir/$file" "$dir/$xFile"; then
|
||||||
|
error "Failed to rename $file to $xFile."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user