Skip to contentSkip to conversation

init-install.sh: fix disk_size

PATCH In review Saul Wold 3 participants 3 messages Sep 27, 2016 – Oct 6, 2016

lore
Share & tools
lore

Saul Wold

author
#0 lore raw

PATCH 1/1 init-install.sh: fix disk_size

From: Robert Yang <[email protected]>

It mis-matched "SanDisk" or "Disk Flags" before, which caused unexpected error.

(cherry picked from commit a68ac76c1b6ed4c1a2fbc944c5021c89fd26217f)
[YOCTO #10333]

---
This is fixed in both Master and Krogoth and just needs a backport to Jethro to address an open bug.

 meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh | 2 +-
 meta/recipes-core/initrdscripts/files/init-install-efi.sh        | 2 +-
 meta/recipes-core/initrdscripts/files/init-install.sh            | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh +1 -1
index 7a0b4d4..b562109 100644
@@ -69,7 +69,7 @@ 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 .*: .*MB' | cut -d" " -f 3 | sed -e "s/MB//")
 
 testfs_size=$((disk_size*testfs_ratio/100))
 rootfs_size=$((disk_size-boot_size-testfs_size))
meta/recipes-core/initrdscripts/files/init-install-efi.sh +1 -1
index 0443a9d..3531158 100644
@@ -120,7 +120,7 @@ if [ ! -e /etc/mtab ]; then
     cat /proc/mounts > /etc/mtab
 fi
 
-disk_size=$(parted ${device} unit mb print | grep Disk | cut -d" " -f 3 | sed -e "s/MB//")
+disk_size=$(parted ${device} unit mb print | grep '^Disk .*: .*MB' | cut -d" " -f 3 | sed -e "s/MB//")
 
 swap_size=$((disk_size*swap_ratio/100))
 rootfs_size=$((disk_size-boot_size-swap_size))
meta/recipes-core/initrdscripts/files/init-install.sh +1 -1
index f9e9768..06f03ed 100644
@@ -116,7 +116,7 @@ if [ ! -L /etc/mtab ]; then
     cat /proc/mounts > /etc/mtab
 fi
 
-disk_size=$(parted ${device} unit mb print | grep Disk | cut -d" " -f 3 | sed -e "s/MB//")
+disk_size=$(parted ${device} unit mb print | grep '^Disk .*: .*MB' | cut -d" " -f 3 | sed -e "s/MB//")
 
 grub_version=$(grub-install -v|sed 's/.* \([0-9]\).*/\1/')
 
Signature · 1 line
2.7.4
#1 lore raw

Ping

Quoted 77 lines · Saul Wold

From: Robert Yang <[email protected]>

It mis-matched "SanDisk" or "Disk Flags" before, which caused unexpected
error.

(cherry picked from commit a68ac76c1b6ed4c1a2fbc944c5021c89fd26217f)
[YOCTO #10333]

---
This is fixed in both Master and Krogoth and just needs a backport to Jethro to address an open bug.

 meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh | 2

+-
 meta/recipes-core/initrdscripts/files/init-install-efi.sh        | 2
+-
 meta/recipes-core/initrdscripts/files/init-install.sh            | 2
+-
 3 files changed, 3 insertions(+), 3 deletions(-)
(quoted diff) +0 -0

testfs.sh b/meta/recipes-core/initrdscripts/files/init-install-efi- testfs.sh
index 7a0b4d4..b562109 100644
--- a/meta/recipes-core/initrdscripts/files/init-install-efi- testfs.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install-efi- testfs.sh

(quoted diff) +0 -0
@@ -69,7 +69,7 @@ umount /dev/${device}* 2> /dev/null || /bin/true

 mkdir -p /tmp
 cat /proc/mounts > /etc/mtab

(quoted diff) +1 -2
-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 .*:

.*MB' | cut -d" " -f 3 | sed -e "s/MB//")

 testfs_size=$((disk_size*testfs_ratio/100))
 rootfs_size=$((disk_size-boot_size-testfs_size))

(quoted diff) +0 -0

efi.sh b/meta/recipes-core/initrdscripts/files/init-install-efi.sh index 0443a9d..3531158 100644

meta/recipes-core/initrdscripts/files/init-install-efi.sh +0 -0
@@ -120,7 +120,7 @@ if [ ! -e /etc/mtab ]; then

     cat /proc/mounts > /etc/mtab
 fi

meta/recipes-core/initrdscripts/files/init-install-efi.sh +1 -2
-disk_size=$(parted ${device} unit mb print | grep Disk | cut -d" "
-f 3 | sed -e "s/MB//")
+disk_size=$(parted ${device} unit mb print | grep '^Disk .*: .*MB' |

cut -d" " -f 3 | sed -e "s/MB//")

 swap_size=$((disk_size*swap_ratio/100))
 rootfs_size=$((disk_size-boot_size-swap_size))

meta/recipes-core/initrdscripts/files/init-install.sh +0 -0
index f9e9768..06f03ed 100644
@@ -116,7 +116,7 @@ if [ ! -L /etc/mtab ]; then

     cat /proc/mounts > /etc/mtab
 fi

meta/recipes-core/initrdscripts/files/init-install.sh +1 -2
-disk_size=$(parted ${device} unit mb print | grep Disk | cut -d" "
-f 3 | sed -e "s/MB//")
+disk_size=$(parted ${device} unit mb print | grep '^Disk .*: .*MB' |

cut -d" " -f 3 | sed -e "s/MB//")

 grub_version=$(grub-install -v|sed 's/.* \([0-9]\).*/\1/')
--
2.7.4