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.

phk
  • 5,893
  • 7
  • 41
  • 70
HandyGandy
  • 2,201
  • 3
  • 23
  • 30

2 Answers2

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
Shawn J. Goff
  • 45,338
  • 25
  • 134
  • 145
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

Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250