initrdscripts: Fix the logic to get disk size
authorBaptiste DURAND <baptiste.durand@gmail.com>
Tue, 19 May 2015 08:22:37 +0000 (10:22 +0200)
committernicolas guyomard <nicolas.guyomard@open.eurogiciel.org>
Wed, 10 Jun 2015 15:51:12 +0000 (17:51 +0200)
Add new pattern to grep command to avoid error

Signed-off-by: Baptiste DURAND <baptiste.durand@gmail.com>
meta/recipes-core/initrdscripts/files/init-install-efi.sh
meta/recipes-core/initrdscripts/files/init-install.sh

index 89d0750..3216118 100644 (file)
@@ -99,8 +99,9 @@ umount /dev/${device}* 2> /dev/null || /bin/true
 mkdir -p /tmp
 cat /proc/mounts > /etc/mtab
 
-disk_size=$(parted /dev/${device} unit mb print | grep Disk | cut -d" " -f 3 | sed -e "s/MB//")
-
+disk_size=$(parted /dev/${device} unit mb print | grep "Disk /dev/${device}" | cut -d" " -f 3 | sed -e "s/MB//")
+# Avoid error when parted provide information on Disk Flags"
+# Disk Flags: pmbr_boot
 swap_size=$((disk_size*swap_ratio/100))
 rootfs_size=$((disk_size-boot_size-swap_size))
 
index fb537ee..7d1151c 100644 (file)
@@ -103,8 +103,9 @@ if [ ! -L /etc/mtab ]; then
        cat /proc/mounts > /etc/mtab
 fi
 
-disk_size=$(parted /dev/${device} unit mb print | grep Disk | cut -d" " -f 3 | sed -e "s/MB//")
-
+disk_size=$(parted /dev/${device} unit mb print | grep "Disk /dev/${device}" | cut -d" " -f 3 | sed -e "s/MB//")
+# Avoid error when parted provide information on Disk Flags"
+# Disk Flags: pmbr_boot
 swap_size=$((disk_size*swap_ratio/100))
 rootfs_size=$((disk_size-boot_size-swap_size))