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)

This commit is contained in:
theupriser committed 2026-09-28 11:17:15 +02:00
1 parent 9c779c1d73
commit 78e7c869b9
1 file changed
+13 -3
+13 -3
View File
@@ -199,10 +199,20 @@ run_build() {
[ -d "$outFolder/$_profile" ] || mkdir -p "$outFolder/$_profile" [ -d "$outFolder/$_profile" ] || mkdir -p "$outFolder/$_profile"
cd ${work_dir}/archiso/ cd ${work_dir}/archiso/
sudo mkarchiso -v -w ${work_dir} -o "$outFolder/$_profile" ${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" # Steamify: profiledef.sh's iso_name (steamify-cachyos) names the ISO, so
mv "$outFolder/$_profile/cachyos-$(date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y.%m.%d)-x86_64.iso" "$outFolder/$_profile/${iso_file}" # CachyOS's rename only applies when mkarchiso wrote cachyos-<date>.
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 "Done [Build ISO] ${iso_file}"
msg "Finished building [%s]" "${_profile}" msg "Finished building [%s]" "${_profile}"