2

I am looking for something that will find the squashed filesystem, and the pass the output to unsquash the fs and it would have to be an absolute path outside the squashfs.

example

/tmp/mnt/live/filesystem.squashfs

desired output

/tmp/unsquashedfs/files

I am fooling with lines of code like

find /tmp/mnt -iname '*.squashfs' -exec unsqaushfs '*.squashfs' {} \;

find /tmp/mnt -print0 -iname "*.squashfs" | unsquashfs "*.squashfs" -T - 

But can't get it to work. Any help from somebody would be appreciated!

2 Answers 2

2

You're basically looking for

find /tmp/mnt -iname '*.squashfs' -exec unsquashfs {} \;

{} is replaced by the path to the matched file.

If you want to specify which directory to extract to, pass the -d option.

find /tmp/mnt -iname '*.squashfs' -exec unsquashfs -d /tmp/unsquashedfs/files {} \;
3
  • Ohh ! See I kept getting the error, ".squashfs" is not found, but I was passing it like this -exec unsquashfs ".squashfs" {} \;, I guess I didn't need to redo that part! Thanks It makes my script cleaner! Commented Sep 21, 2015 at 0:43
  • I never understood the {} \; ... I just copy and pasted, thanks for explaining your answer, not just giving it, as it helps me (understand) with future problems. Commented Sep 21, 2015 at 0:55
  • I started a seperate thread for a related question What is the difference when using FIND between -name and -iname If you are feeling ambitious, please answer, its more for scholarly reasons as my script already works great! Commented Sep 21, 2015 at 1:01
0

So I figured i was working backwards, and this has worked for me

sudo find . -type f \( -name '*.squashfs' -o -name "*.SQFS" \) -exec cp {}  /tmp/fs.squashfs  \; && sudo unsquashfs /tmp/fs.squashfs

What I finally ended with thanks to users help! (I needed ability to search for different parameters and be able to add more in future)

find /tmp/mnt \( -iname '*.squashfs' -o -iname "*.SQFS" \) -exec unsquashfs -d /tmp/squashfs-root/ {} \;
2
  • Wouldn't mind seeing the correct answer for passing it to find if anybody knows, i think its an issue with the wildcard, not sure tho Commented Sep 20, 2015 at 3:34
  • Just finished up my guide on Customizing Live ISO's namely CloneZilla and Parted Magic Commented Sep 20, 2015 at 6:16

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.