diff options
| -rw-r--r-- | meta/recipes-devtools/e2fsprogs/e2fsprogs/populate-extfs.sh | 96 | ||||
| -rw-r--r-- | meta/recipes-devtools/e2fsprogs/e2fsprogs_1.42.9.bb | 2 |
2 files changed, 0 insertions, 98 deletions
diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs/populate-extfs.sh b/meta/recipes-devtools/e2fsprogs/e2fsprogs/populate-extfs.sh deleted file mode 100644 index 7de720b115..0000000000 --- a/meta/recipes-devtools/e2fsprogs/e2fsprogs/populate-extfs.sh +++ /dev/null | |||
| @@ -1,96 +0,0 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | do_usage () { | ||
| 4 | cat << _EOF | ||
| 5 | Usage: populate-extfs.sh <source> <device> | ||
| 6 | Create an ext2/ext3/ext4 filesystem from a directory or file | ||
| 7 | |||
| 8 | source: The source directory or file | ||
| 9 | device: The target device | ||
| 10 | |||
| 11 | _EOF | ||
| 12 | exit 1 | ||
| 13 | } | ||
| 14 | |||
| 15 | [ $# -ne 2 ] && do_usage | ||
| 16 | |||
| 17 | SRCDIR=${1%%/} | ||
| 18 | DEVICE=$2 | ||
| 19 | DEBUGFS="debugfs" | ||
| 20 | |||
| 21 | { | ||
| 22 | CWD="/" | ||
| 23 | find $SRCDIR | while read FILE; do | ||
| 24 | TGT="${FILE##*/}" | ||
| 25 | DIR="${FILE#$SRCDIR}" | ||
| 26 | DIR="${DIR%$TGT}" | ||
| 27 | |||
| 28 | # Skip the root dir | ||
| 29 | [ ! -z "$DIR" ] || continue | ||
| 30 | [ ! -z "$TGT" ] || continue | ||
| 31 | |||
| 32 | if [ "$DIR" != "$CWD" ]; then | ||
| 33 | echo "cd $DIR" | ||
| 34 | CWD="$DIR" | ||
| 35 | fi | ||
| 36 | |||
| 37 | # Only stat once since stat is a time consuming command | ||
| 38 | STAT=$(stat -c "TYPE=\"%F\";DEVNO=\"0x%t 0x%T\";MODE=\"%f\";U=\"%u\";G=\"%g\"" "$FILE") | ||
| 39 | eval $STAT | ||
| 40 | |||
| 41 | case $TYPE in | ||
| 42 | "directory") | ||
| 43 | echo "mkdir $TGT" | ||
| 44 | ;; | ||
| 45 | "regular file" | "regular empty file") | ||
| 46 | echo "write \"$FILE\" \"$TGT\"" | ||
| 47 | ;; | ||
| 48 | "symbolic link") | ||
| 49 | LINK_TGT=$(readlink "$FILE") | ||
| 50 | echo "symlink \"$TGT\" \"$LINK_TGT\"" | ||
| 51 | ;; | ||
| 52 | "block special file") | ||
| 53 | echo "mknod \"$TGT\" b $DEVNO" | ||
| 54 | ;; | ||
| 55 | "character special file") | ||
| 56 | echo "mknod \"$TGT\" c $DEVNO" | ||
| 57 | ;; | ||
| 58 | "fifo") | ||
| 59 | echo "mknod \"$TGT\" p" | ||
| 60 | ;; | ||
| 61 | *) | ||
| 62 | echo "Unknown/unhandled file type '$TYPE' file: $FILE" 1>&2 | ||
| 63 | ;; | ||
| 64 | esac | ||
| 65 | |||
| 66 | # Set the file mode | ||
| 67 | echo "sif \"$TGT\" mode 0x$MODE" | ||
| 68 | |||
| 69 | # Set uid and gid | ||
| 70 | echo "sif \"$TGT\" uid $U" | ||
| 71 | echo "sif \"$TGT\" gid $G" | ||
| 72 | done | ||
| 73 | |||
| 74 | # Handle the hard links. | ||
| 75 | # Save the hard links to a file, use the inode number as the filename, for example: | ||
| 76 | # If a and b's inode number is 6775928, save a and b to /tmp/tmp.VrCwHh5gdt/6775928. | ||
| 77 | INODE_DIR=`mktemp -d` || exit 1 | ||
| 78 | for i in `find $SRCDIR -type f -links +1 -printf 'INODE=%i###FN=%p\n'`; do | ||
| 79 | eval `echo $i | sed 's$###$ $'` | ||
| 80 | echo ${FN#$SRCDIR} >>$INODE_DIR/$INODE | ||
| 81 | done | ||
| 82 | # Use the debugfs' ln and "sif links_count" to handle them. | ||
| 83 | for i in `ls $INODE_DIR`; do | ||
| 84 | # The link source | ||
| 85 | SRC=`head -1 $INODE_DIR/$i` | ||
| 86 | # Remove the files and link them again except the first one | ||
| 87 | for TGT in `sed -n -e '1!p' $INODE_DIR/$i`; do | ||
| 88 | echo "rm $TGT" | ||
| 89 | echo "ln $SRC $TGT" | ||
| 90 | done | ||
| 91 | LN_CNT=`cat $INODE_DIR/$i | wc -l` | ||
| 92 | # Set the links count | ||
| 93 | echo "sif $SRC links_count $LN_CNT" | ||
| 94 | done | ||
| 95 | rm -fr $INODE_DIR | ||
| 96 | } | $DEBUGFS -w -f - $DEVICE | ||
diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.42.9.bb b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.42.9.bb index b369038f6b..3864ec1d47 100644 --- a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.42.9.bb +++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.42.9.bb | |||
| @@ -4,7 +4,6 @@ require e2fsprogs.inc | |||
| 4 | SRC_URI += "file://acinclude.m4 \ | 4 | SRC_URI += "file://acinclude.m4 \ |
| 5 | file://remove.ldconfig.call.patch \ | 5 | file://remove.ldconfig.call.patch \ |
| 6 | file://fix-icache.patch \ | 6 | file://fix-icache.patch \ |
| 7 | file://populate-extfs.sh \ | ||
| 8 | file://quiet-debugfs.patch \ | 7 | file://quiet-debugfs.patch \ |
| 9 | file://0001-mke2fs-add-the-ability-to-copy-files-from-a-given-di.patch \ | 8 | file://0001-mke2fs-add-the-ability-to-copy-files-from-a-given-di.patch \ |
| 10 | file://0002-misc-create_inode.c-copy-files-recursively.patch \ | 9 | file://0002-misc-create_inode.c-copy-files-recursively.patch \ |
| @@ -51,7 +50,6 @@ do_install () { | |||
| 51 | mv ${D}${base_libdir}/e2initrd_helper ${D}${libdir} | 50 | mv ${D}${base_libdir}/e2initrd_helper ${D}${libdir} |
| 52 | mv ${D}${base_libdir}/pkgconfig ${D}${libdir} | 51 | mv ${D}${base_libdir}/pkgconfig ${D}${libdir} |
| 53 | fi | 52 | fi |
| 54 | install -m 0755 ${WORKDIR}/populate-extfs.sh ${D}${bindir} | ||
| 55 | } | 53 | } |
| 56 | 54 | ||
| 57 | RDEPENDS_e2fsprogs = "e2fsprogs-badblocks" | 55 | RDEPENDS_e2fsprogs = "e2fsprogs-badblocks" |
