Browse Source

mount: Remove bashism when reading file content

Reading mount counter with $(<file) was not working correctly in all
the environments, so replace it with more generic POSIX way:
$(cat file)

Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
Anton Mikanovich 4 years ago
parent
commit
591a537d3c
2 changed files with 6 additions and 4 deletions
  1. 3 2
      meta/classes/buildchroot.bbclass
  2. 3 2
      meta/classes/rootfs.bbclass

+ 3 - 2
meta/classes/buildchroot.bbclass

@@ -30,7 +30,7 @@ buildchroot_do_mounts() {
 
         count="1"
         if [ -f '${BUILDCHROOT_DIR}.mount' ]; then
-            count=$(($(< '${BUILDCHROOT_DIR}.mount') + 1))
+            count=$(($(cat '${BUILDCHROOT_DIR}.mount') + 1))
         fi
         echo $count > '${BUILDCHROOT_DIR}.mount'
         if [ $count -gt 1 ]; then
@@ -78,9 +78,10 @@ buildchroot_undo_mounts() {
         set -e
 
         if [ -f '${BUILDCHROOT_DIR}.mount' ]; then
-            count=$(($(< '${BUILDCHROOT_DIR}.mount') - 1))
+            count=$(($(cat '${BUILDCHROOT_DIR}.mount') - 1))
             echo $count > '${BUILDCHROOT_DIR}.mount'
         else
+            echo "Could not find mount counter"
             exit 1
         fi
         if [ $count -gt 0 ]; then

+ 3 - 2
meta/classes/rootfs.bbclass

@@ -36,7 +36,7 @@ rootfs_do_mounts() {
 
         count="1"
         if [ -f '${ROOTFSDIR}.mount' ]; then
-            count=$(($(< '${ROOTFSDIR}.mount') + 1))
+            count=$(($(cat '${ROOTFSDIR}.mount') + 1))
         fi
         echo $count > '${ROOTFSDIR}.mount'
         if [ $count -gt 1 ]; then
@@ -80,9 +80,10 @@ rootfs_undo_mounts() {
         set -e
 
         if [ -f '${ROOTFSDIR}.mount' ]; then
-            count=$(($(< '${ROOTFSDIR}.mount') - 1))
+            count=$(($(cat '${ROOTFSDIR}.mount') - 1))
             echo $count > '${ROOTFSDIR}.mount'
         else
+            echo "Could not find mount counter"
             exit 1
         fi
         if [ $count -gt 0 ]; then