From 78e7c869b953e412c7acee76c4ed8d18acc6e022 Mon Sep 17 00:00:00 2001 From: Rick Peters Date: Mon, 28 Sep 2026 11:17:15 +0200 Subject: [PATCH] fix: the build finishes cleanly as root (chown with an empty $USER aborted it) and with the steamify-cachyos ISO name (no rename of a missing cachyos ISO) --- util-iso.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/util-iso.sh b/util-iso.sh index 5406835..84aee4e 100755 --- a/util-iso.sh +++ b/util-iso.sh @@ -199,10 +199,20 @@ run_build() { [ -d "$outFolder/$_profile" ] || mkdir -p "$outFolder/$_profile" cd ${work_dir}/archiso/ sudo mkarchiso -v -w ${work_dir} -o "$outFolder/$_profile" ${work_dir}/archiso/ - sudo chown $USER $outFolder + # $USER is empty when this runs as root (e.g. in a container): an empty + # chown failed and aborted the rest (the build was done, the exit code 1). + sudo chown "${SUDO_USER:-${USER:-$(id -un)}}" "$outFolder" - cp ${work_dir}/iso/arch/pkglist.x86_64.txt "$outFolder/$_profile/$(gen_iso_fn).pkgs.txt" - mv "$outFolder/$_profile/cachyos-$(date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y.%m.%d)-x86_64.iso" "$outFolder/$_profile/${iso_file}" + # Steamify: profiledef.sh's iso_name (steamify-cachyos) names the ISO, so + # CachyOS's rename only applies when mkarchiso wrote cachyos-. + local built="$outFolder/$_profile/cachyos-$(date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y.%m.%d)-x86_64.iso" + if [[ -e "$built" ]]; then + mv "$built" "$outFolder/$_profile/${iso_file}" + else + built="$(ls -t "$outFolder/$_profile"/*.iso | head -1)" + iso_file="$(basename "$built")" + fi + cp ${work_dir}/iso/arch/pkglist.x86_64.txt "$outFolder/$_profile/${iso_file%.iso}.pkgs.txt" msg "Done [Build ISO] ${iso_file}" msg "Finished building [%s]" "${_profile}"