Skip to content
This repository was archived by the owner on Feb 28, 2025. It is now read-only.

Commit c2a0343

Browse files
committed
Merge branch '3147_squashfs'
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2 parents ed35e73 + 24602c3 commit c2a0343

File tree

8 files changed

+2801
-0
lines changed

8 files changed

+2801
-0
lines changed

configure.ac

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,7 @@ src/vfs/extfs/helpers/ulha
644644
src/vfs/extfs/helpers/ulib
645645
src/vfs/extfs/helpers/unar
646646
src/vfs/extfs/helpers/urar
647+
src/vfs/extfs/helpers/usqfs
647648
src/vfs/extfs/helpers/uwim
648649
src/vfs/extfs/helpers/uzip
649650
src/vfs/extfs/helpers/uzoo

misc/mc.ext.ini.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -936,6 +936,10 @@ Shell=.ipk
936936
Type=\\(gzip compressed
937937
Include=tar.gz
938938

939+
[squashfs]
940+
Type=^Squashfs filesystem
941+
Open=%cd %p/usqfs://
942+
View=%view{ascii} unsquashfs -stat %f ; unsquashfs -lls -d "" %f
939943

940944
### Sources ###
941945

src/vfs/extfs/helpers/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ EXTFS_IN = \
3535
ulib.in \
3636
unar.in \
3737
urar.in \
38+
usqfs.in \
3839
uwim.in \
3940
uzip.in \
4041
uzoo.in
@@ -68,6 +69,7 @@ EXTFS_OUT = \
6869
ulib \
6970
unar \
7071
urar \
72+
usqfs \
7173
uwim \
7274
uzip \
7375
uzoo

src/vfs/extfs/helpers/usqfs.in

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#! /bin/sh
2+
#
3+
# Squash file system
4+
#
5+
# tested to comply with unsquashfs version 4.2 (2011/02/28)'s output
6+
7+
SQUASHFS="${MC_TEST_EXTFS_LIST_CMD:-unsquashfs}"
8+
AWK="@AWK@"
9+
MV=mv
10+
RM=rm
11+
12+
mcsqfs_list ()
13+
{
14+
$SQUASHFS -d "" -lls "$1" | $AWK '
15+
{
16+
if (NR < 5)
17+
next
18+
split($2, a, "/")
19+
file_type=substr($1,1,1)
20+
file_size=file_type == "c" || file_type == "b" ? 0 : $3
21+
# character or block device
22+
if (NF == 7) {
23+
split($5, b, "-")
24+
printf "-%9s 1 %8s %8s %8s %2s-%2s-%4s %5s %s\n", substr($1,2), a[1], a[2], file_size, b[2], b[3], b[1], $6, $7
25+
} else {
26+
split($4, b, "-")
27+
# normal file
28+
if (NF < 7)
29+
printf "%10s 1 %8s %8s %8s %2s-%2s-%4s %5s %s\n", $1, a[1], a[2], file_size, b[2], b[3], b[1], $5, $6
30+
# symbolic link
31+
else
32+
printf "%10s 1 %8s %8s %8s %2s-%2s-%4s %5s %s %s %s\n", $1, a[1], a[2], file_size, b[2], b[3], b[1], $5, $6, $7, $8
33+
}
34+
}' 2>/dev/null
35+
}
36+
37+
# permission user group size date time filename - symlinktarget
38+
# lrwxrwxrwx root/root 2 2013-12-31 12:50 /foolink -> foo
39+
# $1 a[1] a[2] $3 b[1]b[2]b[3] $5 $6 $7 $8
40+
41+
# AAAAAAAAAA NNN OOOOOOOO GGGGGGGG SSSSSSSS DATETIME [PATH/]FILENAME [-> [PATH/]FILENAME[/]]]
42+
#
43+
# where (things in [] are optional):
44+
#
45+
# AAAAAAAAAA is the permission string like in ls -l
46+
# NNN is the number of links
47+
# OOOOOOOO is the owner (either UID or name)
48+
# GGGGGGGG is the group (either GID or name)
49+
# SSSSSSSS is the file size
50+
# FILENAME is the filename
51+
# PATH is the path from the archive's root without the leading slash (/)
52+
# DATETIME has one of the following formats:
53+
# Mon DD hh:mm, Mon DD YYYY, Mon DD YYYY hh:mm, MM-DD-YYYY hh:mm
54+
#
55+
# where Mon is a three letter English month name, DD is day 1-31,
56+
# MM is month 01-12, YYYY is four digit year, hh is hour and
57+
# mm is minute.
58+
#
59+
# If the -> [PATH/]FILENAME part is present, it means:
60+
#
61+
# If permissions start with an l (ell), then it is the name that symlink
62+
# points to. (If this PATH starts with a MC vfs prefix, then it is a symlink
63+
# somewhere to the other virtual filesystem (if you want to specify path from
64+
# the local root, use local:/path_name instead of /path_name, since /path_name
65+
# means from root of the archive listed).
66+
#
67+
# If permissions do not start with l, but number of links is greater than one,
68+
# then it says that this file should be a hardlinked with the other file.
69+
70+
mcsqfs_copyout ()
71+
{
72+
$SQUASHFS "$1" "$2" >/dev/null
73+
$MV "squashfs-root/$2" "$3"
74+
$RM -rf squashfs-root
75+
}
76+
77+
umask 077
78+
79+
cmd="$1"
80+
shift
81+
case "$cmd" in
82+
list) mcsqfs_list "$@" ;;
83+
copyout) mcsqfs_copyout "$@" ;;
84+
*) exit 1 ;;
85+
esac
86+
87+
exit 0

tests/src/vfs/extfs/helpers-list/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ data_files_to_distribute = \
7777
data/urar.v6,v5.env_vars \
7878
data/urar.v6,v5.input \
7979
data/urar.v6,v5.output \
80+
data/usqfs.input \
81+
data/usqfs.output \
8082
data/uzip.README \
8183
data/uzip.with-zipinfo.env_vars \
8284
data/uzip.with-zipinfo.input \
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--drop-ids

tests/src/vfs/extfs/helpers-list/data/usqfs.input

Lines changed: 1354 additions & 0 deletions
Large diffs are not rendered by default.

tests/src/vfs/extfs/helpers-list/data/usqfs.output

Lines changed: 1350 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)