10

Obviously, I don't want to actually modify a squashfs. What I would like to do though is take an existing squashfs, a set of files and create a new squashfs which is identical to the old one except that the files in the set either replace similar files in the squasfs or are just added if there is no similar files.

OK, that last part sounded weird. So let me give an example:

There is a squashfs called mfs.squash. Inside it there is a file ./a/foo. I want to create a new squashfs which is identical to the old squashfs – except that there is a new file a/b and I overwrite the ./a/foo with one of my specification.

2 Answers 2

11

Mount the squashfs:

mkdir /mnt/squishy
mount mfs.sqash /mnt/squishy -t squashfs -o loop

Copy the squashfs to another place:

mkdir /tmp/squooshtacular
find /mnt/squishy -xdev -print0 | cpio -pa0V /tmp/squooshtacular

Copy the new files into place:

cp ./a.foo /tmp/squooshtacular/a.foo

Make the new squashfs:

mksquashfs /tmp/squooshtacular mfs_with_bbq_sauce.squash
3
  • 3
    I think this should read: find /mnt/squishy -xdev -print0 | cpio -pd0V /tmp/squooshtacular
    – fpmurphy
    Jun 30, 2011 at 22:15
  • @fpmurphy Why? -d isn't necessary since find is producing all the directory names, and there's no reason to remove -a. Jun 30, 2011 at 23:46
  • 3
    Did not work for me without the -d option
    – fpmurphy
    Jul 1, 2011 at 2:42
1

you can append new_or_modified files_dir on a squashfs_file without unsquash nor cpio mounted_squashfs as above. See the detailed response at:

Append to sub-directory inside squashfs file

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .