package/mke2img: specifying zero inodes means auto
authorYann E. MORIN <yann.morin.1998@free.fr>
Mon, 3 Jul 2017 22:50:56 +0000 (00:50 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tue, 4 Jul 2017 06:46:18 +0000 (08:46 +0200)
Currently, leaving the number of inodes to be autocalculated requires
the user to not specify the -i option at all.

Also accept zero as meaning auto; this will help simplify the ext2.mk
code a little bit.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/mke2img/mke2img

index 758b6dee68d01708e209b3d0ec846befa1498d8d..266df483aacfe4bd85bc6c0d04d5216994c4160d 100755 (executable)
@@ -59,7 +59,7 @@ main() {
     esac
 
     # calculate needed inodes
-    if [ -z "${nb_inodes}" ]; then
+    if [ ${nb_inodes:-0} -eq 0 ]; then
         nb_inodes=$(find "${root_dir}" | wc -l)
         nb_inodes=$((nb_inodes+400))
     fi