Hi Mike,

Mike Frysinger wrote:
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]>

Applied.

Thanks
Greg



 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}


--
------------------------------------------------------------------------
Greg Ungerer  --  Chief Software Dude       EMAIL:     [EMAIL PROTECTED]
SnapGear -- a Secure Computing Company      PHONE:       +61 7 3435 2888
825 Stanley St,                             FAX:         +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia         WEB: http://www.SnapGear.com
_______________________________________________
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to