I am having issues excluding a specific file from a squashfs. I want to be able to exclude all file types ending with *.db but have had no luck.

Whenever I run the mksquashfs command with the arguments to exclude the file, it always includes the file. I have tried many different variants of the command. My test script is below:

#!/bin/bash OPT="-regex -e '*.db' " echo -e "Creating squashfs..." mksquashfs test test.package ${OPT} echo "Ran the following command: mksquashfs pf test.package ${OPT}" echo -e "Uncompressing squashfs..." mkdir pf_post unsquashfs -f -d test_post/ test.package echo read -p "press any key to continue..." rm test.package rm -r test_post 

The tree of the test directory is below. Both instances of test.db should be excluded but it does not seem to work.

test ├── test │   └── test.db ├── test.ab ├── test.cd ├── test.db ├── test.ef ├── test.gh └── test.sh 
2

2 Answers

So, the (unwrapped) commandline in question reads:

mksquashfs test test.package -regex -e '*.db' 

The problem is, you're not using regex, you're using shell wildcard. As per mksquashfs's manpage, -regex option allows usage of POSIX regular expressions, and -wildcards allows "extended shell wildcards (globbing) to be used in exclude dirs/files". So, just replace -regex with -wildcards in that command line and it should work.

7

My question was answered at

I needed to use wildcards instead with the ... added in front of my exclusion as shown below. It is very important to include a space between the ... and the *.db, otherwise it will not work. I believe I'd tried this method upon recomendation before, but didn't realize when I tried it that there was a space between those two.

mksquashfs test test.package -wildcards -e '... *.db' 

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy