mirror of
https://github.com/MidnightCommander/mc
synced 2025-03-12 19:03:10 +03:00
Ticket #3147: implement extfs support for SquashFS
Requires squashfs-tools, initial code contributed by Unknown. Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
This commit is contained in:
parent
ed35e73bac
commit
24602c3281
@ -644,6 +644,7 @@ src/vfs/extfs/helpers/ulha
|
||||
src/vfs/extfs/helpers/ulib
|
||||
src/vfs/extfs/helpers/unar
|
||||
src/vfs/extfs/helpers/urar
|
||||
src/vfs/extfs/helpers/usqfs
|
||||
src/vfs/extfs/helpers/uwim
|
||||
src/vfs/extfs/helpers/uzip
|
||||
src/vfs/extfs/helpers/uzoo
|
||||
|
@ -936,6 +936,10 @@ Shell=.ipk
|
||||
Type=\\(gzip compressed
|
||||
Include=tar.gz
|
||||
|
||||
[squashfs]
|
||||
Type=^Squashfs filesystem
|
||||
Open=%cd %p/usqfs://
|
||||
View=%view{ascii} unsquashfs -stat %f ; unsquashfs -lls -d "" %f
|
||||
|
||||
### Sources ###
|
||||
|
||||
|
@ -35,6 +35,7 @@ EXTFS_IN = \
|
||||
ulib.in \
|
||||
unar.in \
|
||||
urar.in \
|
||||
usqfs.in \
|
||||
uwim.in \
|
||||
uzip.in \
|
||||
uzoo.in
|
||||
@ -68,6 +69,7 @@ EXTFS_OUT = \
|
||||
ulib \
|
||||
unar \
|
||||
urar \
|
||||
usqfs \
|
||||
uwim \
|
||||
uzip \
|
||||
uzoo
|
||||
|
87
src/vfs/extfs/helpers/usqfs.in
Normal file
87
src/vfs/extfs/helpers/usqfs.in
Normal file
@ -0,0 +1,87 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# Squash file system
|
||||
#
|
||||
# tested to comply with unsquashfs version 4.2 (2011/02/28)'s output
|
||||
|
||||
SQUASHFS="${MC_TEST_EXTFS_LIST_CMD:-unsquashfs}"
|
||||
AWK="@AWK@"
|
||||
MV=mv
|
||||
RM=rm
|
||||
|
||||
mcsqfs_list ()
|
||||
{
|
||||
$SQUASHFS -d "" -lls "$1" | $AWK '
|
||||
{
|
||||
if (NR < 5)
|
||||
next
|
||||
split($2, a, "/")
|
||||
file_type=substr($1,1,1)
|
||||
file_size=file_type == "c" || file_type == "b" ? 0 : $3
|
||||
# character or block device
|
||||
if (NF == 7) {
|
||||
split($5, b, "-")
|
||||
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
|
||||
} else {
|
||||
split($4, b, "-")
|
||||
# normal file
|
||||
if (NF < 7)
|
||||
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
|
||||
# symbolic link
|
||||
else
|
||||
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
|
||||
}
|
||||
}' 2>/dev/null
|
||||
}
|
||||
|
||||
# permission user group size date time filename - symlinktarget
|
||||
# lrwxrwxrwx root/root 2 2013-12-31 12:50 /foolink -> foo
|
||||
# $1 a[1] a[2] $3 b[1]b[2]b[3] $5 $6 $7 $8
|
||||
|
||||
# AAAAAAAAAA NNN OOOOOOOO GGGGGGGG SSSSSSSS DATETIME [PATH/]FILENAME [-> [PATH/]FILENAME[/]]]
|
||||
#
|
||||
# where (things in [] are optional):
|
||||
#
|
||||
# AAAAAAAAAA is the permission string like in ls -l
|
||||
# NNN is the number of links
|
||||
# OOOOOOOO is the owner (either UID or name)
|
||||
# GGGGGGGG is the group (either GID or name)
|
||||
# SSSSSSSS is the file size
|
||||
# FILENAME is the filename
|
||||
# PATH is the path from the archive's root without the leading slash (/)
|
||||
# DATETIME has one of the following formats:
|
||||
# Mon DD hh:mm, Mon DD YYYY, Mon DD YYYY hh:mm, MM-DD-YYYY hh:mm
|
||||
#
|
||||
# where Mon is a three letter English month name, DD is day 1-31,
|
||||
# MM is month 01-12, YYYY is four digit year, hh is hour and
|
||||
# mm is minute.
|
||||
#
|
||||
# If the -> [PATH/]FILENAME part is present, it means:
|
||||
#
|
||||
# If permissions start with an l (ell), then it is the name that symlink
|
||||
# points to. (If this PATH starts with a MC vfs prefix, then it is a symlink
|
||||
# somewhere to the other virtual filesystem (if you want to specify path from
|
||||
# the local root, use local:/path_name instead of /path_name, since /path_name
|
||||
# means from root of the archive listed).
|
||||
#
|
||||
# If permissions do not start with l, but number of links is greater than one,
|
||||
# then it says that this file should be a hardlinked with the other file.
|
||||
|
||||
mcsqfs_copyout ()
|
||||
{
|
||||
$SQUASHFS "$1" "$2" >/dev/null
|
||||
$MV "squashfs-root/$2" "$3"
|
||||
$RM -rf squashfs-root
|
||||
}
|
||||
|
||||
umask 077
|
||||
|
||||
cmd="$1"
|
||||
shift
|
||||
case "$cmd" in
|
||||
list) mcsqfs_list "$@" ;;
|
||||
copyout) mcsqfs_copyout "$@" ;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
|
||||
exit 0
|
@ -77,6 +77,8 @@ data_files_to_distribute = \
|
||||
data/urar.v6,v5.env_vars \
|
||||
data/urar.v6,v5.input \
|
||||
data/urar.v6,v5.output \
|
||||
data/usqfs.input \
|
||||
data/usqfs.output \
|
||||
data/uzip.README \
|
||||
data/uzip.with-zipinfo.env_vars \
|
||||
data/uzip.with-zipinfo.input \
|
||||
|
1
tests/src/vfs/extfs/helpers-list/data/usqfs.args
Normal file
1
tests/src/vfs/extfs/helpers-list/data/usqfs.args
Normal file
@ -0,0 +1 @@
|
||||
--drop-ids
|
1354
tests/src/vfs/extfs/helpers-list/data/usqfs.input
Normal file
1354
tests/src/vfs/extfs/helpers-list/data/usqfs.input
Normal file
File diff suppressed because it is too large
Load Diff
1350
tests/src/vfs/extfs/helpers-list/data/usqfs.output
Normal file
1350
tests/src/vfs/extfs/helpers-list/data/usqfs.output
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user