-
Notifications
You must be signed in to change notification settings - Fork 526
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ticket #3147: implement extfs support for SquashFS
Requires squashfs-tools, initial code contributed by Unknown. Signed-off-by: Yury V. Zaytsev <[email protected]>
- Loading branch information
Showing
8 changed files
with
2,801 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--drop-ids |
1,354 changes: 1,354 additions & 0 deletions
1,354
tests/src/vfs/extfs/helpers-list/data/usqfs.input
Large diffs are not rendered by default.
Oops, something went wrong.
1,350 changes: 1,350 additions & 0 deletions
1,350
tests/src/vfs/extfs/helpers-list/data/usqfs.output
Large diffs are not rendered by default.
Oops, something went wrong.