plougher / squashfs-tools

tools to create and extract Squashfs filesystems
GNU General Public License v2.0
758 stars 193 forks source link

feature request: "--basedir" alike option to preserve filepaths for sourcefiles #80

Closed adabru closed 3 years ago

adabru commented 4 years ago

Shamelessly copying the wording from the OP of https://unix.stackexchange.com/q/459284/218172 :

When I create a squashfs image from multiple directories such as:

  • /bin/
  • /usr/bin/
  • /usr/local/bin/
  • /some/other/random/folder/
  • /another/long/path/

If I use command

mksquashfs /bin /usr/bin /usr/local/bin /some/other/random/folder /another/long/path MyNewImage.squashfs

It gives me an image with these top-level folders:

  • bin/
  • bin_1/
  • bin_2/
  • folder/
  • path/

I want my image to contain the full paths from the original filesystem:

  • bin/
  • usr/bin/
  • usr/local/bin/
  • some/other/random/folder/
  • another/long/path/

Currently as a workaround I'm using:

mksquashfs / MyNewImage.squashfs -wildcards -e \
  !(bin|usr|some|another) \
  usr/!(bin|local) \
  usr/local/!(bin) \
  some/!(other) \
  some/other/!(random) \
  some/other/random/!(folder) \
  another/!(long) \
  another/long/!(path)

This is rather cumbersome. A new feature like a basedir option that could be used like --basedir / or --basedir ~ would be very nice, for backing up only a smaller part of the filesystem.

mars4science commented 1 year ago

I find it inconvenient that man page is not up-to-date on that (Linux Mint 21).