netboot: Improve error reporting in mk-s390image

If an input file is not readable return a proper error message indicating
this.

Before:

$ mk-s390image /var/lib/libvirt/images/hades/vmlinux-s390x out.img
mk-s390image: Unrecognized file format for /var/lib/libvirt/images/hades/vmlinux-s390x

After:

$ mk-s390image /var/lib/libvirt/images/hades/vmlinux-s390x out.img
mk-s390image: File /var/lib/libvirt/images/hades/vmlinux-s390x cannot be read, no read permission

Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Marc Hartmayer
2025-11-11 09:07:27 +00:00
committed by Jan Höppner
parent 128e5f86fe
commit 419f042f55

View File

@@ -123,6 +123,11 @@ dobuild()
echo "$cmd: File $i not found" >&2
return 1
fi
if [ ! -r "$i" ]
then
echo "$cmd: File $i cannot be read, no read permission" >&2
return 1
fi
done
if ! file -b -- "$(readlink -f -- "$kernel")" | grep "Linux S390" > /dev/null
then