| Submitter | Robert Yang |
|---|---|
| Date | Feb. 26, 2013, 9:24 a.m. |
| Message ID | <e62df3d50df79849ea916095fd028b688b75df52.1361862860.git.liezhi.yang@windriver.com> |
| Download | mbox | patch |
| Permalink | /patch/45113/ |
| State | New |
| Headers | show |
Comments
On Tue, Feb 26, 2013 at 4:24 AM, Robert Yang <liezhi.yang@windriver.com> wrote: > Fix mkdebugfs.sh: > > *) > echo "Unknown file $FILE" 1>&2 > ;; > esac I know this doesn't come from your work, but since you're making changes, I think it would make for a better error message if the above said something along the lines of: echo "Unknown/unhandled file type '$(stat -c "%F" $FILE)' file:$FILE"
On 02/26/2013 09:43 AM, Trevor Woerner wrote: > On Tue, Feb 26, 2013 at 4:24 AM, Robert Yang <liezhi.yang@windriver.com> wrote: >> Fix mkdebugfs.sh: >> >> *) >> echo "Unknown file $FILE" 1>&2 >> ;; >> esac > > I know this doesn't come from your work, but since you're making > changes, I think it would make for a better error message if the above > said something along the lines of: > > echo "Unknown/unhandled file type '$(stat -c "%F" $FILE)' file:$FILE" > That's fine. Also, there is no need to send my script first and then patch it. It was a 5 minute hack, so just modify and include as a single patch.
Patch
diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs/mkdebugfs.sh b/meta/recipes-devtools/e2fsprogs/e2fsprogs/mkdebugfs.sh index 41a13cb..88abc35 100644 --- a/meta/recipes-devtools/e2fsprogs/e2fsprogs/mkdebugfs.sh +++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs/mkdebugfs.sh @@ -1,10 +1,25 @@ #!/bin/sh + +do_usage () { + cat << _EOF +Usage: mkdebugfs.sh <source> <device> +Create an ext2/ext3/ext4 filesystem from a directory or file + + source: The source directory or file + device: The target device + +_EOF + exit 1 +} + +[ $# -ne 2 ] && do_usage + SRCDIR=$1 DEVICE=$2 -DEBUGFS="debugfs/debugfs" - -yes | mkfs.ext4 test.img +DEBUGFS="debugfs" +CMD_FILE=`mktemp` +# Save the debugfs command lines to a file, then run them { CWD="/" find $SRCDIR | while read FILE; do @@ -26,7 +41,7 @@ yes | mkfs.ext4 test.img "directory") echo "mkdir $TGT" ;; - "regular file") + "regular file" | "regular empty file") echo "write $FILE $TGT" ;; "symbolic link") @@ -41,9 +56,27 @@ yes | mkfs.ext4 test.img DEVNO=$(stat -c "%t %T" $FILE) echo "mknod $TGT c $DEVNO" ;; + "fifo") + echo "mknod $TGT p" + ;; *) echo "Unknown file $FILE" 1>&2 ;; esac + + # Set the file mode + MY_MODE=$(stat -c "%f" $FILE) + echo "sif $TGT mode 0x$MY_MODE" + + # Set uid and gid + MY_UID=$(stat -c "%u" $FILE) + echo "sif $TGT uid $MY_UID" + MY_GID=$(stat -c "%g" $FILE) + echo "sif $TGT gid $MY_GID" done -} | $DEBUGFS -w -f /dev/stdin $DEVICE +} > $CMD_FILE + +# Run the command lines +$DEBUGFS -w -f $CMD_FILE $DEVICE + +rm -f $CMD_FILE
Fix mkdebugfs.sh: * Add a simple usage * Add checking for the number of the parameters * Add the "regular empty file" and "fifo" file type * Set mode, uid and gid for the file * Save the command lines to a file and batch run them [YOCTO #3848] Signed-off-by: Robert Yang <liezhi.yang@windriver.com> --- .../e2fsprogs/e2fsprogs/mkdebugfs.sh | 43 +++++++++++++++++++--- 1 file changed, 38 insertions(+), 5 deletions(-)