commit 9627c69d75a1e01b4fb9ce69dc65e577018380ae
Author: ilia maslakov <il.smind@gmail.com>
Date: Tue Oct 13 01:26:36 2020 +0300
Add PAK Archive support for extfs
Signed-off-by: ilia maslakov <il.smind@gmail.com>
diff --git a/misc/mc.ext.in b/misc/mc.ext.in
index 0311baae1..af5f11358 100644
a
|
b
|
type/^LHa\ .*archive |
176 | 176 | Open=%cd %p/ulha:// |
177 | 177 | View=%view{ascii} @EXTHELPERSDIR@/archive.sh view lha |
178 | 178 | |
| 179 | # PAK |
| 180 | type/^PAK\ .*archive |
| 181 | Open=%cd %p/unar:// |
| 182 | View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view pak |
| 183 | |
179 | 184 | # arj |
180 | 185 | regex/i/\.a(rj|[0-9][0-9])$ |
181 | 186 | Open=%cd %p/uarj:// |
diff --git a/src/vfs/extfs/helpers/Makefile.am b/src/vfs/extfs/helpers/Makefile.am
index ff8116d80..eda97c5d3 100644
a
|
b
|
EXTFS_IN = \ |
32 | 32 | ulha.in \ |
33 | 33 | ulib.in \ |
34 | 34 | urar.in \ |
| 35 | unar.in \ |
35 | 36 | uzip.in \ |
36 | 37 | uzoo.in |
37 | 38 | |
… |
… |
EXTFS_OUT = \ |
61 | 62 | ulha \ |
62 | 63 | ulib \ |
63 | 64 | urar \ |
| 65 | unar \ |
64 | 66 | uzip \ |
65 | 67 | uzoo |
66 | 68 | |
diff --git a/src/vfs/extfs/helpers/README.extfs b/src/vfs/extfs/helpers/README.extfs
index 22ac8dfbb..04d5fcb02 100644
a
|
b
|
patchsetfs - list of patches of current file |
73 | 73 | |
74 | 74 | # Gputils lib archives. |
75 | 75 | ulib |
| 76 | |
| 77 | # PAK Archive |
| 78 | unar |
| 79 | No newline at end of file |
diff --git a/src/vfs/extfs/helpers/unar.in b/src/vfs/extfs/helpers/unar.in
new file mode 100644
index 000000000..ccd9b5ce2
-
|
+
|
|
| 1 | #! /bin/sh |
| 2 | |
| 3 | # Written by Ilia Maslakov <il.smind@gmail.com> |
| 4 | # |
| 5 | # (C) 2020 The Free Software Foundation. |
| 6 | |
| 7 | # Define awk |
| 8 | AWK=@AWK@ |
| 9 | |
| 10 | # Define which archiver you are using with appropriate options |
| 11 | UNAR_LIST="lsar " |
| 12 | UNAR_GET="unar " |
| 13 | |
| 14 | # The 'list' command executive |
| 15 | |
| 16 | mc_unar_fs_list() |
| 17 | { |
| 18 | # List the contents of the archive and sort it out |
| 19 | $UNAR_LIST -l "$1" | $AWK -v uid=`id -nu` -v gid=`id -ng` ' |
| 20 | BEGIN { flag=0 } |
| 21 | /^\(Flags/ {next} |
| 22 | /^\(Mode/ {next} |
| 23 | { |
| 24 | flag++; |
| 25 | if (flag < 4) next |
| 26 | pr="-r--r--r--" |
| 27 | if (index($2, "D") != 0) |
| 28 | pr="dr-xr-xr-x" |
| 29 | split($6, a, "-") |
| 30 | split($7, b, ":") |
| 31 | |
| 32 | printf "%s 1 %s %s %d %02d/%02d/%02d %02d:%02d %s\n", pr, uid, gid, $3, a[3], a[2], a[1], b[1], b[2], $8 |
| 33 | |
| 34 | }' |
| 35 | } |
| 36 | |
| 37 | |
| 38 | |
| 39 | # The 'copyout' command executive to copy displayed files to a destination |
| 40 | |
| 41 | mc_unar_fs_copyout () |
| 42 | { |
| 43 | TMPDIR=`mktemp -d "${MC_TMPDIR:-/tmp}/mctmpdir-uha.XXXXXX"` || exit 1 |
| 44 | |
| 45 | $UNAR_GET "$1" "$2" -o "$TMPDIR" >/dev/null |
| 46 | we=`basename "$1" | sed -r 's|^(.*?)\.\w+$|\1|'` |
| 47 | cat "$TMPDIR/$we/$2" > "$3" |
| 48 | cd / |
| 49 | rm -rf "$TMPDIR" |
| 50 | } |
| 51 | |
| 52 | # The main routine |
| 53 | umask 077 |
| 54 | |
| 55 | cmd="$1" |
| 56 | shift |
| 57 | |
| 58 | case "$cmd" in |
| 59 | list) mc_unar_fs_list "$@" ;; |
| 60 | copyout) mc_unar_fs_copyout "$@" ;; |
| 61 | *) exit 1 ;; |
| 62 | esac |
| 63 | |
| 64 | exit 0 |