option to fix permissions
hadmut opened this issue · comments
Hi,
would be convenient if mksquashfs had an option to modify permissions of all files and directories, e.g. o= to completely remove permissions for others (which is not the same as -root-mode), or a+rX to make all files and directories readable.
regards
It already does with the chmod action, for example given the following test directory
phillip@phoenix:/tmp$ unsquashfs -lls test.sqsh
drwx------ phillip/users 52 2023-03-29 03:09 squashfs-root
drwx-w--w- phillip/users 3 2023-03-29 03:09 squashfs-root/dir
-rw--w--w- phillip/users 2 2023-03-29 03:09 squashfs-root/file1
-rw--w--w- phillip/users 2 2023-03-29 03:09 squashfs-root/file2
The command with the action option
phillip@phoenix:/tmp$ mksquashfs test test.sqsh -quiet -no-progress -noappend -action "chmod(o=)@true"
will produce
phillip@phoenix:/tmp$ unsquashfs -lls test.sqsh
drwx------ phillip/users 52 2023-03-29 03:09 squashfs-root
drwx-w---- phillip/users 3 2023-03-29 03:09 squashfs-root/dir
-rw--w---- phillip/users 2 2023-03-29 03:09 squashfs-root/file1
-rw--w---- phillip/users 2 2023-03-29 03:09 squashfs-root/file2
Again, the command with the action option
phillip@phoenix:/tmp$ mksquashfs test test.sqsh -quiet -no-progress -noappend -action "chmod(a+rX)@true"
will produce
phillip@phoenix:/tmp$ unsquashfs -lls test.sqsh
drwxr-xr-x phillip/users 52 2023-03-29 03:09 squashfs-root
drwxrwxrwx phillip/users 3 2023-03-29 03:09 squashfs-root/dir
-rw-rw-rw- phillip/users 2 2023-03-29 03:09 squashfs-root/file1
-rw-rw-rw- phillip/users 2 2023-03-29 03:09 squashfs-root/file2
The "true" test will match on any file. In place of "true" you can use other tests to select which files the chmod action is applied to, e.g.
phillip@phoenix:/tmp$ mksquashfs test test.sqsh -quiet -no-progress -noappend -action "chmod(a+r)@type(f)"
Will only apply the action to files.
phillip@phoenix:/tmp$ unsquashfs -lls test.sqsh
drwx------ phillip/users 52 2023-03-29 03:09 squashfs-root
drwx-w--w- phillip/users 3 2023-03-29 03:09 squashfs-root/dir
-rw-rw-rw- phillip/users 2 2023-03-29 03:09 squashfs-root/file1
-rw-rw-rw- phillip/users 2 2023-03-29 03:09 squashfs-root/file2
Actions are fully documented here https://github.com/plougher/squashfs-tools/blob/master/ACTIONS-README
No response, and so I assume the above is what was requested.