From: Ben Shelton <ben.shelton@ni.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH] initscripts: fix bashism in bootmisc.sh
Date: Wed, 23 Jul 2014 09:49:05 -0500 [thread overview]
Message-ID: <1406126945-10647-1-git-send-email-ben.shelton@ni.com> (raw)
In the commit 'initscripts: save /etc/timestamp with seconds accuracy',
a bashism was introduced in the bootmisc.sh script in the code to set
the current date from the stored value in /etc/timestamp. This causes
that operation to fail with the following message when /bin/sh is not
bash:
/etc/init.d/rc: /etc/rcS.d/S55bootmisc.sh: line 73: syntax error: bad substitution
Fixed by using 'cut' (standard under POSIX) rather than bash-specific
substring expansion.
[YOCTO #6566]
Signed-off-by: Ben Shelton <ben.shelton@ni.com>
Tested-by: Maxin B. John <maxin.john@enea.com>
---
meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh b/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh
index ccc7f9f..923fa88 100755
--- a/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh
@@ -70,7 +70,10 @@ then
read TIMESTAMP < /etc/timestamp
if [ ${TIMESTAMP} -gt $SYSTEMDATE ]; then
# format the timestamp as date expects it (2m2d2H2M4Y.2S)
- date -u ${TIMESTAMP:4:8}${TIMESTAMP:0:4}.${TIMESTAMP:(-2)}
+ TS_YR=$(echo $TIMESTAMP | cut -c 1-4)
+ TS_SEC=$(echo $TIMESTAMP | cut -c 13-14)
+ TS_REST=$(echo $TIMESTAMP | cut -c 5-12)
+ date -u ${TS_REST}${TS_YR}.${TS_SEC}
test -x /etc/init.d/hwclock.sh && /etc/init.d/hwclock.sh stop
fi
fi
--
2.0.2
next reply other threads:[~2014-07-23 14:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-23 14:49 Ben Shelton [this message]
2014-07-23 15:41 ` [PATCH] initscripts: fix bashism in bootmisc.sh Richard Purdie
2014-07-23 16:16 ` Christopher Larson
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=1406126945-10647-1-git-send-email-ben.shelton@ni.com \
--to=ben.shelton@ni.com \
--cc=openembedded-core@lists.openembedded.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.