mirror of
https://github.com/dockur/windows.git
synced 2025-10-26 19:05:49 +00:00
feat: Display ESD processing progress (#1514)
This commit is contained in:
parent
0e95680704
commit
ac106067bd
1 changed files with 66 additions and 24 deletions
|
|
@ -339,10 +339,12 @@ extractESD() {
|
||||||
local dir="$2"
|
local dir="$2"
|
||||||
local version="$3"
|
local version="$3"
|
||||||
local desc="$4"
|
local desc="$4"
|
||||||
local size size_gb space space_gb desc
|
local size size_gb sizes space space_gb
|
||||||
|
local desc total total1 total2 total3 total4
|
||||||
|
local imageIndex links links1 links2 links3 links4
|
||||||
|
|
||||||
local msg="Extracting $desc bootdisk..."
|
local msg="Extracting $desc bootdisk"
|
||||||
info "$msg" && html "$msg"
|
info "$msg..." && html "$msg..."
|
||||||
|
|
||||||
if [ "$(stat -c%s "$iso")" -lt 100000000 ]; then
|
if [ "$(stat -c%s "$iso")" -lt 100000000 ]; then
|
||||||
error "Invalid ESD file: Size is smaller than 100 MB" && return 1
|
error "Invalid ESD file: Size is smaller than 100 MB" && return 1
|
||||||
|
|
@ -351,7 +353,7 @@ extractESD() {
|
||||||
rm -rf "$dir"
|
rm -rf "$dir"
|
||||||
mkdir -p "$dir"
|
mkdir -p "$dir"
|
||||||
|
|
||||||
size=16106127360
|
size=9606127360
|
||||||
size_gb=$(formatBytes "$size")
|
size_gb=$(formatBytes "$size")
|
||||||
space=$(df --output=avail -B 1 "$dir" | tail -n 1)
|
space=$(df --output=avail -B 1 "$dir" | tail -n 1)
|
||||||
space_gb=$(formatBytes "$space")
|
space_gb=$(formatBytes "$space")
|
||||||
|
|
@ -367,40 +369,68 @@ extractESD() {
|
||||||
error "Cannot read the image count in ESD file!" && return 1
|
error "Cannot read the image count in ESD file!" && return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
wimlib-imagex apply "$iso" 1 "$dir" --quiet 2>/dev/null || {
|
sizes=$(wimlib-imagex info "$iso" | grep "Total Bytes:")
|
||||||
|
links=$(wimlib-imagex info "$iso" | grep "Hard Link Bytes:")
|
||||||
|
|
||||||
|
total1=$(awk "NR==1{ print; }" <<< "$sizes" | cut -d':' -f2 | sed 's/^ *//')
|
||||||
|
links1=$(awk "NR==1{ print; }" <<< "$links" | cut -d':' -f2 | sed 's/^ *//')
|
||||||
|
total=$(( total1 - links1 ))
|
||||||
|
|
||||||
|
total3=$(awk "NR==3{ print; }" <<< "$sizes" | cut -d':' -f2 | sed 's/^ *//')
|
||||||
|
links3=$(awk "NR==3{ print; }" <<< "$links" | cut -d':' -f2 | sed 's/^ *//')
|
||||||
|
total3=$(( total3 - links3 ))
|
||||||
|
total3=$(( total3 + 60000000 ))
|
||||||
|
|
||||||
|
/run/progress.sh "$dir" "$total" "$msg ([P])..." &
|
||||||
|
|
||||||
|
imageIndex="1"
|
||||||
|
wimlib-imagex apply "$iso" "$imageIndex" "$dir" --quiet 2>/dev/null || {
|
||||||
retVal=$?
|
retVal=$?
|
||||||
error "Extracting $desc bootdisk failed" && return $retVal
|
fKill "progress.sh"
|
||||||
|
error "Extracting $desc bootdisk failed ($retVal)" && return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fKill "progress.sh"
|
||||||
|
|
||||||
local bootWimFile="$dir/sources/boot.wim"
|
local bootWimFile="$dir/sources/boot.wim"
|
||||||
local installWimFile="$dir/sources/install.wim"
|
local installWimFile="$dir/sources/install.wim"
|
||||||
|
|
||||||
local msg="Extracting $desc environment..."
|
local msg="Extracting $desc environment"
|
||||||
info "$msg" && html "$msg"
|
info "$msg..." && html "$msg..."
|
||||||
|
|
||||||
wimlib-imagex export "$iso" 2 "$bootWimFile" --compress=none --quiet || {
|
imageIndex="2"
|
||||||
|
/run/progress.sh "$bootWimFile" "$total3" "$msg ([P])..." &
|
||||||
|
|
||||||
|
wimlib-imagex export "$iso" "$imageIndex" "$bootWimFile" --compress=none --quiet || {
|
||||||
retVal=$?
|
retVal=$?
|
||||||
error "Adding WinPE failed" && return ${retVal}
|
fKill "progress.sh"
|
||||||
|
error "Adding WinPE failed ($retVal)" && return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
local msg="Extracting $desc setup..."
|
local msg="Extracting $desc setup"
|
||||||
info "$msg" && html "$msg"
|
info "$msg..."
|
||||||
|
|
||||||
wimlib-imagex export "$iso" 3 "$bootWimFile" --compress=none --boot --quiet || {
|
imageIndex="3"
|
||||||
|
/run/progress.sh "$bootWimFile" "$total3" "$msg ([P])..." &
|
||||||
|
|
||||||
|
wimlib-imagex export "$iso" "$imageIndex" "$bootWimFile" --compress=none --boot --quiet || {
|
||||||
retVal=$?
|
retVal=$?
|
||||||
error "Adding Windows Setup failed" && return ${retVal}
|
fKill "progress.sh"
|
||||||
|
error "Adding Windows Setup failed ($retVal)" && return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fKill "progress.sh"
|
||||||
|
|
||||||
if [[ "${PLATFORM,,}" == "x64" ]]; then
|
if [[ "${PLATFORM,,}" == "x64" ]]; then
|
||||||
LABEL="CCCOMA_X64FRE_EN-US_DV9"
|
LABEL="CCCOMA_X64FRE_EN-US_DV9"
|
||||||
else
|
else
|
||||||
LABEL="CPBA_A64FRE_EN-US_DV9"
|
LABEL="CPBA_A64FRE_EN-US_DV9"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local msg="Extracting $desc image..."
|
local msg="Extracting $desc image"
|
||||||
info "$msg" && html "$msg"
|
info "$msg..." && html "$msg..."
|
||||||
|
|
||||||
local edition imageIndex imageEdition
|
local edition imageEdition
|
||||||
edition=$(getCatalog "$version" "name")
|
edition=$(getCatalog "$version" "name")
|
||||||
|
|
||||||
if [ -z "$edition" ]; then
|
if [ -z "$edition" ]; then
|
||||||
|
|
@ -408,15 +438,27 @@ extractESD() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for (( imageIndex=4; imageIndex<=esdImageCount; imageIndex++ )); do
|
for (( imageIndex=4; imageIndex<=esdImageCount; imageIndex++ )); do
|
||||||
imageEdition=$(wimlib-imagex info "$iso" ${imageIndex} | grep '^Description:' | sed 's/Description:[ \t]*//')
|
|
||||||
|
imageEdition=$(wimlib-imagex info "$iso" "$imageIndex" | grep '^Description:' | sed 's/Description:[ \t]*//')
|
||||||
[[ "${imageEdition,,}" != "${edition,,}" ]] && continue
|
[[ "${imageEdition,,}" != "${edition,,}" ]] && continue
|
||||||
wimlib-imagex export "$iso" ${imageIndex} "$installWimFile" --compress=LZMS --chunk-size 128K --quiet || {
|
|
||||||
|
total4=$(du -sb "$iso" | cut -f1)
|
||||||
|
total4=$(( total4 + 3000000 ))
|
||||||
|
|
||||||
|
/run/progress.sh "$installWimFile" "$total4" "$msg ([P])..." &
|
||||||
|
|
||||||
|
wimlib-imagex export "$iso" "$imageIndex" "$installWimFile" --compress=LZMS --chunk-size 128K --quiet || {
|
||||||
retVal=$?
|
retVal=$?
|
||||||
error "Addition of $imageIndex to the $desc image failed" && return $retVal
|
fKill "progress.sh"
|
||||||
|
error "Addition of $imageIndex to the $desc image failed ($retVal)" && return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fKill "progress.sh"
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
fKill "progress.sh"
|
||||||
error "Failed to find product '$edition' in install.wim!" && return 1
|
error "Failed to find product '$edition' in install.wim!" && return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -440,8 +482,8 @@ extractImage() {
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local msg="Extracting $desc image..."
|
local msg="Extracting $desc image"
|
||||||
info "$msg" && html "$msg"
|
info "$msg..." && html "$msg..."
|
||||||
|
|
||||||
rm -rf "$dir"
|
rm -rf "$dir"
|
||||||
mkdir -p "$dir"
|
mkdir -p "$dir"
|
||||||
|
|
@ -1081,8 +1123,8 @@ buildImage() {
|
||||||
|
|
||||||
desc=$(printVersion "$DETECTED" "ISO")
|
desc=$(printVersion "$DETECTED" "ISO")
|
||||||
|
|
||||||
local msg="Building $desc image..."
|
local msg="Building $desc image"
|
||||||
info "$msg" && html "$msg"
|
info "$msg..." && html "$msg..."
|
||||||
|
|
||||||
[ -z "$LABEL" ] && LABEL="Windows"
|
[ -z "$LABEL" ] && LABEL="Windows"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue