Add RedHat support for disk-image-get-kernel.

RedHat and Debian based systems have different binary names.

Change-Id: I5162204759fbc4ff167d1584294c9936ab7df4c8
This commit is contained in:
Lucas Alvares Gomes 2013-05-24 12:50:11 +01:00
parent 5695fbd39e
commit c28cb1b5d8
1 changed files with 16 additions and 5 deletions

View File

@ -75,8 +75,19 @@ mount_qcow_image $IMAGE_FILE
# Dig up the initrd and kernel to use.
BOOTDIR="$WORK_DIR/boot"
KERNEL=$(basename `ls -1 $BOOTDIR/vmlinuz*generic | sort -n | tail -1`)
RAMDISK=$(basename `ls -1 $BOOTDIR/initrd*generic | sort -n | tail -1`)
KERNEL=
RAMDISK=
if [ -f $WORK_DIR/etc/redhat-release ]; then
KERNEL=$(basename `ls -1 $BOOTDIR/vmlinuz* | sort -n | tail -1`)
RAMDISK=$(basename `ls -1 $BOOTDIR/initramfs* | sort -n | tail -1`)
elif [ -f $WORK_DIR/etc/debian_version ]; then
KERNEL=$(basename `ls -1 $BOOTDIR/vmlinuz*generic | sort -n | tail -1`)
RAMDISK=$(basename `ls -1 $BOOTDIR/initrd*generic | sort -n | tail -1`)
else
echo "ERROR: Unable to detect operating system"
exit 1
fi
sudo cp $BOOTDIR/$KERNEL $OUT_DIR/$OUT_PFX-vmlinuz
sudo cp $BOOTDIR/$RAMDISK $OUT_DIR/$OUT_PFX-initrd
sudo chmod a+r $OUT_DIR/$OUT_PFX-vmlinuz