]> code.ossystems Code Review - openembedded-core.git/commitdiff
initramfs-framework:rootfs: fix some conditional check
authorMing Liu <liu.ming50@gmail.com>
Wed, 24 Mar 2021 12:37:58 +0000 (13:37 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 28 Mar 2021 21:26:19 +0000 (22:26 +0100)
Drop a duplicated check for "PARTLABEL=", also change to use elif to
avoid go through all the checks for root parameter.

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/initrdscripts/initramfs-framework/rootfs

index ee24e82af3b69856b6d778c7bbef8e5893dbe55d..10b95831721a6fe5829e32f25c66226445301644 100644 (file)
@@ -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