mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
Ticket #3015: extfs vfs: support unrar-5.
This commit is contained in:
parent
47b122d9a5
commit
62d43659bd
@ -9,24 +9,17 @@
|
|||||||
# rar and unrar can be found on http://www.rarlabs.com/
|
# rar and unrar can be found on http://www.rarlabs.com/
|
||||||
|
|
||||||
RAR=rar
|
RAR=rar
|
||||||
UNRAR=$RAR
|
|
||||||
|
|
||||||
# Prefer unrar (freeware). Try to find unrar in $PATH.
|
# Prefer unrar (freeware).
|
||||||
save_IFS="$IFS"; IFS=:
|
UNRAR=`which unrar 2>/dev/null`
|
||||||
for dir in $PATH; do
|
|
||||||
IFS="$save_IFS"
|
|
||||||
test -z "$dir" && dir=.
|
|
||||||
if test -x "$dir/unrar" -a -f "$dir/unrar"; then
|
|
||||||
UNRAR="$dir/unrar"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -x $UNRAR -a -x $RAR ]; then
|
[ -z $UNRAR ] && UNRAR=$RAR
|
||||||
UNRAR=$RAR
|
[ ! -x $UNRAR -a -x $RAR ] && UNRAR=$RAR
|
||||||
fi
|
|
||||||
|
|
||||||
mcrarfs_list ()
|
# Define $UNRAR version
|
||||||
|
UNRAR_VERSION=`$UNRAR -? | grep "Copyright" | sed -e 's/.*\([0-9]\)\..*/\1/'`
|
||||||
|
|
||||||
|
mcrar4fs_list ()
|
||||||
{
|
{
|
||||||
$UNRAR v -c- -cfg- "$1" | @AWK@ -v uid=`id -u` -v gid=`id -g` '
|
$UNRAR v -c- -cfg- "$1" | @AWK@ -v uid=`id -u` -v gid=`id -g` '
|
||||||
BEGIN { flag=0 }
|
BEGIN { flag=0 }
|
||||||
@ -44,6 +37,27 @@ flag==1 {
|
|||||||
}'
|
}'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mcrar5fs_list ()
|
||||||
|
{
|
||||||
|
$UNRAR v -c- -cfg- "$1" | @AWK@ -v uid=`id -u` -v gid=`id -g` '
|
||||||
|
BEGIN { flag=0 }
|
||||||
|
/^-----------/ { flag++; if (flag > 1) exit 0; next }
|
||||||
|
flag==1 {
|
||||||
|
split($5, a, "-")
|
||||||
|
if (index($1, "D") != 0)
|
||||||
|
$1="drwxr-xr-x"
|
||||||
|
else
|
||||||
|
if (index($1, ".") != 0)
|
||||||
|
$1="-rw-r--r--"
|
||||||
|
printf "%s 1 %s %s %d %02d/%02d/%02d %s ./%s\n", $1, uid, gid, $2, a[2], a[1], a[3], $6, $8
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
mcrarfs_list ()
|
||||||
|
{
|
||||||
|
[ x$UNRAR_VERSION = x5 ] && mcrar5fs_list "$@" || mcrar4fs_list "$@"
|
||||||
|
}
|
||||||
|
|
||||||
mcrarfs_copyin ()
|
mcrarfs_copyin ()
|
||||||
{
|
{
|
||||||
# copyin by christian.gennerat@alcatel.fr
|
# copyin by christian.gennerat@alcatel.fr
|
||||||
|
Loading…
Reference in New Issue
Block a user