If you try to use -a on a file that happens to be missing a new line at the
end of file, the appended text will end up being appended to the last line
instead of being a line all by itself.
The code in question is a little wonky, but it was chosen due to its
portability across crappy non-GNU systems like Darwin.
Signed-off-by: Mike Frysinger <[EMAIL PROTECTED]>
---
tools/romfs-inst.sh | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/tools/romfs-inst.sh b/tools/romfs-inst.sh
index 6dfa96b..2090545 100755
--- a/tools/romfs-inst.sh
+++ b/tools/romfs-inst.sh
@@ -123,6 +123,12 @@ file_append()
[ "$v" ] && echo "File pattern already installed."
else
[ "$v" ] && echo "Installing entry into ${ROMFSDIR}${dst}."
+ if [ -s ${ROMFSDIR}${dst} ] ; then
+ # if file lacks a trailing new line, add it before
appending the text
+ if [ $(tail -n1 ${ROMFSDIR}${dst} | tr -d '\n' | wc -c)
= $(tail -n1 ${ROMFSDIR}${dst} | wc -c) ] ; then
+ echo "" >> ${ROMFSDIR}${dst} || return 1
+ fi
+ fi
echo "${src}" >> ${ROMFSDIR}${dst} || return 1
fi
setperm ${ROMFSDIR}${dst}
--
1.6.0.1
_______________________________________________
uClinux-dev mailing list
[email protected]
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by [email protected]
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev