summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2009-11-24 18:17:07 +0000
committerRichard Jones <rjones@redhat.com>2009-11-25 10:22:30 +0000
commit4404688aa3b476c820ef6ed6bea7e855f0a53e90 (patch)
tree1fe04d82003941395ac228de8162cd17ddd033d7
parent299d5b9dd260d47ac5121126ecd0e3f7bc4830b5 (diff)
downloadlibguestfs-4404688aa3b476c820ef6ed6bea7e855f0a53e90.tar.gz
libguestfs-4404688aa3b476c820ef6ed6bea7e855f0a53e90.tar.xz
libguestfs-4404688aa3b476c820ef6ed6bea7e855f0a53e90.zip
supermin: Die with an error if no kernels found (RHBZ#539746).
Updated with a suggestion from Jim Meyering to use the '-d' option to ls to avoid a future case of directories matching.
-rwxr-xr-xappliance/libguestfs-supermin-helper.in8
1 files changed, 7 insertions, 1 deletions
diff --git a/appliance/libguestfs-supermin-helper.in b/appliance/libguestfs-supermin-helper.in
index 69f22e4f..4d8fd04d 100755
--- a/appliance/libguestfs-supermin-helper.in
+++ b/appliance/libguestfs-supermin-helper.in
@@ -38,7 +38,13 @@ initrd="$3"
# without arch second.
arch=$(echo "@host_cpu@" | sed 's/^i.86$/i?86/')
-kernels=$(ls -1vr /boot/vmlinuz-*.$arch* 2>/dev/null | grep -v xen; ls -1vr /boot/vmlinuz-* 2>/dev/null | grep -v xen)
+kernels=$(ls -1dvr /boot/vmlinuz-*.$arch* 2>/dev/null | grep -v xen; ls -1dvr /boot/vmlinuz-* 2>/dev/null | grep -v xen)
+
+if [ -z "$kernels" ]; then
+ echo "$0: failed to find a suitable kernel in /boot directory" >&2
+ exit 1
+fi
+
for f in $kernels; do
b=$(basename "$f")
b=$(echo "$b" | sed 's,vmlinuz-,,')