public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Anton Mikanovich <amikan@ilbers.de>
To: isar-users@googlegroups.com
Cc: Anton Mikanovich <amikan@ilbers.de>
Subject: [PATCH] buildchroot: Remove bashism when reading file content
Date: Thu, 10 Jun 2021 10:02:22 +0300	[thread overview]
Message-ID: <20210610070222.5965-1-amikan@ilbers.de> (raw)

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>
---
 meta/classes/buildchroot.bbclass | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/meta/classes/buildchroot.bbclass b/meta/classes/buildchroot.bbclass
index 97d5301..806a29f 100644
--- a/meta/classes/buildchroot.bbclass
+++ b/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
-- 
2.20.1


             reply	other threads:[~2021-06-10  7:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-10  7:02 Anton Mikanovich [this message]
2021-06-10 15:05 ` Henning Schild

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210610070222.5965-1-amikan@ilbers.de \
    --to=amikan@ilbers.de \
    --cc=isar-users@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox