Verified Commit b040ef17 authored by nl6720's avatar nl6720
Browse files

mkarchiso: ensure there are no existing image files before trying to create them

This could prevent a few issues when creating an image file when re-running mkarchiso after a failure.

Remove useless test before running rm -f. The command will always succeed.
parent 61854484
......@@ -160,6 +160,7 @@ _cleanup_pacstrap_dir() {
# $@: options to pass to mksquashfs
_run_mksquashfs() {
local image_path="${isofs_dir}/${install_dir}/${arch}/airootfs.sfs"
rm -f -- "${image_path}"
if [[ "${quiet}" == "y" ]]; then
mksquashfs "$@" "${image_path}" -noappend "${airootfs_image_tool_options[@]}" -no-progress > /dev/null
else
......@@ -186,6 +187,7 @@ _mkairootfs_ext4+squashfs() {
'-U' 'clear'
)
[[ ! "${quiet}" == "y" ]] || mkfs_ext4_options+=('-q')
rm -f -- "${pacstrap_dir}.img"
E2FSPROGS_FAKE_TIME="${SOURCE_DATE_EPOCH}" mkfs.ext4 "${mkfs_ext4_options[@]}" -- "${pacstrap_dir}.img" 32G
tune2fs -c 0 -i 0 -- "${pacstrap_dir}.img" > /dev/null
_msg_info "Done!"
......@@ -213,6 +215,7 @@ _mkairootfs_erofs() {
install -d -m 0755 -- "${isofs_dir}/${install_dir}/${arch}"
local image_path="${isofs_dir}/${install_dir}/${arch}/airootfs.erofs"
rm -f -- "${image_path}"
# Generate reproducible file system UUID from SOURCE_DATE_EPOCH
fsuuid="$(uuidgen --sha1 --namespace 93a870ff-8565-4cf3-a67b-f47299271a96 --name "${SOURCE_DATE_EPOCH}")"
_msg_info "Creating EROFS image, this may take some time..."
......@@ -490,7 +493,7 @@ _make_efibootimg() {
)"
# The FAT image must be created with mkfs.fat not mformat, as some systems have issues with mformat made images:
# https://lists.gnu.org/archive/html/grub-devel/2019-04/msg00099.html
[[ -e "${work_dir}/efiboot.img" ]] && rm -f -- "${work_dir}/efiboot.img"
rm -f -- "${work_dir}/efiboot.img"
_msg_info "Creating FAT image of size: ${imgsize} KiB..."
mkfs.fat -C -n ARCHISO_EFI "${work_dir}/efiboot.img" "${imgsize}"
......@@ -903,6 +906,7 @@ _build_iso_image() {
typeset -f "_add_xorrisofs_options_${bootmode}" &> /dev/null && "_add_xorrisofs_options_${bootmode}"
done
rm -f -- "${out_dir}/${image_name}"
_msg_info "Creating ISO image..."
xorriso -as mkisofs \
-iso-level 3 \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment