3 # To call this script, make sure mksquashfs is somewhere in PATH
8 ${0##*/} SRC_DIR OUTPUT_FILE [-s] [-m MOUNT_POINT] [-c FILE_CONTEXTS] [-b BLOCK_SIZE] [-z COMPRESSOR] [-zo COMPRESSOR_OPT]
12 echo "in mksquashfsimage.sh PATH=$PATH"
20 if [ ! -d $SRC_DIR ]; then
21 echo "Can not find directory $SRC_DIR!"
28 if [[ "$1" == "-s" ]]; then
34 if [[ "$1" == "-m" ]]; then
40 if [[ "$1" == "-c" ]]; then
46 if [[ "$1" == "-b" ]]; then
53 if [[ "$1" == "-z" ]]; then
59 if [[ "$1" == "-zo" ]]; then
65 if [ -n "$MOUNT_POINT" ]; then
66 OPT="$OPT -mount-point $MOUNT_POINT"
68 if [ -n "$FILE_CONTEXTS" ]; then
69 OPT="$OPT -context-file $FILE_CONTEXTS"
71 if [ -n "$BLOCK_SIZE" ]; then
72 OPT="$OPT -b $BLOCK_SIZE"
75 MAKE_SQUASHFS_CMD="mksquashfs $SRC_DIR/ $OUTPUT_FILE -no-progress -comp $COMPRESSOR $COMPRESSOR_OPT -no-exports -noappend -no-recovery -android-fs-config $OPT"
76 echo $MAKE_SQUASHFS_CMD
83 SPARSE_SUFFIX=".sparse"
84 if [ "$SPARSE" = true ]; then
85 img2simg $OUTPUT_FILE $OUTPUT_FILE$SPARSE_SUFFIX
89 mv $OUTPUT_FILE$SPARSE_SUFFIX $OUTPUT_FILE