Skip to contentSkip to conversation

initramfs-framework:rootfs: fix some conditional check

PATCH New Ming Liu 1 participant 1 message Mar 24, 2021

lore
Share & tools
lore

Ming Liu

author
#0 lore raw

PATCH 1/1 initramfs-framework:rootfs: fix some conditional check

From: Ming Liu <[email protected]>

Drop a duplicated check for "PARTLABEL=", also change to use elif to avoid go through all the checks for root parameter.

---
 .../initrdscripts/initramfs-framework/rootfs    | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)
meta/recipes-core/initrdscripts/initramfs-framework/rootfs +3 -14
index ee24e82af3..10b9583172 100644
@@ -24,24 +24,13 @@ rootfs_run() {
 			if [ "`echo ${bootparam_root} | cut -c1-5`" = "UUID=" ]; then
 				root_uuid=`echo $bootparam_root | cut -c6-`
 				bootparam_root="/dev/disk/by-uuid/$root_uuid"
-			fi
-
-			if [ "`echo ${bootparam_root} | cut -c1-9`" = "PARTUUID=" ]; then
+			elif [ "`echo ${bootparam_root} | cut -c1-9`" = "PARTUUID=" ]; then
 				root_partuuid=`echo $bootparam_root | cut -c10-`
 				bootparam_root="/dev/disk/by-partuuid/$root_partuuid"
-			fi
-
-			if [ "`echo ${bootparam_root} | cut -c1-10`" = "PARTLABEL=" ]; then
-				root_partlabel=`echo $bootparam_root | cut -c11-`
-				bootparam_root="/dev/disk/by-partlabel/$root_partlabel"
-			fi
-
-			if [ "`echo ${bootparam_root} | cut -c1-10`" = "PARTLABEL=" ]; then
+			elif [ "`echo ${bootparam_root} | cut -c1-10`" = "PARTLABEL=" ]; then
 				root_partlabel=`echo $bootparam_root | cut -c11-`
 				bootparam_root="/dev/disk/by-partlabel/$root_partlabel"
-			fi
-
-			if [ "`echo ${bootparam_root} | cut -c1-6`" = "LABEL=" ]; then
+			elif [ "`echo ${bootparam_root} | cut -c1-6`" = "LABEL=" ]; then
 				root_label=`echo $bootparam_root | cut -c7-`
 				bootparam_root="/dev/disk/by-label/$root_label"
 			fi
Signature · 1 line
2.29.0