Compare commits

..

No commits in common. "b244fa544fbe3a8ae1af566b8afecbf279ed4497" and "54767605515a040d106d7f4eea83b78a3a9a9bbe" have entirely different histories.

3 changed files with 26 additions and 79 deletions

View File

@ -3,7 +3,7 @@
ARG VERSION_ARG="latest"
FROM scratch AS build-amd64
COPY --from=qemux/qemu:7.26 / /
COPY --from=qemux/qemu:7.25 / /
ARG TARGETARCH
ARG DEBCONF_NOWARNINGS="yes"

View File

@ -339,12 +339,10 @@ extractESD() {
local dir="$2"
local version="$3"
local desc="$4"
local size size_gb sizes space space_gb
local desc total total1 total2 total3 total4
local imageIndex links links1 links2 links3 links4
local size size_gb space space_gb desc
local msg="Extracting $desc bootdisk"
info "$msg..." && html "$msg..."
local msg="Extracting $desc bootdisk..."
info "$msg" && html "$msg"
if [ "$(stat -c%s "$iso")" -lt 100000000 ]; then
error "Invalid ESD file: Size is smaller than 100 MB" && return 1
@ -353,7 +351,7 @@ extractESD() {
rm -rf "$dir"
mkdir -p "$dir"
size=9606127360
size=16106127360
size_gb=$(formatBytes "$size")
space=$(df --output=avail -B 1 "$dir" | tail -n 1)
space_gb=$(formatBytes "$space")
@ -369,68 +367,40 @@ extractESD() {
error "Cannot read the image count in ESD file!" && return 1
fi
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 || {
wimlib-imagex apply "$iso" 1 "$dir" --quiet 2>/dev/null || {
retVal=$?
fKill "progress.sh"
error "Extracting $desc bootdisk failed ($retVal)" && return 1
error "Extracting $desc bootdisk failed" && return $retVal
}
fKill "progress.sh"
local bootWimFile="$dir/sources/boot.wim"
local installWimFile="$dir/sources/install.wim"
local msg="Extracting $desc environment"
info "$msg..." && html "$msg..."
local msg="Extracting $desc environment..."
info "$msg" && html "$msg"
imageIndex="2"
/run/progress.sh "$bootWimFile" "$total3" "$msg ([P])..." &
wimlib-imagex export "$iso" "$imageIndex" "$bootWimFile" --compress=none --quiet || {
wimlib-imagex export "$iso" 2 "$bootWimFile" --compress=none --quiet || {
retVal=$?
fKill "progress.sh"
error "Adding WinPE failed ($retVal)" && return 1
error "Adding WinPE failed" && return ${retVal}
}
local msg="Extracting $desc setup"
info "$msg..."
local msg="Extracting $desc setup..."
info "$msg" && html "$msg"
imageIndex="3"
/run/progress.sh "$bootWimFile" "$total3" "$msg ([P])..." &
wimlib-imagex export "$iso" "$imageIndex" "$bootWimFile" --compress=none --boot --quiet || {
wimlib-imagex export "$iso" 3 "$bootWimFile" --compress=none --boot --quiet || {
retVal=$?
fKill "progress.sh"
error "Adding Windows Setup failed ($retVal)" && return 1
error "Adding Windows Setup failed" && return ${retVal}
}
fKill "progress.sh"
if [[ "${PLATFORM,,}" == "x64" ]]; then
LABEL="CCCOMA_X64FRE_EN-US_DV9"
else
LABEL="CPBA_A64FRE_EN-US_DV9"
fi
local msg="Extracting $desc image"
info "$msg..." && html "$msg..."
local msg="Extracting $desc image..."
info "$msg" && html "$msg"
local edition imageEdition
local edition imageIndex imageEdition
edition=$(getCatalog "$version" "name")
if [ -z "$edition" ]; then
@ -438,27 +408,15 @@ extractESD() {
fi
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
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 || {
wimlib-imagex export "$iso" ${imageIndex} "$installWimFile" --compress=LZMS --chunk-size 128K --quiet || {
retVal=$?
fKill "progress.sh"
error "Addition of $imageIndex to the $desc image failed ($retVal)" && return 1
error "Addition of $imageIndex to the $desc image failed" && return $retVal
}
fKill "progress.sh"
return 0
done
fKill "progress.sh"
error "Failed to find product '$edition' in install.wim!" && return 1
}
@ -482,8 +440,8 @@ extractImage() {
return 1
fi
local msg="Extracting $desc image"
info "$msg..." && html "$msg..."
local msg="Extracting $desc image..."
info "$msg" && html "$msg"
rm -rf "$dir"
mkdir -p "$dir"
@ -1123,8 +1081,8 @@ buildImage() {
desc=$(printVersion "$DETECTED" "ISO")
local msg="Building $desc image"
info "$msg..." && html "$msg..."
local msg="Building $desc image..."
info "$msg" && html "$msg"
[ -z "$LABEL" ] && LABEL="Windows"

View File

@ -74,7 +74,6 @@ ready() {
finish() {
local pid
local cnt=0
local reason=$1
touch "$QEMU_END"
@ -82,24 +81,14 @@ finish() {
if [ -s "$QEMU_PID" ]; then
pid=$(<"$QEMU_PID")
echo && error "Forcefully terminating Windows, reason: $reason..."
error "Forcefully terminating Windows, reason: $reason..."
{ kill -15 "$pid" || true; } 2>/dev/null
while isAlive "$pid"; do
sleep 1
cnt=$((cnt+1))
# Workaround for zombie pid
[ ! -s "$QEMU_PID" ] && break
if [ "$cnt" == "5" ]; then
echo && error "QEMU did not terminate itself, forcefully killing process..."
{ kill -9 "$pid" || true; } 2>/dev/null
fi
done
fi
if [ ! -f "$STORAGE/windows.boot" ] && [ -f "$BOOT" ]; then