mksquashfs: how to include full absolute directory paths inside the squashfs image?

Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
0
down vote
favorite
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/
Is there any simple way to do this without first making copies or moving the original files before creating the image?
directory directory-structure archive disk-image squashfs
add a comment |Â
up vote
0
down vote
favorite
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/
Is there any simple way to do this without first making copies or moving the original files before creating the image?
directory directory-structure archive disk-image squashfs
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
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/
Is there any simple way to do this without first making copies or moving the original files before creating the image?
directory directory-structure archive disk-image squashfs
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/
Is there any simple way to do this without first making copies or moving the original files before creating the image?
directory directory-structure archive disk-image squashfs
asked Jul 30 at 8:32
YeB
17339
17339
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
0
down vote
man mksquashfs:
-keep-as-directory
if one source directory is specified, create a root directory conâÂÂ
taining that directory, rather than the contents of the directory.
Already tried that. It doesn't do it.
â YeB
Jul 30 at 12:29
add a comment |Â
up vote
0
down vote
There probably is no simple way, but you can do it with a lot of effort by using the extended wildcard exclude syntax. This may not be documented in the man page but is mentioned more in the README. However, for details of the syntax you need to see the man page for fnmatch(3).
Basically, you can use !(somedir) as an exclude to not exclude, so you end up only including that directory. Imagine you have the following example tree in /tmp
$ mkdir -p a/b d/e d/e2
$ touch a/b/c d/e/f d/e2/f2
and you only want to copy a and d/e whilst preserving these full pathnames. You can use
$ echo '!(a)' >exclude
$ mksquashfs /tmp mysq -ef exclude -wildcards
$ echo -e '!(d)/nd/!(e)' >exclude
$ mksquashfs /tmp mysq -ef exclude -wildcards
Listing the filesystem with unsquashfs -l mysq produces the output
squashfs-root/a
squashfs-root/a/b
squashfs-root/a/b/c
squashfs-root/d
squashfs-root/d/e
squashfs-root/d/e/f
Each time, the source directory is /tmp, but the first time we exclude everything except directory a, and the second time we exclude everything except directory d and d/e. This uses a multi-level exclude file where on each line we exclude one more directory step in the path except the one that is to be retained.
A simpler solution is to create the wanted hierarchy of directories somewhere, and mount -bind the final directory to the real directory.
For example,
$ mkdir -p a/usr/local/bin a/some/other/bin
$ sudo mount -o bind /usr/local/bin a/usr/local/bin
$ sudo mount -o bind /some/other/bin a/some/other/bin
$ mksquashfs a ~/mysq
$ sudo umount a/usr/local/bin a/some/other/bin
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
man mksquashfs:
-keep-as-directory
if one source directory is specified, create a root directory conâÂÂ
taining that directory, rather than the contents of the directory.
Already tried that. It doesn't do it.
â YeB
Jul 30 at 12:29
add a comment |Â
up vote
0
down vote
man mksquashfs:
-keep-as-directory
if one source directory is specified, create a root directory conâÂÂ
taining that directory, rather than the contents of the directory.
Already tried that. It doesn't do it.
â YeB
Jul 30 at 12:29
add a comment |Â
up vote
0
down vote
up vote
0
down vote
man mksquashfs:
-keep-as-directory
if one source directory is specified, create a root directory conâÂÂ
taining that directory, rather than the contents of the directory.
man mksquashfs:
-keep-as-directory
if one source directory is specified, create a root directory conâÂÂ
taining that directory, rather than the contents of the directory.
answered Jul 30 at 8:39
Ipor Sircer
8,6271920
8,6271920
Already tried that. It doesn't do it.
â YeB
Jul 30 at 12:29
add a comment |Â
Already tried that. It doesn't do it.
â YeB
Jul 30 at 12:29
Already tried that. It doesn't do it.
â YeB
Jul 30 at 12:29
Already tried that. It doesn't do it.
â YeB
Jul 30 at 12:29
add a comment |Â
up vote
0
down vote
There probably is no simple way, but you can do it with a lot of effort by using the extended wildcard exclude syntax. This may not be documented in the man page but is mentioned more in the README. However, for details of the syntax you need to see the man page for fnmatch(3).
Basically, you can use !(somedir) as an exclude to not exclude, so you end up only including that directory. Imagine you have the following example tree in /tmp
$ mkdir -p a/b d/e d/e2
$ touch a/b/c d/e/f d/e2/f2
and you only want to copy a and d/e whilst preserving these full pathnames. You can use
$ echo '!(a)' >exclude
$ mksquashfs /tmp mysq -ef exclude -wildcards
$ echo -e '!(d)/nd/!(e)' >exclude
$ mksquashfs /tmp mysq -ef exclude -wildcards
Listing the filesystem with unsquashfs -l mysq produces the output
squashfs-root/a
squashfs-root/a/b
squashfs-root/a/b/c
squashfs-root/d
squashfs-root/d/e
squashfs-root/d/e/f
Each time, the source directory is /tmp, but the first time we exclude everything except directory a, and the second time we exclude everything except directory d and d/e. This uses a multi-level exclude file where on each line we exclude one more directory step in the path except the one that is to be retained.
A simpler solution is to create the wanted hierarchy of directories somewhere, and mount -bind the final directory to the real directory.
For example,
$ mkdir -p a/usr/local/bin a/some/other/bin
$ sudo mount -o bind /usr/local/bin a/usr/local/bin
$ sudo mount -o bind /some/other/bin a/some/other/bin
$ mksquashfs a ~/mysq
$ sudo umount a/usr/local/bin a/some/other/bin
add a comment |Â
up vote
0
down vote
There probably is no simple way, but you can do it with a lot of effort by using the extended wildcard exclude syntax. This may not be documented in the man page but is mentioned more in the README. However, for details of the syntax you need to see the man page for fnmatch(3).
Basically, you can use !(somedir) as an exclude to not exclude, so you end up only including that directory. Imagine you have the following example tree in /tmp
$ mkdir -p a/b d/e d/e2
$ touch a/b/c d/e/f d/e2/f2
and you only want to copy a and d/e whilst preserving these full pathnames. You can use
$ echo '!(a)' >exclude
$ mksquashfs /tmp mysq -ef exclude -wildcards
$ echo -e '!(d)/nd/!(e)' >exclude
$ mksquashfs /tmp mysq -ef exclude -wildcards
Listing the filesystem with unsquashfs -l mysq produces the output
squashfs-root/a
squashfs-root/a/b
squashfs-root/a/b/c
squashfs-root/d
squashfs-root/d/e
squashfs-root/d/e/f
Each time, the source directory is /tmp, but the first time we exclude everything except directory a, and the second time we exclude everything except directory d and d/e. This uses a multi-level exclude file where on each line we exclude one more directory step in the path except the one that is to be retained.
A simpler solution is to create the wanted hierarchy of directories somewhere, and mount -bind the final directory to the real directory.
For example,
$ mkdir -p a/usr/local/bin a/some/other/bin
$ sudo mount -o bind /usr/local/bin a/usr/local/bin
$ sudo mount -o bind /some/other/bin a/some/other/bin
$ mksquashfs a ~/mysq
$ sudo umount a/usr/local/bin a/some/other/bin
add a comment |Â
up vote
0
down vote
up vote
0
down vote
There probably is no simple way, but you can do it with a lot of effort by using the extended wildcard exclude syntax. This may not be documented in the man page but is mentioned more in the README. However, for details of the syntax you need to see the man page for fnmatch(3).
Basically, you can use !(somedir) as an exclude to not exclude, so you end up only including that directory. Imagine you have the following example tree in /tmp
$ mkdir -p a/b d/e d/e2
$ touch a/b/c d/e/f d/e2/f2
and you only want to copy a and d/e whilst preserving these full pathnames. You can use
$ echo '!(a)' >exclude
$ mksquashfs /tmp mysq -ef exclude -wildcards
$ echo -e '!(d)/nd/!(e)' >exclude
$ mksquashfs /tmp mysq -ef exclude -wildcards
Listing the filesystem with unsquashfs -l mysq produces the output
squashfs-root/a
squashfs-root/a/b
squashfs-root/a/b/c
squashfs-root/d
squashfs-root/d/e
squashfs-root/d/e/f
Each time, the source directory is /tmp, but the first time we exclude everything except directory a, and the second time we exclude everything except directory d and d/e. This uses a multi-level exclude file where on each line we exclude one more directory step in the path except the one that is to be retained.
A simpler solution is to create the wanted hierarchy of directories somewhere, and mount -bind the final directory to the real directory.
For example,
$ mkdir -p a/usr/local/bin a/some/other/bin
$ sudo mount -o bind /usr/local/bin a/usr/local/bin
$ sudo mount -o bind /some/other/bin a/some/other/bin
$ mksquashfs a ~/mysq
$ sudo umount a/usr/local/bin a/some/other/bin
There probably is no simple way, but you can do it with a lot of effort by using the extended wildcard exclude syntax. This may not be documented in the man page but is mentioned more in the README. However, for details of the syntax you need to see the man page for fnmatch(3).
Basically, you can use !(somedir) as an exclude to not exclude, so you end up only including that directory. Imagine you have the following example tree in /tmp
$ mkdir -p a/b d/e d/e2
$ touch a/b/c d/e/f d/e2/f2
and you only want to copy a and d/e whilst preserving these full pathnames. You can use
$ echo '!(a)' >exclude
$ mksquashfs /tmp mysq -ef exclude -wildcards
$ echo -e '!(d)/nd/!(e)' >exclude
$ mksquashfs /tmp mysq -ef exclude -wildcards
Listing the filesystem with unsquashfs -l mysq produces the output
squashfs-root/a
squashfs-root/a/b
squashfs-root/a/b/c
squashfs-root/d
squashfs-root/d/e
squashfs-root/d/e/f
Each time, the source directory is /tmp, but the first time we exclude everything except directory a, and the second time we exclude everything except directory d and d/e. This uses a multi-level exclude file where on each line we exclude one more directory step in the path except the one that is to be retained.
A simpler solution is to create the wanted hierarchy of directories somewhere, and mount -bind the final directory to the real directory.
For example,
$ mkdir -p a/usr/local/bin a/some/other/bin
$ sudo mount -o bind /usr/local/bin a/usr/local/bin
$ sudo mount -o bind /some/other/bin a/some/other/bin
$ mksquashfs a ~/mysq
$ sudo umount a/usr/local/bin a/some/other/bin
edited Jul 30 at 14:33
answered Jul 30 at 14:07
meuh
29k11648
29k11648
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f459284%2fmksquashfs-how-to-include-full-absolute-directory-paths-inside-the-squashfs-ima%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password