Skip to content

Commit 76e5ba1

Browse files
authored
Merge pull request #10 from soaringDistributions/codex/investigate-missing-asset-in-build-587
Failure in build-convert-live due to missing vm-live iso parts - fix live ISO splitter guard
2 parents c93a31d + 1170789 commit 76e5ba1

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

ops.sh

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,89 @@ _gh_release_upload_parts-multiple_sequence() {
257257
return "$rc"
258258
}
259259

260+
###############################################################################
261+
# Split helpers: ensure chunk files are produced for release uploads
262+
###############################################################################
263+
if declare -f _ubDistBuild_split-tail_procedure >/dev/null 2>&1 \
264+
&& ! declare -f _ubDistBuild_split-tail_procedure__orig >/dev/null 2>&1; then
265+
eval "$(declare -f _ubDistBuild_split-tail_procedure \
266+
| sed '1s/_ubDistBuild_split-tail_procedure/_ubDistBuild_split-tail_procedure__orig/')"
267+
fi
268+
269+
_ubDistBuild_split-tail_procedure() {
270+
local inputPath="$1"
271+
local chunkSize=1997537280
272+
local chunkCount=0
273+
274+
if [[ -z "$inputPath" ]]; then
275+
_messageFAIL "==rmh== split: no input path provided"
276+
return 1
277+
fi
278+
279+
if [[ ! -e "$inputPath" ]]; then
280+
_messageFAIL "==rmh== split: missing source $inputPath"
281+
return 1
282+
fi
283+
284+
if [[ ! -s "$inputPath" ]]; then
285+
_messageFAIL "==rmh== split: source is empty $inputPath"
286+
return 1
287+
fi
288+
289+
local iteration size suffix partPath
290+
for iteration in $(seq 0 50); do
291+
if [[ ! -e "$inputPath" ]]; then
292+
break
293+
fi
294+
295+
size=$(stat -c%s -- "$inputPath" 2>/dev/null) || {
296+
_messageFAIL "==rmh== split: unable to stat $inputPath"
297+
return 1
298+
}
299+
300+
if (( size == 0 )); then
301+
break
302+
fi
303+
304+
printf -v suffix "%02d" "$iteration"
305+
partPath="${inputPath}.part${suffix}"
306+
307+
rm -f -- "$partPath"
308+
309+
if (( size <= chunkSize )); then
310+
if ! mv -f -- "$inputPath" "$partPath"; then
311+
_messageFAIL "==rmh== split: failed to move final chunk → $partPath"
312+
return 1
313+
fi
314+
((chunkCount++))
315+
break
316+
fi
317+
318+
if ! tail -c "$chunkSize" -- "$inputPath" > "$partPath"; then
319+
_messageFAIL "==rmh== split: failed to write chunk → $partPath"
320+
return 1
321+
fi
322+
323+
if ! truncate -s -"$chunkSize" -- "$inputPath"; then
324+
_messageFAIL "==rmh== split: failed to truncate source $inputPath"
325+
return 1
326+
fi
327+
328+
((chunkCount++))
329+
done
330+
331+
if [[ -e "$inputPath" && ! -s "$inputPath" ]]; then
332+
rm -f -- "$inputPath" || true
333+
fi
334+
335+
if (( chunkCount == 0 )); then
336+
_messageFAIL "==rmh== split: no chunks were produced for $inputPath"
337+
return 1
338+
fi
339+
340+
return 0
341+
}
342+
260343

261344

262345
###############################################################################

0 commit comments

Comments
 (0)