From c28cb1b5d8b77fdf170e612a17afcf79e23b7f95 Mon Sep 17 00:00:00 2001 From: Lucas Alvares Gomes Date: Fri, 24 May 2013 12:50:11 +0100 Subject: [PATCH] Add RedHat support for disk-image-get-kernel. RedHat and Debian based systems have different binary names. Change-Id: I5162204759fbc4ff167d1584294c9936ab7df4c8 --- bin/disk-image-get-kernel | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/bin/disk-image-get-kernel b/bin/disk-image-get-kernel index 4e7e8447..b1032a2e 100755 --- a/bin/disk-image-get-kernel +++ b/bin/disk-image-get-kernel @@ -2,13 +2,13 @@ # # Copyright 2012 Hewlett-Packard Development Company, L.P. # All Rights Reserved. -# +# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the @@ -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